Prepare and test your skills
Prepare and test your skills
Defining prompt engineering and its significance means explaining why the words a user types control what a model does. A large language model (LLM) (opens in a new tab) is a foundation model trained on vast amounts of text to predict what is likely to come next. The prompt is the main control over that prediction because the model cannot guess unstated intent. A clear prompt bridges user intent and model capability by stating the task, context, audience, and desired format, while a vague prompt forces the model to fill in missing details on its own.
Why prompts control model behavior is that data flows in one direction from user goal to prompt wording to model response. The user supplies the goal, the LLM supplies broad language and reasoning ability, and the prompt connects them with explicit instructions and background. When the prompt defines the task and adds key context, the model does not have to infer missing details and the output aligns more closely with intent. Well-designed prompts therefore produce answers that are more accurate, relevant, and consistent.
How prompt design reduces hallucinations and supports safety is by adding guardrails that keep the model grounded. Hallucinations are confident-sounding but false or unsupported statements, and they become more likely when a prompt is open-ended or asks for information the model does not have. Careful prompting constrains the response so the output depends more on supplied context and clear instructions and less on guessing:
The prompt also acts as a safety boundary where user intent on one side is shaped to stay within respectful and ethical expectations on the other side. Positive constraints such as asking for respectful language, balanced viewpoints, and compliance with policy guide the model toward responsible behavior.
Exam tip: A specific prompt with context and clear limits reduces hallucinations, while a vague prompt increases guessing.
What prompt engineering and preambles include is an iterative process of designing, testing, and refining inputs to get specific, high-quality results. Instead of accepting the first answer, the engineer treats each change as an experiment and checks its effect across models and documents. In enterprise summarization tools, the structured input is called a preamble, which combines a task description that sets the role and goal with additional instructions that control how the task is done. For example, the task description might be "You are an enterprise summarization tool," while the instructions add style, format, and accuracy rules.
A complete preamble combines several instruction dimensions, and changing any dimension changes the final response even when the task description stays the same:
Effective teams refine preambles through iterative testing, user feedback about recurring issues, staying updated as models change, and thorough evaluation across all intended use cases to catch bias.
Why better prompts improve efficiency is that improving the prompt is faster and cheaper than changing the model itself. Content supplies the instructions, examples, and context, while structure uses ordering, labeling, and delimiters to help the model parse that information. Even when all required information is present, better organization improves quality and reduces retries, token use, and latency from prompt submission to complete response. Teams must test the number of examples because too few under-guides the model while too many can cause overfitting to the examples.
Trying prompt improvement first can avoid resource-intensive steps such as supervised tuning (opens in a new tab), reinforcement learning from human feedback (RLHF) tuning, or model distillation, which all require building datasets and selecting methods. It can also avoid moving to a larger model, which can learn more complex patterns but often has higher latency and higher cost. Cost depends on metering by input and output tokens or by node hours, and latency is measured as Time to First Token and Time to Last Token, so keeping the existing model through better prompting controls both.
Identifying prompting techniques and use cases means matching the amount and type of guidance in the prompt to the task. A large language model (LLM) (opens in a new tab) can create coherent new content, and in-context learning controls that output by what is included inside the prompt itself. Zero-shot, one-shot, and few-shot strategies differ mainly in the number of examples, while role prompting and prompt chaining add persona and workflow structure. Choosing the right technique improves format, tone, accuracy, and logical consistency.
How zero-shot, one-shot, and few-shot learning differ is in how many input-output examples the prompt provides. Zero-shot prompting, also called direct prompting, provides no examples and relies solely on pre-existing knowledge from training. One-shot prompting provides one example to show the desired pattern, format, or style. Few-shot prompting provides several example pairs so the model can better recognize the pattern and apply it to a new request.
| Strategy | Examples in prompt | Choose when |
|---|---|---|
| Zero-shot | None | The task is straightforward and pre-existing knowledge is enough |
| One-shot | One input-output pair | The task needs a single clear example of format, tone, or style |
| Few-shot | Several input-output pairs | The task is more complex and needs stronger guidance from multiple examples |
Few-shot provides the strongest in-prompt guidance because the model sees the pattern repeated, but examples also help control formatting, phrasing, scope, and overall patterns.
How role prompting and persona constraints work is by telling the model who to act as and what boundaries to respect. Role prompting opens the prompt with a role definition before the request, such as "You are a polite customer service agent" or "You are an expert at Google Search." That persona tells the model which knowledge and style to use, so an agent sounds reassuring while a search expert focuses on concise terms. Persona constraints then create contextual boundaries through explicit limits:
These boundaries keep the model from drifting into unrelated topics or inventing answers, and the same persona can handle self-knowledge questions, fixed-reference questions like prices, and dynamic questions backed by a database.
How prompt chaining breaks complex work into linked steps is by replacing one large request with an ordered workflow where each output becomes the next input. Each step handles a narrow piece so the model reasons over already-processed material rather than the raw task, which improves accuracy and keeps reasoning on track:
$information or $last-user-utterance.Because each step is smaller and depends on the previous result, the model is less likely to lose track of a sophisticated task.
How chains use external tools and retrieved information is by letting a step pull in current data or take action between prompts. Data flows from an outside system into a parameter and then into a prompt placeholder, so later steps reason over external, current information rather than only training data. When a step relies only on training data, the answer is not guaranteed to be true or up to date:
Common chain patterns combine these mechanisms, such as retrieving customer information from CSV, SQL, JSON, or plain text, generating an optimized search query, answering only from supplied $information, generating code from $problem and $programming-language, and escalating to a human agent from $last-user-utterance when needed.
Exam tip: When the answer must come only from provided information, include an explicit decline rule; without it the model falls back to training knowledge, which may not be true or up to date.
Identifying advanced prompting techniques means choosing methods that add explicit reasoning or tool use for harder tasks. Chain-of-Thought (CoT) prompting improves logic by showing step-by-step reasoning before the answer, while the ReAct framework adds actions that fetch outside information between reasoning steps. Technique selection matches the method to task complexity, model capability, and required precision. Testing tools and parameters then balance accuracy, cost, and resource use.
How Chain-of-Thought prompting improves reasoning is that reasoning flows from the prompt to intermediate steps to the final answer. The prompt provides instructions and examples that demonstrate reasoning first, and the model follows that pattern by generating its own steps before producing structured output. Because models predict what is likely to come next, seeing and generating steps in order keeps the final answer grounded in prior logic. Order matters: first the step-by-step reasoning, then the final answer that depends on it.
Logic decomposition supports this by breaking a large request into smaller cognitive actions that run in sequence. A single prompt that asks the model to summarize, extract entities, translate, and draft an email is trying to do too much and should be split into separate prompts or clearly ordered steps. Explicit reasoning helps most when a task is complex, requires a specific format, or involves nuanced judgment, and it also forces the model to check assumptions for edge cases and incomplete inputs. Built-in Thinking, which is a model capability that generates its own internal reasoning, is distinct from explicit instructions written in the prompt, so both versions should be tested and the more accurate one kept.
Exam tip: In Chain-of-Thought examples, always show step-by-step reasoning before the final structured answer, never the answer before the reasoning.
How the ReAct framework combines reasoning and acting is by interleaving thought with concrete tool use. ReAct stands for Reasoning and Acting, and it lets the model think through a problem and then request help from another system that runs in its own environment. The result returns across the trust boundary into the model context, where the model handles language and decisions while the tool handles factual lookup and real actions. This pattern supports generative AI applications that need current or specific information the model does not already have.

A process-flow diagram of the ReAct framework showing an LLM and an external tool separated by a trust boundary. A moving signal traces the loop: the model produces a Thought, sends an Action to the tool, the tool returns an Observation, and the model repeats or produces the final answer.
The ReAct loop is a repeating cycle where reasoning guides the next action and each action result guides the next reasoning:
This cycle makes task completion autonomous because the model decides the order based on what each observation reveals. Common tools include search engines for current facts, databases for stored records, calculators for precise math, and APIs for actions like checking inventory. Choose ReAct when the answer depends on changing or external data, lightweight tool calling, or dependent lookups, and avoid it when instructions alone are enough because extra calls add time and complexity.
How technique selection and prompt components drive results is through a test-driven, iterative workflow. The workflow starts by clearly defining the objective and expected outcome, then systematically testing prompts to find areas for improvement. Content supplies instructions, examples, and context, while structure uses ordering, labeling, and delimiters to help the model parse that information. When one prompt asks for several distinct cognitive actions, it is likely doing too much and should be split.
Prompt components add precision beyond the basic objective and step-by-step instructions:
Common design failures to check before testing include overt manipulation with flattery or pressure, conflicting instructions and examples, redundant or irrelevant content, missing output format or role definition, underspecified handling of edge cases, tasks outside model capabilities, non-standard machine-readable formats instead of JSON, XML, Markdown, or YAML, fragmented non-linear logic, and prompt injection from untrusted input without safeguards.
How Vertex AI Studio (opens in a new tab) tools and parameters shape results is by helping writers create, refine, and compare prompts while controlling randomness and cost. The built-in AI assistant speeds up writing: to refine, open Vertex AI Studio, enter a prompt and submit, click Refine prompt with feedback such as shorter, longer, more professional, or more casual, then apply and repeat until satisfactory. To generate, use Help me write to describe the goal, generate the prompt, then insert and submit. The Compare feature shows prompts and responses side by side for a new prompt, a saved prompt, or a ground truth preferred answer, with extra evaluation metrics for ground-truth comparison, but it does not support media or multi-exchange chat prompts.
Parameters balance precision and resource use, though safety filters can still block responses:
| Parameter | What it controls | How to choose |
|---|---|---|
| Temperature | Randomness in token selection | Lower for true or correct responses; higher for diverse results |
| Output token limit | Maximum text output, where a token is about four characters | Raise it when the answer needs to be longer |
| Thinking budget | How much the model thinks before answering | Auto for only when needed; Manual to set budget; Off to disable |
| Structured output | Forces machine-readable format such as JSON | Choose when output must be machine-readable |
| Grounding | Connects the model to Google Search, Google Maps, or your own data | Choose Google for public sources or Your data for RAG Engine and search |
Max responses sets the maximum number of responses per prompt, while Top-P changes token selection. Structured output turns off grounding options, so the two cannot be combined.
$information.Prompt engineering is the iterative process of designing, testing, and refining inputs to get specific, high-quality results. It matters because the prompt is the main control over what a large language model predicts, bridging user intent and model capability by stating the task, context, audience, and desired format, while a vague prompt forces the model to fill in missing details on its own.
The difference is how many input-output examples the prompt provides. Zero-shot prompting provides no examples and relies solely on pre-existing knowledge from training, one-shot prompting provides one example to show the desired pattern, format, or style, and few-shot prompting provides several example pairs so the model can better recognize the pattern and apply it to a new request.
Chain-of-Thought prompting improves reasoning by showing step-by-step reasoning before the answer so the model generates its own steps before producing structured output. Because models predict what is likely to come next, seeing and generating steps in order keeps the final answer grounded in prior logic, so order matters with reasoning first and the final answer that depends on it last.
The Reasoning and Acting framework interleaves thought with concrete tool use by repeating a cycle of Thought, Action, Observation, and repeat or finish. The model reasons about the goal and what information is still missing, calls an external tool such as a search function or API, reads the tool result as new evidence, and only produces the final answer after the evidence is sufficient.
Last updated