From Zero-Shot to Self-Consistency: A Practical Ladder of Prompting Techniques
Prompt engineering as a ladder: zero-shot, few-shot, decomposition, critique loops and reasoning prompts, with a support-bot example and when to use plain code.
This article is published in English.
Sources: Prompt Engineering for LLMs: Zero-Shot, Few-Shot, Reasoning, Decomposition & ReAct
Once an application has settled what a model gets to see, which documents are fetched, what is condensed, and what stays out of the window, a different problem takes over: phrasing the actual request. No single prompting method wins across the board. A sensible habit is to begin with the plainest instruction that could work, and to bring in examples or step-by-step structure only when a task proves it needs them.
The running scenario below is a customer-support assistant.
Starting with no examples at all
A zero-shot prompt describes the job and shows nothing of what good output looks like. For the support assistant, that could be a one-line request to summarize a complaint, with the complaint pasted underneath:
Summarize the following customer complaint in one sentence.
<complaint>
The package arrived three days late and the box was damaged.
</complaint>
The model gets a task and nothing else. That plainness is the reason to try it first. Everything added to a prompt carries a price: examples eat context, extra instructions raise complexity, and each additional piece is another place for two rules to collide. If a direct instruction already gives dependable output, elaborate scaffolding is a cure for a disease nobody has.
What a good instruction answers
A well-formed task statement settles four things: the action to take, the material to draw from, the limits that apply, and the shape the answer should have. A fuller version of the complaint prompt looks like this:
Task:
Summarize the customer complaint.
Source:
<complaint>
The package arrived three days late and the box was damaged.
</complaint>
Constraints:
- Use only the information in the complaint.
- Do not infer the cause of the damage.
- Use one sentence.
Output:
Return only the summary.
It is wordier than a bare "Summarize this," yet every added line removes a guess. The model no longer has to wonder whether to speculate about causes, how long to go on, or whether commentary is welcome. Guidance published by the large model vendors points the same direction: say what the task is, what the output should be, which constraints hold and what context matters, instead of hoping the model infers it. Put simply, any requirement the application cares about should be written down.
Concrete goals beat friendly ones
"Be helpful" gives the model almost nothing to aim at. "Name the problem the customer describes and sum it up in one sentence" gives it a target. Compare two instructions for the support tool. The weak one says to help the customer. The stronger one asks for the authentication problem the customer describes, plus at most three troubleshooting steps backed by the supplied documentation.
This matters because a model can continue a prompt in many plausible directions. A vague goal leaves room for it to settle on a reading that differs from what the developer meant, while a precise one shrinks that room.
Limits belong inside the task
Say the assistant must never invent a fix that the documentation lacks. That is a product rule, so the prompt has to say it: use only the documentation provided, and if it does not cover the question, state that the available information is not enough. Compare that with "Be accurate," which names a hoped-for outcome but gives no instruction for what to do about uncertainty.
The pattern generalizes. Do not only describe the ideal result; describe what the model should do when that result cannot be produced safely. It matters even more later, for tool calls and structured output.
Where zero-shot is enough
A bare instruction usually holds up when the task is simple, the behavior is easy to put into words, the model already knows the kind of task, the output rules are modest, and the input has no strange edge cases. Asking for the product version in a message, version number only, is one such task. Translating a sentence into French is another. Piling five demonstrations onto either buys little.
So the first rule of prompt optimization is oddly conservative: begin with zero-shot, and add machinery only after evaluation shows a need.
Ways zero-shot breaks
Several failure types recur.
Ambiguity. "Make this better" begs the question: shorter, more persuasive, more accurate, more formal? The model must guess. Contrast it with a request to rewrite a support reply so it is concise, professional and clear to a non-technical customer while keeping every factual claim intact. That version is far more tightly bounded.
Missing context. A model cannot rely on facts it was never handed and cannot fetch. Ask it why a customer's authentication failed without supplying an error message or system details, and no rewording will create the missing evidence. Here the fix is better context, not a better instruction. It is an obvious point, and also a real boundary of prompt engineering.
Clashing requirements. A prompt that asks for a complete explanation in exactly ten words demands two things that cannot both be done well. Good prompt design heads off such conflicts instead of trusting the model to settle each one.
Unstated assumptions. A developer who writes "Summarize the complaint" may mean "list only facts the customer stated." The model might instead return a fluent summary with reasonable inferences baked in. If the difference matters, the instruction must spell it out. Assumptions that matter to the system should become explicit, machine-readable requirements.
Adding examples
When a plain instruction falls short, the next tool is few-shot prompting: placing worked examples of the task inside the context. A classifier that sorts messages into billing, technical and account categories might show a few labeled messages before the real one:
Task:
Classify the customer message as BILLING, TECHNICAL, or ACCOUNT.
Example 1:
"My invoice contains an unexpected charge."
→ BILLING
Example 2:
"The application crashes when I upload a file."
→ TECHNICAL
Example 3:
"I cannot reset my password."
→ ACCOUNT
Now classify:
"I was charged twice for my subscription."
From those demonstrations the model infers the mapping. This is called in-context learning, since the model changes how it behaves for the current request using the examples in its window, while its underlying parameters stay untouched. Essentially the examples say, "This is what the task looks like in practice," and they can convey details that are awkward to put in prose.
Demonstrations teach the task, not only the layout
Many developers treat few-shot examples as a formatting aid. They do more. Take a sample pairing "the application is slow" with the label TECHNICAL. That shows the output format, but it also shows how this application understands the TECHNICAL category. Examples shape the model's grasp of the task itself.
Which is why bad examples are risky. Inconsistent labels, accidental bias or edge cases that contradict policy can all be copied back by the model.
Picking which examples to include
With 10,000 historical tickets on hand, putting all of them in a prompt is impractical, so a subset must be chosen. Random choice is the naive route. A better one deliberately covers representative cases:
Example 1: straightforward billing issue
Example 2: straightforward technical issue
Example 3: ambiguous issue
Example 4: boundary case
Example 5: short, poorly written request
What counts as a good selection depends on the job. Classification needs the main classes and their boundaries represented. A formatting task needs examples that show the required structure. A reasoning-heavy task benefits from examples that show how to break the problem down or check it. In every case, an example earns its place through the information it carries, not through being available.
How many
More is not automatically better. If one carefully chosen example makes the behavior obvious, thirty more might add thousands of tokens with no gain, and could introduce conflicting patterns. Few-shot prompting thus inherits the same context budget tension as everything else, and the right count has to be found by testing.
Here prompt engineering starts to look like experimental work. The question stops being whether a prompt sounds better and becomes whether this version does better on representative test cases. That shift becomes central once evaluation enters the picture.
Variety in the examples
If every demonstration is a short, clean, well-written request, the model may learn a narrow pattern that real users do not follow. Real messages look like this:
"can't login"
"I've been locked out since yesterday"
"Password reset isn't sending me anything"
"login broken after changing phone"
These all describe related trouble in very different words. A good few-shot set reflects the variation the application expects. That does not mean adding examples at random; it means covering meaningful differences on purpose.
Showing what to avoid
Some tasks gain from pairing a good output with a bad one, so the model sees the boundary. In the support case, a message saying a package arrived late could come with an acceptable summary and a flawed one:
Input:
"The customer says the package arrived late."
Good output:
"The customer reports that the package arrived late."
Bad output:
"The courier lost the package."
Reason:
The customer did not state that the courier lost it.
The bad example marks a limit: do not infer facts the input does not support. Negative examples need care, though. One labeled as wrong can accidentally teach the very behavior it was meant to prevent, particularly when the difference is subtle. The application should test whether the negative demonstrations improve results and not just assume they will.
Examples for structure
When an output layout is hard to describe, an example works well. Suppose the assistant should reply with three labeled lines for issue, evidence and action:
Issue: ...
Evidence: ...
Action: ...
One worked demonstration makes that layout concrete at once:
Input:
"The login token expired after 30 days."
Output:
Issue: Expired authentication token
Evidence: Token expiration is reported after 30 days
Action: Regenerate the authentication token
It fixes both the content pattern and the presentation. Examples are not always the right answer, though. If software needs machine-readable JSON with guaranteed validity, a schema-constrained output feature can be sturdier than showing the model a sample.
Keeping the examples consistent
Few-shot prompts react badly to contradiction. Consider two demonstrations with the same input, "Can't log in," labeled ACCOUNT in one and TECHNICAL in the other:
Example 1:
"Can't log in" → ACCOUNT
Example 2:
"Can't log in" → TECHNICAL
The model has no principled way to know which mapping is intended. Subtler mismatches hurt too. If some examples use the label BILLING and others use the phrase "Billing issue," the output space becomes blurry. Labels, formatting, terminology, level of detail and handling of edge cases should all agree across examples. The demonstrations are part of the specification, and deserve the same care.
Learning inside the window
In-context learning is the general idea behind few-shot prompting: examples sit in the current context, and behavior shifts for that interaction. It does not mean the model permanently absorbed them. If the application sends one labeled example and then a user message about being unable to access an account:
Example:
"Password reset email never arrived." → ACCOUNT
User:
"I can't access my account."
the model can use the demonstration for this request. Its parameters are not updated and the example is not added to its lasting knowledge. This mirrors the split between context and memory from earlier. Methods that do change parameters, such as fine-tuning on additional training data, are a separate mechanism, and comparing them with prompting comes much later. For now, few-shot prompting is best seen as temporary task conditioning supplied through context.
Deciding between the two
A workable decision process starts by naming how the output goes wrong. An ambiguous task calls for clearer wording. Missing information calls for better context. A subtle convention the model overlooks is where examples may help. If the task needs exact arithmetic or database access, more prose in the prompt may be entirely the wrong remedy.
That last case leads on to harder territory. Some jobs are too complicated to handle reliably with one instruction and one reply. They need to be split into smaller operations, checked, or tied to external computation. Past a certain point, the challenge is no longer finding the perfect sentence; it is designing a small procedure for the model to follow.
Consider a ticket where a customer is locked out right after a password change, and the assistant is told to go through the history, pin down the likely cause and write back. That looks like one task. In practice it hides several: working out what happened, finding the relevant evidence, separating facts from assumptions, reasoning about possible causes, deciding what can safely be recommended, checking that recommendation, and writing the final reply. Seeing that is the doorway to decomposition.
Splitting one task into several
Decomposition replaces one complicated job with several smaller ones that have clear boundaries. Rather than asking for everything in one go, the application can lay out the request as stages:
Task:
Analyze this customer support case.
Step 1:
Extract the relevant facts.
Step 2:
Identify the customer's actual problem.
Step 3:
List plausible causes supported by the evidence.
Step 4:
Select the safest supported resolution.
Step 5:
Draft the customer-facing response.
The model does not literally need the word "Step." What counts is that a vague goal has become a sequence of manageable operations. This helps most when the parts have different natures: extracting facts is an information task, picking a diagnosis is reasoning, and writing the message is communication. Lumping them into a single undifferentiated instruction makes the result harder to steer and to evaluate.
A decomposed system also offers more places to test. If the final answer is wrong, one can ask whether fact extraction, diagnosis or response writing failed. The mindset shift is that a prompt can be built like a pipeline and not only written like a question.
Plan first, then act
A related technique asks the model to lay out a plan before carrying out a complex job. It helps when the model must decide which operations are required before it can answer. The support assistant might begin with a goal and ordered plan:
Goal:
Resolve the customer's login problem using only supported evidence.
Plan:
1. Read the latest customer message.
2. Check the relevant conversation history.
3. Identify authentication-related evidence.
4. Compare the evidence with the known troubleshooting guidance.
5. Produce a response that does not claim unsupported facts.
Planning separates deciding how to solve something from actually solving it. The separation gains weight once tools are involved, since the model may need to conclude that it should search a knowledge base, look at an account record or run a calculation first. Prompting can set up the structure of the work before the work begins.
There is a cost. Decomposition adds prompt length, and when each stage is its own call, extra model calls and latency as well. A five-stage pipeline can cost far more than a single call. It pays off when the added control and reliability justify the price, not because more stages are inherently better.
Generate, critique, revise
Another strong pattern lets the model look again at its own draft. The first answer is not treated as final; a second pass inspects it against explicit criteria. For the support system, that means drafting the reply and then checking the draft against a list of named problems:
First:
Draft the response.
Then:
Check the draft for:
- unsupported claims,
- missing evidence,
- incorrect troubleshooting steps,
- promises the support team cannot make,
- failure to answer the customer's actual question.
Finally:
Revise the response to correct any problems.
This works because producing and judging are different jobs. Generating means building something plausible. Reviewing an existing answer lets the model hunt for violations of a checklist. Spelling out the criteria is usually more effective than telling it to think harder.
The pattern scales to different depths: draft, review, final reply, or for a more structured job, extract, verify the extraction, classify, verify the classification, generate. The second form is easier to debug because each stage has a defined contract.
One limit is important. A model asked to criticize itself is not thereby an independent source of truth. If the original answer rests on a false assumption, the critic may share it. Self-critique can improve consistency without guaranteeing correctness, and for high-stakes decisions it is worth checking against something outside the model: a database, a known rule, a calculation, a retrieved document or deterministic code.
Prompts that expose the reasoning structure
Research on chain-of-thought prompting found that showing a model examples with intermediate reasoning steps can improve results on some multi-step problems, with gains reported across arithmetic, commonsense and symbolic benchmarks. The engineering lesson is wider than that phrase. A complex task can benefit when the prompt makes its intermediate structure explicit:
Identify the relevant facts.
Determine which facts support each possible conclusion.
Eliminate conclusions that require unsupported assumptions.
Select the conclusion supported by the evidence.
This is reasoning-oriented prompting: shaping the task so that intermediate decisions are clear enough to steer the model toward the required outcome. It does not oblige a production application to show the user the model's internal reasoning. Often a better interface asks for the outcome of the verification, not a long explanation. The application can require a compact internal record like the one below, then produce a short customer reply separately:
classification: password_reset_issue
evidence_supported: true
recommended_action: resend_reset_link
confidence: high
Reasoning structure and customer-facing explanation are separate requirements. Keeping them apart also avoids a common mistake, which is assuming that more visible reasoning makes an answer more dependable. Intermediate steps can contain errors as well. Studies of chain-of-thought prompting found that properties of the demonstrations, such as their relevance and order, matter a great deal, so merely adding long rationales is no universal remedy.
Several attempts, then a vote
Generation is probabilistic, so one problem can yield different answers on different runs. Self-consistency exploits that by sampling multiple reasoning paths and choosing the answer that most of them support, instead of trusting one sampled path.
Suppose the support system is unsure whether a case is a password-reset issue or an account lockout. Rather than accepting one classification, it could generate several analyses and compare the classifications they arrive at.
Agreement still falls short of truth. If the model consistently misreads the situation, many independent generations can settle on the same wrong answer. Consistency is evidence of stability, not proof of correctness. It also costs more computation and adds latency, which makes it attractive only for tasks hard enough that the gain in reliability justifies the spend.
Where prompts should hand over to code
Here lies the line between ever more elaborate prompts and good system design. Imagine asking for the total of an invoice with 17 items at ₹1500 each. A model can probably do that sum, but when an exact financial figure matters there is no reason to make it simulate arithmetic through longer and longer instructions. A calculator or ordinary program multiplies deterministically.
The same logic covers other jobs:
- Account data should come from a database query, not from the model's memory.
- Current facts should be retrieved, not recalled from training.
- Arithmetic belongs to a calculator or program.
- Checking a schema is the work of a parser and validator.
- Authorization is for application code and access-control rules.
- Critical business rules should be encoded deterministically where practical.
A useful rule follows: use prompting to steer language-model behavior, and use deterministic software when the task actually demands deterministic computation or enforcement.
External actions sharpen the point. ReAct, a well-known research approach, interleaved reasoning with actions so a model could consult outside sources or environments instead of depending only on internal knowledge, and it showed that such interaction can ease problems like hallucination and error propagation on some tasks.
That is the bridge to what comes next. The support system began as a prompt and now resembles a small program. Once verification needs a database, knowledge base, API or other external capability, the model is no longer working on text alone, and the question moves to context engineering: deciding not just which instructions to write but which information the model should receive.