Domain 3 of 4 · Chapter 2 of 3

Prompt Engineering

What prompt engineering is and why it matters

Ask a model to "write about our new running shoe" and you get generic marketing copy. Ask it to "write a 40-word product description for a lightweight trail-running shoe, aimed at weekend hikers, in a friendly tone," and the output is usable. Nothing about the model changed between those two requests. Only the wording did, and that is the whole idea of prompt engineering.

A prompt is the text input you send a large language model (LLM). Prompt engineering is the process of crafting that input to reliably get the output you want, described by Google as an iterative, test-driven process of refining inputs to achieve a specific outcome[1]. You write a prompt, read the response, and adjust the wording, repeating until the answer is accurate and well formatted. The diagram shows that loop.

Why a leader should care

Prompt engineering is the fastest, lowest-cost lever[2] for improving model output. It needs no training data, no labeled examples, and no infrastructure, so a team can improve results in an afternoon instead of a project cycle. That makes it the first lever to reach for, and often the only one a use case needs.

One lever among siblings

Prompt engineering changes the words you send in. It does not add new knowledge to the model or permanently change how the model behaves. When answers must reflect current or private facts, the right lever is grounding, and when the model must consistently perform a specialized task, the right lever is fine-tuning, which adapts the model's weights on labeled examples. Both are covered in their own subtopics. Keeping these separate matters because the exam rewards matching the lever to the problem, and reaching for a prompt tweak when the real gap is missing facts is a classic wrong answer.

Prompt engineering is an iterative, test-driven loopWrite or refinethe promptRun it on the LLMMeets the goal?Ship the promptYesNo: refine
Prompt engineering is an iterative loop: write, run, read, and refine the wording until the output meets the goal, then ship it.

Core techniques: shots, roles, and chaining

Suppose you need a model to classify incoming support tickets as billing, technical, or account. Depending on how much you show it in the prompt, you are using one of several named techniques, and they form a clear ladder from showing nothing to showing several examples.

Zero-shot, one-shot, few-shot

A zero-shot prompt gives the model an instruction and no examples, relying on its pre-existing knowledge[1] to respond. A one-shot prompt adds a single worked example of the input and the desired output. A few-shot prompt adds several. Examples teach the model the format, phrasing, and scope you expect, so Google recommends including few-shot examples[3] in most prompts and notes that prompts without them are often less effective. The counterweight is that if you include too many examples, the model starts copying them too closely instead of generalizing to new inputs, which is what overfitting means, so a few well-chosen examples usually beat a long list. The diagram places the three on that ladder.

Role prompting

Role prompting, also called persona prompting, tells the model who to act as. Casting it as a specific persona[4] such as a financial analyst, a friendly retail assistant, or a security reviewer steers the vocabulary, tone, and depth of the answer without any examples. A practical rule from Google's guidance: if you assign a role, define that role in the prompt, because a prompt that refers to a persona it never established leaves the model guessing.

Prompt chaining

Prompt chaining breaks a complex job into a sequence of smaller prompts and feeds each output into the next. Rather than asking one prompt to research, outline, and write a report, you chain the prompts[3]: one summarizes the source, the next drafts an outline from that summary, and a third writes each section. Each step is simpler, easier to check, and easier to fix. The cost is that an error early in the chain flows downstream, so the earliest steps deserve the most scrutiny.

What the three have in common

All three reshape the prompt rather than the model, and each answers a different question: shots decide how much you show the model, role prompting decides who it speaks as, and chaining decides how many steps the job is broken into. Read a scenario for which of those three is missing and the technique names itself.

The shot ladder: examples you put in the promptFewerMoreZero-shotInstruction only, no examplesOne-shotInstruction plus one exampleFew-shotInstruction plus several examples
The shot ladder: zero-shot gives no examples, one-shot gives one, few-shot gives several, trading more prompt length for more guidance.

Advanced techniques: chain-of-thought and ReAct

A single instruction is fine for looking up a fact, but it struggles with a word problem that needs several steps of arithmetic, or with a task that needs information the model does not have. Two advanced techniques address those two different gaps.

Chain-of-thought: show the reasoning

Chain-of-thought (CoT) prompting asks the model to explain its reasoning step by step[5] before giving a final answer. Google's glossary describes CoT as a technique that has the model detail its intermediate reasoning[1] rather than jump straight to a conclusion, which significantly improves performance on complex reasoning tasks. Do not confuse it with prompt chaining from the previous section: chain-of-thought asks for the reasoning steps inside a single prompt, while prompt chaining links separate prompts end to end, feeding each output into the next. In practice, adding a line like "explain your reasoning step by step" can turn a wrong one-line answer into a correct worked-through one. The trade is length: the model produces more text, which costs more and takes longer, so reserve CoT for problems that genuinely need multi-step reasoning.

ReAct: reason and act

CoT reasons but cannot look anything up. ReAct, short for reasoning and acting, adds that missing half. The model interleaves a reasoning step with an action, such as calling a tool or running a search, then reads the result and reasons again, repeating until it can answer. The diagram shows that loop of thought, action, and observation. This reasoning-and-acting pattern is the conceptual basis of AI agents, which on Google Cloud run on Vertex AI Agent Engine[6], a runtime where the model decides which actions to take and in what order. The agent tooling subtopic covers the products. Here the point is that ReAct is what lets a model move beyond its own knowledge and interact with live systems.

Which of the two

Reach for CoT when the task is self-contained reasoning the model can do from what it already knows, such as math, logic, or planning. Reach for ReAct when the task needs facts or actions from outside the model, such as checking an order status or querying a live database. CoT makes the thinking visible; ReAct makes the model able to act on the world.

ReAct interleaves reasoning with actions in a loopThoughtreason about the taskActioncall a tool or searchObservationread the resultFinal answeractresultagainsolved
The ReAct loop cycles through thought, action, and observation, calling tools until the model can give a final answer.

Exam patterns: matching the technique to the symptom

Exam questions here describe a business situation and a symptom, then ask which prompting technique fixes it. The answer follows from two signals in the stem: how much the model needs to be shown, and whether it needs to reason or reach outside itself.

Read the symptom, name the technique

If the output has the wrong format or tone, the fix is prompt engineering in general, usually few-shot examples[3] that demonstrate the format. If the stem stresses a consistent structure across many responses, that is few-shot. If it stresses a particular voice, persona, or expertise, that is role prompting. If it describes a long task with several stages, that is prompt chaining. If it involves multi-step math, logic, or reasoning the model keeps getting wrong, that is chain-of-thought. If it needs current data, a lookup, or a tool call, that is ReAct.

Common distractors

Two wrong answers recur. The first offers grounding or RAG (retrieval-augmented generation) for a formatting or tone problem, or fine-tuning for a one-off request. Those are heavier levers for different failures: grounding adds facts and fine-tuning changes behavior, when a prompt tweak was all the scenario needed. The second offers more few-shot examples as a cure-all. Past a handful, extra examples cause overfitting and stop helping, and some symptoms, such as stale facts, no number of examples can fix. Match the lever to the symptom: prompting shapes how the model responds, not what it knows.

Watch the vocabulary

The exam uses Google's terms precisely. Zero-shot means no examples, not a quick or careless prompt. Few-shot means a few examples inside the prompt, not fine-tuning on a few files, which is a separate, weight-changing technique. Chain-of-thought is about showing reasoning, while prompt chaining is about linking separate prompts, and the similar names are easy to confuse.

Prompting techniques: what each gives the model and when to reach for it

TechniqueWhat you give the modelBest forWatch out for
Zero-shotAn instruction only, no examplesSimple, familiar tasks the model already handlesVague or inconsistent output on nuanced tasks
One-shotAn instruction plus one examplePinning down a format with a single clear patternOne example may not cover the real variety of inputs
Few-shotAn instruction plus several examplesConsistent format, style, and structureToo many examples cause overfitting to them
Role promptingA persona or role to adoptSetting tone, vocabulary, and expertiseA role the prompt relies on but never defines
Prompt chainingOne subtask per prompt, output fed to the nextComplex, multi-step workflowsErrors in an early step compound down the chain
Chain-of-thoughtA request to show reasoning step by stepMath, logic, and multi-step reasoningLonger, slower, costlier responses
ReActReasoning interleaved with tool actionsTasks needing live data or external toolsNeeds tool integration, so it edges into agents

Decision tree

Needs external data or tools?Hard multi-step reasoning?Long, multi-stage task?Mainly need a fixed format?Need a specific voice/persona?Zero-shotinstruction only (baseline)ReActreason and act with toolsChain-of-thoughtshow reasoning stepsPrompt chainingsplit into ordered promptsFew-shot examplesdemonstrate the formatRole promptingset the personaTechniques layer: combine few-shot, role, and chain-of-thought as neededNoNoNoNoNoYesYesYesYesYes

Sharp facts the exam loves — give these one last read before exam day.

Cheat sheet

Sharp facts the exam loves — scan these before test day.

Prompt engineering steers output without retraining the model

Prompt engineering is the practice of crafting the words you send a large language model so it returns the output you want, changing nothing inside the model itself. Because it needs no training data, no labeled examples, and no infrastructure, it is the cheapest and fastest lever for improving results, so it is the first one to try. Google describes it as an iterative, test-driven process of refining inputs to reach a specific outcome.

6 questions test this
Treat prompting as an iterative loop, not a one-shot write

Good prompts are refined, not written perfectly the first time. The loop is write the prompt, run it, read the output, and adjust the wording, repeating until the answer is accurate and well formatted. Building in a few refinement passes is normal practice rather than a sign the approach is wrong.

Zero-shot prompting gives an instruction and no examples

A zero-shot prompt states the task and relies entirely on the model's pre-existing knowledge, with no worked examples included. It is the right choice for simple, familiar tasks the model already handles well, where adding examples would only lengthen the prompt.

Trap Reading zero-shot as a hasty or vague prompt; it specifically means no worked examples are supplied, not that the prompt is low-effort.

9 questions test this
One-shot prompting supplies a single worked example

A one-shot prompt includes exactly one example of the desired input and output to demonstrate the pattern you want. It fits when a single example is representative enough to pin down the format, and it sits one rung above zero-shot on the example ladder.

12 questions test this

A few-shot prompt includes several worked examples that teach the model the format, phrasing, and scope you expect, which is why Google recommends including them for most non-trivial tasks. The counterweight is a ceiling: too many examples cause the model to overfit to them and generalize worse, so a handful of well-chosen examples beats a long list.

Trap Piling on more and more examples expecting steady gains; past a few, extra examples overfit the model to them rather than improving the answer.

16 questions test this
Role prompting casts the model as a persona to steer tone and depth

Role prompting, also called persona prompting, tells the model who to act as, such as a financial analyst or a support agent, which shapes the vocabulary, tone, and depth of the answer with no examples needed. Google's guidance adds a practical rule: if you assign a role, define it in the prompt, because a prompt that refers to a persona it never established leaves the model guessing.

Trap Referring to a persona the prompt never actually defined; the model cannot consistently adopt a role it was never given.

10 questions test this
Prompt chaining splits a complex job into linked prompts

Prompt chaining breaks a complex task into a sequence of smaller prompts and feeds each output into the next, so one prompt summarizes, the next outlines, and a third writes. Each step stays simple and easy to check, but an error in an early step flows downstream, so the earliest prompts deserve the most scrutiny.

Trap Trusting a long chain without checking the early steps; a mistake in the first prompt is carried into every prompt that follows it.

7 questions test this
Chain-of-thought asks the model to show its reasoning steps

Chain-of-thought (CoT) prompting has the model spell out its intermediate reasoning before giving a final answer, which significantly improves accuracy on math, logic, and other multi-step problems. The cost is length: the model produces more text, so it is slower and more expensive, which is why CoT is reserved for tasks that genuinely need multi-step reasoning.

Trap Adding chain-of-thought to a simple lookup or one-step task; it only adds tokens, latency, and cost without improving a direct answer.

3 questions test this
ReAct interleaves reasoning with actions and observations

ReAct, short for reasoning and acting, has the model reason about the task, take an action such as calling a tool or running a search, read the result, and reason again, looping until it can answer. This lets the model use information beyond its own training, and the reasoning-and-acting pattern is the conceptual basis of tool-using agents.

Trap Choosing chain-of-thought when the task needs live data or a tool; CoT reasons but cannot look anything up, so a lookup calls for ReAct.

3 questions test this
Match the prompting technique to the symptom in the task

The technique follows from the failure you see. Wrong format or tone points to few-shot examples, a consistent structure across responses to few-shot, a specific voice to role prompting, a long multi-stage job to prompt chaining, hard multi-step reasoning to chain-of-thought, and a need for live data or tools to ReAct.

Trap Reaching for more few-shot examples as a universal fix; some failures, such as stale facts, no number of examples can solve.

1 question tests this
Prompting cannot add facts the model never learned

Prompt engineering changes the wording, not the model's knowledge, so it cannot supply current events or private data the model was never trained on. When answers must reflect fresh or authoritative facts, grounding or retrieval-augmented generation (RAG) is the correct lever, not a cleverer prompt.

Trap Adding examples or rephrasing to fix outdated or missing facts; wording shapes format, not knowledge, so the fix is grounding or RAG.

Fine-tuning, not prompting, changes model behavior at scale

When a specialized task or house style must hold consistently across every request, fine-tuning adapts the model's weights on labeled examples, whereas prompting only shapes a single response and does not persist. Prompting is the lighter, cheaper lever, so you reach for fine-tuning only when prompt techniques cannot reach the needed consistency.

Trap Fine-tuning to add fresh facts; tuning changes behavior and style, not knowledge freshness, which is grounding's job.

2 questions test this
Chain-of-thought and prompt chaining are different techniques

The similar names hide a real difference. Chain-of-thought is a single prompt that asks the model to expose its reasoning steps, while prompt chaining links several separate prompts in sequence, passing each output to the next. One is about visible reasoning inside one prompt, the other about wiring prompts together.

Trap Treating chain-of-thought and prompt chaining as the same thing because the names rhyme; they operate at different levels, one inside a prompt and one across prompts.

Few-shot prompting is not fine-tuning on a few examples

Few-shot means placing a few worked examples inside the prompt at request time, and nothing is trained or permanently changed. Fine-tuning on a few examples instead updates the model's weights, so the shared word 'few' hides two very different mechanisms with different costs and durability.

Trap Reading few-shot prompting as a lightweight form of fine-tuning; few-shot trains nothing and only adds examples to the prompt.

Put the needed context and clear instructions in the prompt

Rather than assuming the model already has the facts and constraints a task needs, include them in the prompt, and state specific instructions instead of vague ones. Adding the relevant context and being explicit about the desired output is often the single biggest, lowest-effort quality improvement.

1 question tests this

Also tested in

References

  1. Generative AI on Vertex AI glossary
  2. Tune models (Vertex AI)
  3. Prompt design strategies (Gemini API)
  4. Overview of prompting strategies (Vertex AI)
  5. Prompt design: explain reasoning (Vertex AI)
  6. Vertex AI Agent Engine overview