Courseiva
AIF-C01Chapter 10 of 16Objective 4.2

Prompt Engineering Techniques

How do you get a large language model (LLM) to give you exactly the answer you need, not a generic one? That is the core problem that prompt engineering techniques solve. For the AIF-C01 exam, you need to know three specific methods — zero-shot, few-shot, and chain-of-thought prompting — because the exam tests your ability to choose the right technique for a given scenario, which is a skill every AI practitioner needs.

13 min read
Beginner
Updated Jul 24, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Prompt Engineering Techniques

The Recipe Analogy

Have you ever tried to ask a friend for a recipe, only to get a vague answer like 'just cook it until it looks right'? That is the problem we solve with prompt engineering.

Imagine you want to bake a specific chocolate cake for a friend with a gluten allergy. You cannot just say 'give me a cake recipe'. That is too vague, like a zero-shot prompt. You need to give more details. A better approach is to show your friend a few examples of cakes you like, and then ask for something similar. This is like a few-shot prompt — you provide a couple of example recipes to guide the output.

But what if the recipe requires a complex series of steps, like tempering chocolate? You would not just list ingredients. You would explain the step-by-step logic: 'First, chop the chocolate. Then, heat it to 45°C. Then, cool it to 27°C while stirring. Finally, reheat it to 31°C.' This step-by-step reasoning is a chain-of-thought prompt. You are showing the model the logical process, not just the final answer.

In the kitchen, these techniques take a vague request and turn it into a precise, usable recipe. In AI, they turn a fuzzy question into a helpful, accurate response.

How It Actually Works

Prompt engineering is the practice of designing the input (the prompt) you give to an AI model to get the most useful, accurate, and relevant output. Think of it as the art of asking the right question in the right way. For the AIF-C01 exam, you must understand three foundational techniques: zero-shot prompting, few-shot prompting, and chain-of-thought prompting. Each method is suited for different types of tasks.

Zero-shot prompting is when you give the model a task without any examples. You simply state what you want. For example, if you ask a language model 'Translate this English sentence into French: 'The cat sat on the mat.'', and it returns the correct translation, that is a zero-shot result. The model uses its pre-existing knowledge to perform the task without any extra guidance. This technique works well for simple, common tasks that the model has seen many times during its training. However, it can fail for complex or domain-specific tasks where the model needs more context.

Few-shot prompting involves providing a few examples of the desired input-output pattern in your prompt before asking the actual question. For instance, if you want the model to classify customer feedback as positive or negative, you might first show it: 'Review: The product arrived late. Sentiment: Negative' and then 'Review: The quality is excellent. Sentiment: Positive'. Then, you ask it to classify a new review: 'Review: The battery life is terrible. Sentiment: ?' By providing these examples, you are priming the model to understand the format and the type of answer you expect. This technique is more effective than zero-shot for tasks that require a specific style, format, or nuanced understanding. The number of examples can vary, but two to five is common.

Chain-of-thought (CoT) prompting is a more advanced technique where you ask the model to reason step-by-step before arriving at a final answer. Instead of just asking 'What is 24 * 37?', you prompt: 'Let's think step by step. First, calculate 20 * 37 = 740. Then, calculate 4 * 37 = 148. Then, add 740 + 148 = 888. Therefore, 24 * 37 = 888.' By showing or requesting intermediate reasoning steps, the model can solve complex problems like arithmetic, logic puzzles, and multi-step reasoning tasks more accurately. This technique is particularly valuable when the answer requires logical deduction or calculation.

These techniques do not replace model training or fine-tuning; they are a way to get the most out of an existing pre-trained model. They exist because even the most powerful models need clear, structured instructions to perform well on specific tasks. Without good prompts, you might get irrelevant, incorrect, or poorly formatted answers.

For the exam, you will likely face questions that describe a business scenario and ask you to select the best prompting technique. For example, a scenario might describe a marketing team that wants the model to summarise a long article. They provide one example of a summary. The correct answer would be 'few-shot prompting' because they are providing an example. If they gave no example, it would be zero-shot. If the task involved solving a complex math problem step-by-step, chain-of-thought would be the best choice.

Key terms to know:

Prompt: The input you give to the model.

Output: The model's response.

Example: A sample input-output pair you include in a few-shot prompt.

Intermediate step: A logical reasoning step in a chain-of-thought prompt.

A flowchart showing the three main prompting techniques: zero-shot, few-shot, and chain-of-thought, along with their typical use cases.

Walk-Through

1

Define the Task

Clearly state what you want the model to do. For example, 'Classify the sentiment of this product review as positive, negative, or neutral.' Without a clear task, the model will produce vague or irrelevant output. This step is crucial because it determines which prompting technique will be most effective.

2

Choose the Technique

Decide whether to use zero-shot, few-shot, or chain-of-thought based on the task's complexity. If the task is simple (e.g., translation), zero-shot is efficient. If you need a specific format (e.g., bullet list of features), few-shot is better. If the task requires reasoning (e.g., solving a logic puzzle), choose chain-of-thought.

3

Craft the Prompt (Zero-Shot)

Write a direct instruction without any examples. Example: 'Summarise the following article in two sentences.' Keep it short and clear. This step is fast but may not work for complex tasks that need context.

4

Craft the Prompt (Few-Shot)

Select 2-3 high-quality examples of the desired input-output pattern. Include these examples in the prompt before the real question. Example: 'Sentence: I love this product. Sentiment: Positive. Sentence: This is terrible. Sentiment: Negative. Sentence: The delivery was fast. Sentiment: ?' This guides the model to mimic the pattern.

5

Craft the Prompt (Chain-of-Thought)

Write the prompt to encourage step-by-step reasoning. You can explicitly say 'Let's think step by step' or break down the logic yourself. Example: 'If a train travels at 60 km/h for 2 hours, how far does it go? Let's calculate: distance = speed x time. So distance = 60 km/h x 2 h = 120 km.' This helps the model show its work and reduce errors.

6

Test and Iterate

Run the prompt with a test query and evaluate the output. If the output is not satisfactory, adjust the prompt wording, add more examples, or change the technique. Iteration is key because the first attempt rarely works perfectly.

What This Looks Like on the Job

An IT professional working with AI models uses these prompting techniques daily to build applications that interact with users. Let's walk through a realistic scenario at a company called 'EcoGadgets', an online store that sells eco-friendly electronics. The company wants to build a chatbot that helps customers troubleshoot issues with their products. The AI engineer is responsible for designing the prompts that make the chatbot useful.

First, the engineer needs to decide how to handle simple questions, such as 'What is the return policy?' The engineer chooses a zero-shot prompt: 'Answer the following customer question using only information from our return policy document: What is the return policy?' This works because the customer's question is straightforward and the model can easily extract the answer from the provided document.

Next, the engineer encounters a more complex task: classifying customer complaints into categories like 'battery issue', 'shipping problem', or 'device malfunction'. To ensure the model does this accurately, the engineer uses a few-shot prompt. They create a prompt with three examples: - 'The battery does not hold a charge. Category: battery issue' - 'My order has not arrived yet. Category: shipping problem' - 'The screen keeps freezing. Category: device malfunction' Then, they add the new customer message: 'The headphone volume is too low. Category: ?' This helps the model learn the pattern and classify it correctly.

Finally, the company wants the chatbot to suggest a fix for a problem that requires multiple steps, like 'My smart light bulb does not turn off when I say the voice command.' The engineer uses a chain-of-thought prompt to get the model to reason through the solution: 'Let's solve this step-by-step. Step 1: Check if the light bulb is connected to Wi-Fi. Step 2: Verify if the voice assistant is linked to the bulb. Step 3: Ask the user to try resetting the bulb. Provide the final troubleshooting steps in a clear list.' The model then produces a logical, multi-step answer.

In practice, IT professionals often combine these techniques. They might use few-shot prompting to provide examples of a format, then include a chain-of-thought instruction for reasoning. They also test and iterate on their prompts, adjusting the wording and the number of examples to improve accuracy. The key is to match the technique to the complexity and nature of the task.

For the AIF-C01 exam, you might be given a scenario and asked to identify which technique was used. You will need to recognise that if a prompt includes an example of the desired output, it is few-shot. If it asks for a step-by-step explanation, it is chain-of-thought. If no examples or reasoning steps are included, it is zero-shot.

How AIF-C01 Actually Tests This

The AIF-C01 exam tests your understanding of zero-shot, few-shot, and chain-of-thought prompting in several specific ways. You will see scenario-based multiple-choice questions where you must choose the correct technique for a given situation. The examiners want to know if you can distinguish between these three techniques and apply them appropriately.

Here is what you need to know for the exam:

Zero-shot prompting: The exam loves to test scenarios where the model is given a task with no examples. For instance, 'A developer wants the model to generate a poem about the moon without providing any sample poems.' The correct answer is zero-shot. The trap is that some students think every task needs examples, but many simple tasks do not.

Few-shot prompting: The exam will describe a scenario where the developer provides a few input-output pairs. The classic trap is confusing few-shot with fine-tuning. Few-shot means you include examples in the prompt itself — you do not change the model's training. The model's weights remain unchanged.

Chain-of-thought prompting: The exam focuses on its use for complex reasoning tasks, especially arithmetic, logic, and multi-step problems. The common trap is thinking chain-of-thought is only for math. It is for any problem that requires step-by-step logic, such as writing a plan or diagnosing a fault.

Another exam focus is understanding the trade-offs. Few-shot prompting generally gives better accuracy than zero-shot but requires more tokens (input length) and careful example selection. Chain-of-thought improves reasoning but can be slower and may produce longer outputs. The exam might ask you to choose the best approach for a task that has limited input length (few-shot would be unsuitable).

Key definitions to memorise:

Zero-shot: The model performs a task without any examples.

Few-shot: The prompt includes a small number of examples.

Chain-of-thought: The prompt encourages step-by-step reasoning.

The exam will not test deep technical details about token limits or model architectures. It tests your ability to apply the concepts to real-world use cases.

You may also see a question that tests your understanding of the term 'prompt' itself — a prompt is the text input to the model. It is not the model's output or a training dataset.

Exam traps to avoid:

Do not confuse 'few-shot' with 'one-shot' (a type of more focused learning in computer vision, which is not in the scope of AIF-C01). The exam only asks about zero-shot, few-shot, and chain-of-thought.

Do not assume that chain-of-thought always requires explicitly saying 'Let's think step by step.' Any prompt that asks for reasoning steps qualifies.

Read the scenario carefully: if the prompt includes only a question and no examples, it is zero-shot, even if you think the model needs examples.

Remember that few-shot prompting does not change the model permanently; it only affects the current inference.

Be careful with the term 'few-shot learning' — that is a different concept (training a model on a small number of examples). The exam uses 'few-shot prompting', which is a prompting technique, not a training technique.

Key Takeaways

Zero-shot prompting involves giving a task to the model with no examples; it relies entirely on the model's pre-existing knowledge.

Few-shot prompting improves accuracy by including a small number of input-output examples in the prompt itself.

Chain-of-thought prompting asks the model to reason step-by-step and is best for complex logic and arithmetic problems.

The model's underlying parameters are never altered by any of these prompting techniques; only the input changes.

You should choose zero-shot for simple tasks, few-shot when you need a specific format or style, and chain-of-thought for multi-step reasoning.

Prompt engineering is a cost-effective way to improve model outputs without expensive retraining or data collection.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Zero-Shot Prompting

No examples are provided in the prompt.

Best for simple, common tasks like summarisation or translation.

Faster and uses fewer tokens (cheaper).

Few-Shot Prompting

Includes 2-5 examples of input-output pairs.

Best for tasks requiring specific format or style.

More accurate but uses more tokens (costlier).

Few-Shot Prompting

Does not require step-by-step reasoning.

Examples show the final answer, not the reasoning process.

Works well for classification and formatting tasks.

Chain-of-Thought Prompting

Emphasises the reasoning steps, not just the final answer.

Examples (if used) show the step-by-step logic.

Best for arithmetic, logic, and planning tasks.

Chain-of-Thought Prompting

Explicitly asks for or shows intermediate reasoning steps.

Slower and produces longer outputs.

Reduces errors in complex tasks.

Zero-Shot Prompting

No reasoning steps are requested.

Fast and concise.

May fail on complex, multi-step problems.

Watch Out for These

Mistake

Few-shot prompting means you are retraining the model on the examples you provide.

Correct

Few-shot prompting is a method of providing examples in the prompt itself; the model's underlying parameters are not changed. It is purely an input-level technique.

The term 'few-shot' sounds like a training technique because of the phrase 'few-shot learning' in machine learning. Beginners confuse prompting with model training.

Mistake

Chain-of-thought prompting only works for mathematical problems.

Correct

Chain-of-thought prompting works for any problem that benefits from step-by-step reasoning, including logical deduction, planning, writing instructions, and explaining decisions.

The most common examples in tutorials involve arithmetic, so learners assume it is exclusively for math.

Mistake

Zero-shot prompting is always worse than few-shot prompting.

Correct

Zero-shot prompting can be perfectly adequate for simple, common tasks like translation or summarisation. Few-shot prompting is not always necessary and can waste tokens.

Beginners tend to overuse few-shot because they think more examples always lead to better results, ignoring the cost and simplicity of zero-shot.

Mistake

You need a minimum of three examples for few-shot prompting to work.

Correct

Few-shot prompting can work with as few as one example (sometimes called one-shot, though the exam uses 'few-shot' for any number of examples). There is no strict minimum.

The 'few' in few-shot is vague, making beginners think it means three or more.

Mistake

The model learns permanently from the examples you give in a few-shot prompt.

Correct

The model uses the examples only during that specific interaction. The model does not retain the examples for future use; it does not learn or update its knowledge.

This misconception stems from confusing prompting with fine-tuning or training, where the model's weights are updated.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

What is the difference between zero-shot and few-shot prompting?

Zero-shot prompting gives the model a task without any examples. Few-shot prompting includes a few examples of the desired input-output pattern to guide the model.

When should I use chain-of-thought prompting?

Use chain-of-thought when the task requires logical reasoning, multi-step calculations, or any problem where the model needs to explain its thinking to reach an accurate answer.

Does few-shot prompting change the model permanently?

No, few-shot prompting only affects the current response. The model does not learn or remember the examples for future use.

Can I combine few-shot and chain-of-thought in one prompt?

Yes, you can combine them. For example, you can provide a few examples and then ask the model to reason step-by-step for a new question.

Is chain-of-thought always better than zero-shot?

No, chain-of-thought is better for complex problems but can be slower and produce longer outputs. For simple tasks, zero-shot is more efficient.

What is a prompt in this context?

A prompt is the text or input you give to a language model to get a response. It can include instructions, examples, and questions.

Terms Worth Knowing

Keep going

You've finished Prompt Engineering Techniques. Continue through the AIF-C01 study guide to build a complete picture of the exam.

Done with this chapter?