04.11 Named Prompting Techniques: A Field Guide

Understand LLMsLesson 11 of 128,182 wordsReference16 parts
Module 04 · 0 of 10 lessons done
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12

Lessons 04.1 to 04.10 taught the techniques you will use every week. This lesson is the other half of the shelf: the named techniques from the research literature and from public prompt-engineering guides (the Prompting Guide is the best-known catalogue) that you will meet in papers, blog posts, interview questions and framework docs. Some are now built into the models. Some are the ancestors of agent frameworks. A few are trained systems that only look like prompts. For each one you get the mechanics step by step, a worked example, a runnable offline sketch where one helps, the reported results with their caveats, and an honest verdict for November 2026.

What you'll learn

  • The prompt-level basics that catalogues teach first and courses skip: the four prompt elements, sampling settings (and which ones not to change together), and what the few-shot research actually found about labels and format
  • Auto-CoT, Active-Prompt, Automatic Prompt Engineer (APE) and Generated Knowledge prompting: four ways to get better demonstrations or better context without writing them by hand
  • Automatic Reasoning and Tool-use (ART), Directional Stimulus Prompting (DSP) and Multimodal CoT: what each one really is, and why two of them are trained systems rather than prompts
  • Reflexion, Meta Prompting and Program-Aided Language models (PAL): verbal feedback loops, structure-only prompts, and code as reasoning with a safety gate
  • The variants inside techniques you already know: three Tree-of-Thought forms, ReAct's Lookup action and dense-versus-sparse thoughts, prompt chaining with quote extraction, and why self-consistency needs a wrong greedy baseline to be worth it
  • Applied recipes: prompt functions, synthetic data generation, code generation loops, factuality and bias prompts, and the Graph Prompting name collision
  • A decision table: which named technique, if any, to reach for on a modern model

What you don't need

  • API keys. Every runnable sample is pure Python with a stand-in model; provider-shaped prompts are marked illustrative.
  • The reasoning-model controls (lesson 02.8), the full agent loop (Module 08A) or the full RAG pipeline (Module 07). This lesson links to them.

Setup

Python 3.11+ and the standard library only. Save each sample as the file named in its heading and run it with python file.py.

bash
uv init named-techniques --bare --python 3.13 && cd named-techniques
# nothing to install: the samples use only the standard library

Outputs shown under the runnable samples were produced by running them. Model replies in prompts shown as examples are marked illustrative: they show the shape a reply takes, not a measured result.


What you must be able to do after this lesson#

  • Name the main prompting techniques and what each one does
  • Explain which techniques are trained systems rather than prompts
  • Decide which named technique, if any, to use on a modern model

Why this matters for an AI engineer#

Situation What you need from this lesson
A paper or vendor post says "we use Active-Prompt" or "ART-style tool use" Know what the mechanism is and whether it needs training or human labelling
An interviewer asks you to compare ToT, ReAct and Reflexion A one-paragraph answer for each, with the trade-offs
You want better few-shot examples without hand-writing 20 of them Auto-CoT, Active-Prompt and dynamic selection (04.2, Part 6)
A reasoning model is expensive and your task is easy Know which old tricks are now redundant (most of them)
You need exact arithmetic or dates PAL: let code compute, and gate the code before you run it

Common questions this lesson answers#

Question Where
"What goes in a prompt, and which settings should I touch?" Part 1
"Do few-shot labels have to be right?" 1.3
"How do I pick which questions deserve a hand-written example?" Part 3
"Can a model write its own demonstrations?" Part 2
"Can a model write its own instructions?" Part 4
"What is the difference between ART and function calling?" Part 6
"Is Directional Stimulus Prompting just adding hints?" Part 7
"How does a model learn from failure without fine-tuning?" Part 10
"How do I run model-written code safely?" Part 12
"Which of these should I actually use?" Part 16

Part 1: The basics catalogues teach first#

1.1 The four elements of a prompt#

Public guides break a prompt into four elements; they map onto the seven building blocks of 04.1 like this:

Guide element What it is 04.1 building block
Instruction The task you want done Goal, constraints
Context Extra information or example pairs that steer the answer Context, examples
Input data The thing to process Input data
Output indicator The type or format of the answer, or the start of it Output format, success criteria

Not all four are required. The sky is is a prompt with only an input to continue; Classify the text into neutral, negative or positive. Text: I think the vacation is okay. Sentiment: has an instruction, input data and an output indicator (the trailing Sentiment:), and a model answers Neutral.

1.2 Sampling settings: what to change and what not to change together#

Settings are not part of the prompt text but change the same answer. The guide's advice, consistent with 02.5:

Setting Effect Use
Temperature Low: more deterministic. High: more varied Low for factual QA and extraction, higher for poetry and brainstorming
Top P (nucleus sampling) Low: only the most probable tokens. High: more diverse Same dial as temperature in spirit
Max length Caps tokens generated Controls cost and runaway output
Stop sequences A string that ends generation Use 11 as a stop sequence to cap a numbered list at 10 items
Frequency penalty Penalty grows with how often a token has already appeared Reduces repetition
Presence penalty The same penalty for any token that has appeared at all, however often Encourages new topics

Two rules from the guide are worth memorising: change temperature or top P, not both, and change frequency penalty or presence penalty, not both, because the two dials in each pair overlap and you can no longer tell which one did what. Results vary by model version, and several current reasoning models fix or ignore some of these settings; check the provider page (03.2, 02.8).

1.3 What the few-shot research actually found#

Few-shot prompting is covered in depth in 04.2. The guide adds findings from Min et al., 2022 (as relayed by the guide) that change how you build examples:

  1. The label space and the input-text distribution matter. The model learns what kinds of labels exist and what inputs look like.
  2. Format matters. A consistent text // label layout helps more than the correctness of any single label.
  3. Even random labels beat no labels. A sentiment prompt with deliberately shuffled labels still pushed the model to answer correctly in the guide's demo.
  4. Random labels drawn from the true label distribution beat uniformly random labels.
  5. Newer GPT models may be more robust to format variation. That claim comes from the guide, which says it needs more analysis; it is not in the paper.

The practical reading: examples teach the model the task shape (which labels, what format, what kind of input) at least as much as the mapping. That is why label-balance and ordering effects (04.2, 2.3) matter, and why a few-shot prompt can still fail on a task that needs multi-step reasoning: the guide's "do the odd numbers in this list add up to an even number?" task fails zero-shot (the model says Yes and cites 107 as the sum) and also fails with four True/False demonstrations. Examples cannot teach a reasoning procedure when they only show the final label. That is the motivation for chain-of-thought (04.3): show the working, and one demonstration can be enough.

Few-shot ability also emerges with scale in the research the guide cites (Kaplan et al. 2020, Touvron et al. 2023). Small models often cannot use demonstrations well.


Part 2: Auto-CoT, let the model write the demonstrations#

Deep-dive

Problem. Few-shot CoT (04.3, 2.2) needs hand-written reasoning chains. Writing them per task is slow.

Idea (Zhang et al., 2022). Build the demonstrations automatically with Zero-Shot CoT (the "Let's think step by step" trigger). Two stages:

  1. Question clustering. Partition your question pool into clusters of similar questions (the paper uses sentence embeddings and k-means).
  2. Demonstration sampling. Pick one representative question per cluster, generate its reasoning chain with Zero-Shot CoT, and apply simple heuristics (the guide cites questions of about 60 tokens or fewer and rationales of about five steps or fewer) so only short, clean chains are used.

Why clustering. Zero-Shot CoT sometimes writes a wrong chain. If all your demonstrations come from one kind of question, one systematic mistake is copied everywhere. Spreading the demonstrations over clusters means a wrong chain misleads only part of the prompt. Diversity is the safeguard.

2.1 A runnable sketch: auto_cot.py#

This sketch uses token overlap instead of embeddings so it runs without models. The shape (cluster, pick short representative, append the trigger) is the real one.

python
"""Auto-CoT shape: cluster questions, take one representative per cluster, build demos."""
import re

questions = [
    "A shop sells 4 apples for $2. How much do 12 apples cost?",
    "A baker sells 6 rolls for $3. How much do 18 rolls cost?",
    "If a train goes 60 km in 1 hour, how far does it go in 3 hours?",
    "A car travels 80 km in 2 hours. How far in 5 hours?",
    "Tom has 3 boxes with 5 pens each. How many pens in total?",
    "Mia has 4 bags with 6 pens each. How many pens in total?",
]

def tokens(text):
    return set(re.findall(r"[a-z]+", text.lower())) - {"a", "the", "in", "how", "many", "much", "do", "does", "if", "is", "for", "each", "with", "has", "go", "it"}

def jaccard(a, b):
    return len(a & b) / len(a | b)

# Stage 1: question clustering (greedy, token overlap; real Auto-CoT uses sentence embeddings + k-means)
clusters = []
for q in questions:
    for c in clusters:
        if jaccard(tokens(q), tokens(c[0])) >= 0.25:
            c.append(q)
            break
    else:
        clusters.append([q])

# Stage 2: one representative per cluster, short questions first, plus Zero-Shot-CoT for the rationale
def pick(cluster):
    for q in sorted(cluster, key=lambda s: len(s.split())):
        if len(q.split()) <= 60:        # heuristic from the paper: short questions
            return q

for i, c in enumerate(clusters, 1):
    rep = pick(c)
    print(f"cluster {i}: {len(c)} questions -> representative: {rep}")
    print("  prompt sent to model:", f"Q: {rep}\n  A: Let's think step by step.")
Output · real run9 lines
cluster 1: 2 questions -> representative: A shop sells 4 apples for $2. How much do 12 apples cost?
  prompt sent to model: Q: A shop sells 4 apples for $2. How much do 12 apples cost?
  A: Let's think step by step.
cluster 2: 2 questions -> representative: A car travels 80 km in 2 hours. How far in 5 hours?
  prompt sent to model: Q: A car travels 80 km in 2 hours. How far in 5 hours?
  A: Let's think step by step.
cluster 3: 2 questions -> representative: Tom has 3 boxes with 5 pens each. How many pens in total?
  prompt sent to model: Q: Tom has 3 boxes with 5 pens each. How many pens in total?
  A: Let's think step by step.

In a real pipeline you send each of those prompts to the model, keep the chain it returns (after the length checks), and assemble the three Q / chain / answer triples into the few-shot prompt for new questions.

Verdict (November 2026). The idea lives on as "generate your own examples, then review them" (04.2, 6.1). On reasoning models the Zero-Shot CoT trigger is mostly unnecessary (04.3, Part 3), so Auto-CoT mainly matters for small or non-reasoning models.


Part 3: Active-Prompt, annotate where the model is unsure#

Deep-dive

Problem. Few-shot CoT works, but a human must write the chains, and a random sample of questions is not the best thing to spend that effort on.

Idea (Diao et al., ACL 2024). Spend annotation effort on the questions the model is most uncertain about. Those are the ones where a worked example teaches the most.

  1. Pool. Take a set of unlabelled training questions.
  2. Sample. Ask the model each question k times (the paper uses k = 10), with or without few-shot CoT, at a temperature above zero, to get k answers.
  3. Score uncertainty from how much the answers disagree. The main metrics are disagreement (distinct answers divided by samples) and entropy of the answer distribution. The paper also tried variance and self-confidence; self-confidence did poorly, likely because models are overconfident.
  4. Select the n most uncertain questions (ties broken at random). A human writes the reasoning chain and answer for each.
  5. Use those as the few-shot exemplars at inference, typically together with self-consistency (04.3, 2.4).

The paper annotated 8 exemplars for GSM8K, ASDiv, SVAMP and SingleEq, 7 for CommonsenseQA, 6 for StrategyQA, and 4 for AQuA and the Letter(4) task.

3.1 A runnable sketch: active_prompt.py#

The k answers per question are fixed in the file so the run repeats; in real use they come from k model calls.

python
"""Active-Prompt step 1-3: pick the questions the model is most unsure about."""
import math
from collections import Counter

# Pretend we sampled the model k=10 times per question (temperature > 0).
# In real use these come from k API calls; here they are fixed so the run is repeatable.
samples = {
    "q1: 12 pens at $3, 25% off": ["27", "27", "27", "27", "27", "27", "27", "27", "27", "27"],
    "q2: train leaves 9:40, 2h50m trip": ["12:30", "12:30", "12:20", "12:30", "11:90", "12:30", "12:20", "12:30", "12:30", "12:10"],
    "q3: split $100 in ratio 2:3:5": ["20/30/50", "20/30/50", "25/25/50", "20/30/50", "10/30/60", "20/30/50", "20/30/50", "30/20/50", "20/30/50", "20/20/60"],
    "q4: 7 * 8": ["56"] * 10,
    "q5: next prime after 89": ["97", "91", "93", "97", "95", "91", "97", "99", "93", "91"],
}

def disagreement(answers):
    """Unique answers divided by samples (the paper's 'disagreement' metric)."""
    return len(set(answers)) / len(answers)

def entropy(answers):
    n = len(answers)
    return -sum((c / n) * math.log2(c / n) for c in Counter(answers).values())

ranked = sorted(samples, key=lambda q: (disagreement(samples[q]), entropy(samples[q])), reverse=True)
print(f"{'question':36} {'disagree':>8} {'entropy':>8}")
for q in ranked:
    print(f"{q:36} {disagreement(samples[q]):8.2f} {entropy(samples[q]):8.2f}")

n = 2
print(f"\nSend these {n} to a human to write chain-of-thought answers for:")
for q in ranked[:n]:
    print("  -", q)
Output · real run10 lines
question                             disagree  entropy
q5: next prime after 89                  0.50     2.17
q3: split $100 in ratio 2:3:5            0.50     1.77
q2: train leaves 9:40, 2h50m trip        0.40     1.57
q1: 12 pens at $3, 25% off               0.10    -0.00
q4: 7 * 8                                0.10    -0.00

Send these 2 to a human to write chain-of-thought answers for:
  - q5: next prime after 89
  - q3: split $100 in ratio 2:3:5

(The -0.00 is Python printing negative zero for a distribution with a single answer.) Notice that q1 and q4 were answered consistently: writing a worked example for them would teach nothing, and the method spends nothing on them.

3.2 Reported results and caveats#

The paper's Table 1 reports average accuracy over eight reasoning datasets (arithmetic, commonsense and symbolic). With code-davinci-002: CoT 72.5, self-consistency 79.1, Active-Prompt with disagreement 80.9, with entropy 81.6. With text-davinci-002: 61.5, 67.9, 74.9, 75.3. With gpt-3.5-turbo-0613 (no self-consistency run): CoT 78.5, disagreement 80.0, entropy 81.0. These come from the paper as extracted by a reader tool; the paper states the code-davinci-002 gain over self-consistency as 1.8 in one place and 2.1 in another, so quote the table, not a single gain figure.

Caveats the authors list: they tested one of the two davinci-002/003 models, did not test GPT-4, did not run self-consistency on gpt-3.5-turbo for cost, and the code-davinci-002 model they used is no longer available, which makes the work hard to reproduce. And the method still needs a human to write the chains.

Verdict. Use the idea, not the paper's pipeline: when you curate examples for a classifier or extractor, rank candidate cases by how often the model disagrees with itself (or with your labels) and annotate those first. It pairs naturally with the dev-set discipline of 04.9.


Part 4: Automatic Prompt Engineer (APE)#

Deep-dive

Problem. Writing a good instruction is trial and error.

Idea (Zhou et al., 2022, "Large Language Models Are Human-Level Prompt Engineers"). Treat the instruction as a program to be searched:

  1. Show an LLM some input/output demonstrations and ask it to propose candidate instructions that could have produced them.
  2. Run each candidate on a target model.
  3. Score each candidate on a dev set under the target model (the paper uses execution accuracy or the log-probability of the correct answer) and keep the best. A held-out run then evaluates the chosen instruction.

The paper reports that APE-selected instructions matched or beat human-written ones on all 24 Instruction Induction tasks and 17 of 21 curated BIG-Bench tasks.

The guide's headline example: APE found the trigger "Let's work this out in a step by step way to be sure we have the right answer.", which the guide reports improves on the human-written "Let's think step by step" for chain-of-thought reasoning on MultiArith and GSM8K. (The guide's result tables are images, so this lesson does not quote scores.)

4.1 A runnable sketch: ape.py#

The model is a stand-in that only honours instructions mentioning the order of operations; the point is the generate-score-select loop, not the model.

python
"""APE shape: generate candidate instructions, score each on a dev set, keep the best."""
dev = [("2 + 3 * 4", "14"), ("(2 + 3) * 4", "20"), ("10 - 4 / 2", "8"), ("6 / 3 + 1", "3")]

def fake_model(instruction, question):
    """Stand-in for an LLM call: obeys instructions that mention order of operations."""
    if "order of operations" in instruction.lower():
        return str(int(eval(question)))      # trusted constant input only
    return str(eval(question.replace("*", "+")))   # careless reading

candidates = [
    "Answer the maths question.",
    "Answer the question. Respect the order of operations.",
    "Let's work this out in a step by step way to be sure we have the right answer. Respect the order of operations.",
]

def score(instruction):
    return sum(fake_model(instruction, q) == a for q, a in dev) / len(dev)

for c in sorted(candidates, key=score, reverse=True):
    print(f"{score(c):.2f}  {c}")
Output · real run3 lines
1.00  Answer the question. Respect the order of operations.
1.00  Let's work this out in a step by step way to be sure we have the right answer. Respect the order of operations.
0.00  Answer the maths question.

Two candidates tie. A real APE run breaks ties with a larger dev set or a held-out set, and that is where the lesson sits: the score is only as good as the dev set (04.9). The lineage continues through OPRO, Promptbreeder, EvoPrompt and GEPA, covered with tooling in 04.9, 4.5.

Verdict. Alive and productised (DSPy optimisers, console prompt improvers). Never ship an optimised prompt without a hold-out set.


Part 5: Generated Knowledge prompting#

Deep-dive

Problem. A model often knows the relevant fact but does not use it when answering a question directly.

Idea (Liu et al., ACL 2022). Two calls:

  1. Generate knowledge. A few-shot prompt of Input / Knowledge pairs, ending with an empty Knowledge: line, makes the model write several statements relevant to the question.
  2. Answer with each statement. For each statement, prepend it to the question (the guide's template ends with Explain and Answer:; that wording is the guide's, not the paper's) and collect the answers. The paper keeps the highest-confidence prediction across the statements; the guide's demo simply compares them.

The guide's worked example, in shape:

text
Question: Part of golf is trying to get a higher point total than others. Yes or No?

Direct answer (guide's result): Yes   <- wrong

Knowledge 1 (generated): The objective of golf is to play a set of holes in the
least number of strokes. The total number of strokes is used to determine the
winner. [...]
Answer with knowledge 1: No   (high confidence)

Knowledge 2 (generated): Golf is a precision club-and-ball sport [...] The
player with the lowest score wins.
Answer with knowledge 2: Yes  (lower confidence, because the statement did
not say explicitly that the goal is a *lower* total)

Two lessons from it: the generated facts steer the answer, and stated confidence is not correctness, since the weaker, less explicit statement still produced a confident-sounding answer. The paper's abstract reports gains on four commonsense tasks and state-of-the-art results on NumerSense, CommonsenseQA 2.0 and QASC at the time; the guide gives no numbers.

Where it fails today. The facts are model-generated, so they can be wrong, and the second call then trusts them. If you can retrieve the facts instead, do (Module 07). If you cannot, ask for knowledge and tell the second call to say so when the knowledge is not enough.


Part 6: ART, Automatic Reasoning and Tool-use#

Deep-dive

Problem. Few-shot CoT and tool use both need hand-built prompts. Combining them is more work.

Idea (Paranjape et al., 2023). A frozen LLM plus two libraries, with no hand-written prompt per new task:

  1. A task library holds demonstrations of multi-step programs, with tool calls, for seed tasks.
  2. A tool library holds tools (search, code generation, sandboxed Python execution, and for some tasks a dictionary or a Prolog interpreter).
  3. For a new task, given a few input/output examples, ART selects demonstrations from similar tasks and prompts the model to write a decomposed program for the new task.
  4. At run time, generation pauses whenever a tool is called, the tool output is inserted into the text, and generation resumes.
  5. A human can fix a program's reasoning steps or add a tool or task. That feedback is what pushes ART furthest.

The setup used text-davinci-002 as the frozen LLM with a library of 15 BigBench tasks in five skill clusters, evaluated on 19 unseen BigBench tasks and 6 MMLU tasks.

Reported results (verified from the paper's full text, not the guide). About +10A.8 points on average over direct few-shot prompting; matches or beats Auto-CoT on 32 of 34 BigBench tasks and all MMLU tasks (an average gain of more than 22 points); turning the tools off costs 12.3 points on average; with human feedback (about five edited instances per task) it beat the best published GPT-3 results on 12 test tasks by over 20 points on average. It does not beat the best published GPT-3 results overall (which include hand-crafted CoT): it was 1.7 points lower on the BigBench test tasks and 9.0 lower on the library tasks. The guide's wording "exceeds hand-crafted CoT" holds only with the human feedback.

Limits (paper). Code-generation errors cascade into later steps; it trails expert-written decompositions where those matter.

Verdict. The mechanism (decompose, pause at a tool call, insert the result, continue) is now native function calling and the agent loop of Module 08A. Read ART as the paper that argued for a reusable library of programs and tools rather than prompts hand-built per task, an idea that survives as skills and tool registries.


Part 7: Directional Stimulus Prompting (DSP)#

Deep-dive

Problem. You cannot fine-tune a black-box LLM, but you want to steer it toward a target (summaries that include certain facts, dialogue that uses the right acts).

Idea (Li et al., NeurIPS 2023). A small tunable policy model reads the input and writes a short hint (the "directional stimulus"), such as a keyword list. The hint is added to the prompt of the frozen big model, which writes the final output.

text
[illustrative shape, not a result]
Article: <the article text>
Keywords: Vlad Tarasov; 65 inches; Boston      <- stimulus written by the small model
Summarize the article in 2-3 sentences using the keywords.

(The keyword string is the kind of stimulus the paper reports for a news-summary task.)

How the small model is trained is what makes DSP a system, not a prompt:

  1. Supervised fine-tuning on pseudo-labels: for summarisation, keywords extracted by TextRank that also appear in the reference summary; for dialogue, dialogue acts; for reasoning, trigger phrases that led to correct answers.
  2. Reinforcement learning with the black-box LLM's output score as the reward (ROUGE for summaries, SacreBLEU for MultiWOZ dialogues, correctness for reasoning), plus a penalty that keeps the policy near the supervised one. Policy models were Flan-T5-Large for summarisation and dialogue and T5-base for the reasoning triggers.

Reported results. With only 80 MultiWOZ dialogues, ChatGPT's combined score rose from 68.4 to 96.7 (a 41.4% gain, comparable to some fully supervised systems). On zero-shot CoT with InstructGPT, MultiArith/AQuA accuracy was 79.6/31.9 for "Let's think step by step", 81.6/34.3 for the APE prompt and 84.0/38.6 for DSP trained with RL. The summarisation gains were small: the paper reports about 1 to 2 points on ROUGE, BLEU and Meteor with 1,000 to 4,000 training samples (4 to 13% in the abstract's relative terms).

What you can do without training. You can hand-write the hint: add a Keywords: or Must mention: line to a summary prompt. That is a manual approximation of the idea, not DSP. The method's value is learning which hints work for a given LLM.

Verdict. Niche. Use it as vocabulary: "hint generation by a small model, optimised against the big model's output."


Part 8: Multimodal Chain-of-Thought#

Deep-dive

Idea (Zhang et al., TMLR). Chain-of-thought for questions that come with an image (science diagrams, charts). A model reasoning over text alone often hallucinates the visual facts, so the reasoning must see the picture.

Mechanically it is a fine-tuned two-stage model, not a prompt for a general LLM:

  1. Rationale generation. Input: question, context, options and the image. Output: a rationale.
  2. Answer inference. The rationale is appended to the text input and the model infers the answer.

Both stages use the same architecture (a T5 encoder-decoder initialised from FLAN-Alpaca, with frozen ViT image features combined through attention and gated fusion), trained separately. The two models have 223M and 738M parameters, not the "1B" the guide rounds to.

Reported results. On ScienceQA the 738M model scored 90.45% and the 223M model 85.31%, against 75.17% and 76.47% for few-shot GPT-3.5 and 86.54% for the then-best GPT-4-based system (Chameleon). Removing the vision features cost about 7 points on the base model (85.31% with vision against 78.57% without; 82.62% without the two-stage split). About 56% of the errors in the text-only baseline were hallucinated rationales, and the vision features corrected 60.7% of them.

Limits (paper). In 50 sampled errors, 80% were commonsense mistakes and 14% logical ones; it is weak at maps, counting and alphabet tasks. The paper's own latest version reports that GPT-4V and Gemini Ultra score far above its 738M model on MMMU (56.8% and 59.4% against 28.7%).

What you do today. Send the image to a vision-capable model and ask it to reason before answering. Image input is covered in 03.6 and document images in Module 09. The prompt-level lesson from the paper survives: ask for a description or rationale that cites the image first, then the answer, which makes hallucinated visual facts easier to spot.

text
[illustrative prompt shape]
Look at the attached diagram. First, in <observations>, list only what is
visible in the image (labels, arrows, values). Then, in <reasoning>, use the
observations and the question to work out the answer. Finally, put the answer
in <answer>.

Part 9: Graph Prompting and a name collision#

Deep-dive

The guide's "Graph Prompting" page is a stub that cites GraphPrompt (Liu et al., WWW 2023). That paper is about graph neural networks: it reframes pre-training and downstream tasks into a shared template and uses a learnable prompt vector so a pre-trained GNN can adapt to a new task with few labels. It is prompt tuning of a non-language model, not text prompting of an LLM, so there is no prompt to write.

If you are looking for "prompting an LLM with graph-structured data", that is a different topic: serialise nodes and edges into text (an edge list or adjacency description), or retrieve a subgraph from a knowledge graph and pass it as context (GraphRAG in Module 07). A graph serialised as A -> B (works_at) lines is ordinary context to the model.


Part 10: Reflexion, learning from failure in words#

Deep-dive

Idea (Shinn et al., 2023). An agent improves across attempts without any weight updates by writing down what went wrong and reading it next time. Three roles, plus memory:

  1. Actor: the LLM that acts (a CoT or ReAct agent), producing a trajectory.
  2. Evaluator: scores the trajectory (a test result, a reward, an LLM judge).
  3. Self-reflection: another LLM turns the raw feedback into specific verbal advice.
  4. Memory: short-term memory is the current trajectory; long-term memory is the list of reflections, supplied in the prompt of the next trial.

Reported results. HumanEval pass@1 of 91% against 80% reported for GPT-4 (abstract); ReAct plus Reflexion completed 130 of 134 ALFWorld tasks; Reflexion beat CoT on HotPotQA (no numbers seen).

Limits (guide). It depends on accurate self-evaluation; memory is a bounded window; test-driven code evaluation is awkward when outputs are non-deterministic or hardware dependent.

10.1 A runnable sketch: reflexion.py#

The actor is a stand-in that fixes its bug only after a reflection tells it about the empty-list case. The loop is the real structure.

python
"""Reflexion loop: act, evaluate, write a verbal reflection, retry with memory."""
def actor(task, reflections):
    """Stand-in for an LLM that writes code; it only fixes the bug once it has been told about it."""
    if any("empty list" in r for r in reflections):
        return "def mean(xs):\n    return sum(xs) / len(xs) if xs else 0.0"
    return "def mean(xs):\n    return sum(xs) / len(xs)"

def evaluator(code):
    ns = {}
    exec(code, ns)                      # toy code only; never exec untrusted model output unsandboxed
    for xs, want in [([2, 4], 3.0), ([], 0.0)]:
        try:
            got = ns["mean"](xs)
        except Exception as e:
            return False, f"mean({xs}) raised {type(e).__name__}: {e}"
        if got != want:
            return False, f"mean({xs}) returned {got}, expected {want}"
    return True, "all tests passed"

def self_reflect(code, feedback):
    """Stand-in for the self-reflection LLM: turns raw feedback into advice for the next trial."""
    return f"Last attempt failed ({feedback}). Handle the empty list case before dividing."

memory, MAX_TRIALS = [], 3
for trial in range(1, MAX_TRIALS + 1):
    code = actor("write mean(xs)", memory)
    ok, feedback = evaluator(code)
    print(f"trial {trial}: {'PASS' if ok else 'FAIL'} - {feedback}")
    if ok:
        break
    memory.append(self_reflect(code, feedback))
print("memory:", memory)
Output · real run3 lines
trial 1: FAIL - mean([]) raised ZeroDivisionError: division by zero
trial 2: PASS - all tests passed
memory: ['Last attempt failed (mean([]) raised ZeroDivisionError: division by zero). Handle the empty list case before dividing.']

The reflection prompt is the part you write for real. An illustrative template:

text
[illustrative]
You wrote this attempt: {attempt}
It failed with this feedback: {feedback}
In two sentences, say what went wrong and what to do differently next time.
Do not repeat the attempt. Do not apologise.

Verdict. The pattern is everywhere in modern agents ("retry with the error message and a note"), under names like critique-and-retry and evaluator-optimizer (08A.10). The durable rule: reflections only help when the evaluator gives objective feedback (a test, a validator). An LLM evaluating its own output with no ground truth often reinforces its own mistake (04.3, 2.6).


Part 11: Meta Prompting#

Deep-dive

Idea. Prompt with the structure and syntax of a task rather than with content examples. Instead of three worked problems, you describe the form of a good solution: the steps, their order, the output skeleton. The guide, citing Zhang et al., "Meta Prompting for AI Systems", lists three advantages over few-shot: token efficiency (no long examples), fairer comparison between models (specific examples bias the result less), and zero-shot effectiveness. Its caveat: it assumes the model already knows the task, and may fall short on novel ones.

A structure-only prompt for a maths problem looks like this (an illustrative template of our own; the guide's example is a figure):

text
[illustrative template]
Problem: {problem}

Solution structure:
Step 1. Restate the problem as a list of known quantities and the unknown.
Step 2. Choose the formula or method; name it.
Step 3. Compute, showing each intermediate value on its own line.
Step 4. Check the result against the question (units, sign, magnitude).
Final answer: <one line>

Compare it with few-shot: a few-shot prompt shows two solved problems, so the model might copy their surface content (numbers, topics); the structure-only prompt shows none, so it cannot.

The paper (revised through 2026) also formalises Recursive Meta Prompting, where a model generates its own prompt: a proposer, a validator and an executor. Its abstract reports 46.3% pass@1 on MATH and 83.5% on GSM8K for Qwen-72B with example-free meta prompts. Separately, its Game of 24 batch solver (100% on 1,362 instances, which the authors say is subject to re-verification) amortises one model response across all puzzles, so the authors note its token accounting is not matched to per-instance methods; treat all of these as the authors' own claims.

Not to be confused with "using an LLM to write prompts", which is also called meta-prompting and is covered in 04.8, Part 13. The two meanings share a name; the structure-only prompt is about what the prompt contains, the other about who writes it.

Verdict. Useful and cheap. It is why good system prompts spell out a procedure rather than give examples (04.5).


Part 12: Program-Aided Language models (PAL)#

Deep-dive

Idea (Gao et al., 2022). The model reads a natural-language problem and writes a Python program as its reasoning; an interpreter runs it to get the answer. The model decomposes ("what to compute"); Python does the arithmetic ("the actual numbers"). The abstract reports state-of-the-art few-shot results on GSM8K with Codex, 15 points above PaLM-540B with chain-of-thought, across 13 tasks.

The guide's worked example is a date puzzle. In shape:

text
Question: Today is 27 February 2023. I was born exactly 25 years ago.
What is the date I was born in MM/DD/YYYY?

Model writes (few-shot exemplars end with strftime('%m/%d/%Y')):
  today = datetime(2023, 2, 27)
  born = today - relativedelta(years=25)
  print(born.strftime('%m/%d/%Y'))

Interpreter prints: 02/27/1998

The guide runs the model's code with exec and uses a deprecated completion model; do not copy that. Model-written code is untrusted input.

12.1 A runnable sketch with a gate: pal.py#

This sketch parses the program, accepts only a small allow-list of syntax and calls, and refuses everything else before running. It is a demonstration of the gate idea, not a security boundary: for real use run generated code in a sandbox (Module 12, Module 08A provider code-execution tools).

python
"""PAL shape: the model writes Python; we check it with an allow-list, then run it."""
import ast, math
from datetime import datetime

ALLOWED = (ast.Module, ast.Assign, ast.Expr, ast.BinOp, ast.UnaryOp, ast.Constant, ast.Name, ast.Load,
           ast.Store, ast.Call, ast.Attribute, ast.keyword, ast.Add, ast.Sub, ast.Mult, ast.Div, ast.Pow, ast.USub)
SAFE_CALLS = {"datetime", "sqrt", "timedelta"}

def check(src):
    tree = ast.parse(src)
    for node in ast.walk(tree):
        if not isinstance(node, ALLOWED):
            raise ValueError(f"blocked syntax: {type(node).__name__}")
        if isinstance(node, ast.Call):
            fn = node.func.attr if isinstance(node.func, ast.Attribute) else getattr(node.func, "id", "")
            if fn not in SAFE_CALLS:
                raise ValueError(f"blocked call: {fn}")
    return tree

def run(src):
    tree = check(src)
    env = {"__builtins__": {}, "datetime": datetime, "sqrt": math.sqrt}
    exec(compile(tree, "<model>", "exec"), env)
    return env["result"]

# What a model might write for: "What is 17% of 240, plus the square root of 144?"
model_code = "result = 0.17 * 240 + sqrt(144)"
print("answer:", round(run(model_code), 2))

# And a hostile program is refused before it runs
for bad in ["import os\nresult = 1", "result = open('/etc/passwd')"]:
    try:
        run(bad)
    except ValueError as e:
        print("refused:", e)
Output · real run3 lines
answer: 52.8
refused: blocked syntax: Import
refused: blocked call: open

Limits. The model must write correct code, which is its own reasoning task; the gate guards safety, not correctness. Validate results (a range check, a second method) for anything that matters.

Verdict. PAL is alive as the "code interpreter" tool in every major provider and as "let code do the maths" (02.10, 5.3).


Part 13: Details inside the techniques you already know#

Deep-dive

04.3 introduced these. The catalogue adds variants and details worth knowing.

13.1 Self-consistency: the example that makes the point#

The guide's example is a sister-age puzzle: "When I was 6 my sister was half my age. Now I'm 70. How old is my sister?" A single greedy answer was 35 (wrong). With eight few-shot CoT exemplars (the guide takes them from Table 17 of the Wang et al. paper) and diverse sampling, three sampled chains gave 67, 67, 35, and the majority, 67, is right. Two details:

  • The baseline was wrong. Voting only helps when the model can reach the right answer sometimes; if it is wrong the same way every time, voting just confirms the error (04.3, 2.4).
  • The guide just shows the majority answer emerging and defers to the paper for details. The paper's aggregation is more general (weighted sums over sampled paths), though its Table 1 shows plain majority voting does almost as well as the weighted versions.

13.2 Chain-of-thought: one demonstration can be enough#

For the odd-numbers task, four rationale demonstrations produced a correct answer, and the guide notes that a single demonstration also worked. Zero-shot CoT's classic example is a counting puzzle (10 apples, give away 2 and 2, buy 5, eat 1): without the trigger the model answered 11, and with "Let's think step by step" it answered 10. Treat both as the guide's small demonstrations, not as measured error rates (04.3, 1.3 has the benchmark numbers).

13.3 Tree of Thoughts: three forms, three costs#

Form What it is Cost
Search (Yao et al., 2023) A programme calls the model to propose thoughts, asks it to rate each (sure / maybe / impossible, sampled 3 times per thought), and runs BFS or DFS. For Game of 24: 3 steps, keep the best 5 candidates per step Many calls; needs code
Controller (Long, 2023) A "ToT Controller" decides when to backtrack and how far. It can be a simple rule-based controller (as in the paper's Sudoku solver) or an RL-trained policy network (the paper's more advanced proposal; the guide describes the trained version) Rules are cheap; the trained version needs training
Single-prompt (Hulbert, 2023) One prompt asks the model to simulate three experts who each write one step, share it, and move on; an expert who realises they are wrong leaves One call; no guarantees

The single-prompt form is the one you can try in a chat window:

text
[illustrative; Hulbert's published wording differs slightly]
Imagine three different experts are answering this question.
All experts will write down 1 step of their thinking, then share it with the group.
Then all experts will go on to the next step, and so on.
If any expert realises they're wrong at any point, they leave.
The question is: {question}

A related prompt, PanelGPT (Sun, 2023), uses a simulated panel discussion. Treat both as cheap approximations of search; they do not backtrack the way the real algorithm does (04.3, 8.1).

13.4 ReAct: what the example trace shows#

The paper's HotpotQA exemplar (the Colorado orogeny question) uses three actions: Search[entity], Lookup[string] (find a string in the last retrieved page) and Finish[answer]. In the trace the first search returns a page that does not contain what is needed, and the model retries with a disambiguating search (Search[High Plains (United States)]). Reported behaviour on PaLM-540B: ReAct beats act-only; ReAct beats CoT on FEVER but trails it on HotpotQA; switching between ReAct and CoT with self-consistency was best; and ReAct is brittle when searches return nothing useful. Two further details: use dense thoughts (a thought at every step) for reasoning tasks and sparse thoughts for long decision-making tasks. The loop engineering is in Module 08A.

13.5 Prompt chaining: a document-QA chain#

The guide's example answers questions about a long document in two prompts, with an optional step between them.

text
[illustrative; delimiters and tag names follow the guide's example]

Prompt 1 (instructions and document; the question is sent as the user message): You are a helpful assistant. Your task is to help answer a
question given in a document. The first step is to extract quotes relevant to
the question from the document, delimited by ####. Please output the list of
quotes using <quotes></quotes>. Respond with "No relevant quotes found!" if no
relevant quotes were found.
####
{{document}}
####
Prompt 1 (user message): {question}

[optional step: strip citation markers like [27] from the quotes]

Prompt 2: Given a set of relevant quotes (delimited by <quotes></quotes>) and
the original document (delimited by ####), please compose an answer to the
question. Ensure that the answer is accurate, has a friendly tone, and sounds
helpful.

Why chain: transparency (see the quotes), controllability (change one step), reliability and debuggability (the failing step is visible). The guide's fallback string No relevant quotes found! shows the engineering habit that matters: give each step an explicit failure output so the next step can branch on it. Chaining is covered as a production pattern in 04.8.

13.6 Zero-shot: why it works at all#

Zero-shot works because models are instruction-tuned (Wei et al., 2022) and then refined with human feedback (02.6). The guide's rule of thumb is unchanged: if zero-shot fails, add demonstrations.


Part 14: Prompt functions#

Deep-dive

Idea. Give a prompt a name and parameters so you can call and compose it like a function. A meta prompt defines the convention once, then each function is declared with a name, an input and a rule.

text
[illustrative; follows the guide's prompt-function pattern]
I want you to act as a function named "fix_english". It takes text as input
and returns the text with grammar and spelling corrected, written in a
natural style. Reply "OK" if you understand, and say nothing else.

I want you to act as a function named "trans_word". It takes a word as input
and returns its translation into English. Reply "OK" if you understand.

Then call:  fix_english(trans_word("bonjour tout le monde"))

Details from the guide: asking for a one-word acknowledgement stops the model chattering while you set up the functions; a line such as "DO NOT SAY THINGS ELSE OK, UNLESS YOU DONT UNDERSTAND THE FUNCTION" suppresses extra text; functions can be composed (fix_english(expand_word(trans_word(...)))) and can take several parameters (the guide's pg(length, capitalized, lowercase, numbers, special) generates a password). The guide reports it works better on GPT-4 than GPT-3.5.

Verdict (November 2026). In code, a prompt function is a template plus a schema: a function in your codebase that renders a versioned template and validates a structured output (04.10, 03.4). Do that instead of trusting a chat model to honour a convention for a whole conversation; for passwords specifically, use a real random generator, not a model.


Part 15: Applied recipes the guide includes#

Deep-dive

15.1 Generating data#

The guide's data-generation prompt is a count, a class split and a format:

text
[illustrative]
Produce 10 exemplars for sentiment analysis. Examples are categorized as
either positive or negative. Produce 2 negative examples and 8 positive
examples. Use this format for the examples:
Q: <sentence>
A: <sentiment>

Use it to bootstrap few-shot examples or a first evaluation set, but review before use and measure diversity: models repeat themselves (the same few topics, the same sentence structure). See 04.2, Part 6 and Module 10A on synthetic test data and its limits.

15.2 Code generation: generate, then test#

The guide's coding examples (comment-to-code, function completion from a signature, SQL from a table definition, explaining code) share a loop worth copying:

  1. Ask for code in a constrained format (a system message such as "only output the code block").
  2. Run it. In the guide's comments-to-code example the generated code omitted an import json.
  3. For SQL: give table definitions, ask for the query, then ask for a CREATE TABLE schema and seed data (the guide asks for four rows per table), load them into a scratch database and run the query against them.
  4. Watch for system-message conflicts: in the guide's explain-code example a "Python assistant" system message conflicted with a request to explain SQL. Keep system messages scoped to the whole conversation or leave the language out.

More on code tasks is in 04.8; testing generated code safely is in Module 12.

15.3 Factuality: give the model a way out#

Mitigations the guide lists: provide ground-truth context, lower the probability parameters (temperature, top P), and explicitly allow "I don't know". Its few-shot version uses answerable and unanswerable questions, with ? as the answer to the unanswerable ones:

text
[illustrative]
Q: What is an atom?
A: An atom is a tiny particle that makes up everything.

Q: Who is Alvan Muntz?
A: ?

Q: What is Kozar-09?
A: ?

Q: How many moons does Mars have?
A: Two, Phobos and Deimos.

Q: Who is Neto Beto Roberto?

The guide tests it with a made-up name (the right answer is ?). Test any "I don't know" prompt on invented entities, then on real obscure ones, because over-refusal is the failure on the other side (02.10).

15.4 Bias: exemplar distribution and order#

From the guide's experiments: a prompt with 8 positive and 2 negative examples still labelled "That left a sour taste" as negative, but a vague input ("I feel something") flipped between negative and positive when the guide swapped the exemplar ratio from 2 positive / 8 negative to 8 / 2. Order matters too, and all positives first, then all negatives is discouraged. The mitigations: balance examples across labels, randomise their order, and test, which is the same advice as 04.2, 2.3.

15.5 Adversarial prompts: the guide's defence list#

Module 12 owns this. The guide's catalogue adds vocabulary: prompt injection (untrusted input overrides instructions), prompt leaking (extracting the hidden prompt), jailbreaking (framing a harmful request as benign, for example a poem), DAN and the Waluigi effect (a model trained to be a persona can be steered into its opposite), and simulator attacks that ask a model to emulate a program or game. Its defences, each with limits:

Defence Limit
Instruction defence: warn the model that the input may try to change the instructions No guarantee
Parameterise components: keep instructions and input separate, as in SQL Less flexible than free text
Quotes, escaping, JSON or Markdown formatting The guide's author could not reproduce the claimed effect at temperature 0
Adversarial prompt detector: a second prompt (an evaluator persona) answers yes/no with reasoning Itself attackable
Model choice: avoid instruction-tuned models, use a k-shot prompt on a base model, or fine-tune (the guide says hundreds to a couple of thousand examples) Loses instruction-following

Treat the table as vocabulary. For defences that hold, see 12.2 and 12.5.


Part 16: The decision table#

As of November 2026, on a modern model:

Technique Use it when Otherwise
Zero-shot CoT trigger, Auto-CoT A non-reasoning model fails a multi-step problem Reasoning models: skip
Active-Prompt You are choosing which cases to annotate as examples Rank by disagreement or by dev-set errors
APE / optimisers You have a dev set and a hold-out set Hand-edit with a change log (04.9)
Generated knowledge You cannot retrieve facts but need the model's own background Retrieve instead (Module 07)
ART Never as a paper; use its idea Function calling and agents
DSP You can train a small hint model and have rewards Hand-write a Keywords: line
Multimodal CoT Never as a paper Vision model plus "observe, then reason"
Graph Prompting (GNN) You work with graph neural networks Serialise the graph to text
Reflexion An objective evaluator (tests, validators) exists Plain retry with the error message
Meta prompting (structure-only) You want zero-shot with a procedure Few-shot when a format must be copied
PAL Exact arithmetic or dates Always behind a gate or sandbox
ToT (search) A genuine search problem, measured Reasoning model plus self-consistency
ReAct Tool use with visible traces Native tool calling
Prompt chaining One step is failing and you need to see which One prompt
Prompt functions Quick chat-window reuse Templates plus schemas in code

Common misconceptions#

Misconception Reality
"Few-shot labels must be correct for the model to learn." The research found that label space, input distribution and format matter a great deal, and random labels still beat none. Correct labels still matter for the mapping on harder tasks.
"Active-Prompt removes the need for human annotation." It tells you where to annotate. A human still writes the chains.
"DSP and Multimodal CoT are prompts you can paste." Both are trained systems: a policy model trained with SFT and RL in one case, fine-tuned two-stage encoder-decoder models in the other.
"ART beats hand-written CoT." Only with human feedback. Without it, it was below the best published results on some sets.
"Graph Prompting means prompting an LLM with graphs." The cited paper is prompt tuning for graph neural networks.
"Reflexion lets a model grade itself reliably." It needs an objective evaluator; unaided self-evaluation can reinforce errors.
"PAL's exec is fine in a script." Model-written code is untrusted. Gate it and sandbox it.
"A confident answer means the generated knowledge was right." In the guide's golf example the weaker knowledge statement produced a confident answer.

Key takeaways#

  • A prompt has up to four elements (instruction, context, input data, output indicator); change temperature or top P, not both, and frequency or presence penalty, not both.
  • Few-shot examples teach task shape (labels, format, input distribution) as well as mappings; they cannot teach multi-step reasoning, which is why CoT exists.
  • Auto-CoT, Active-Prompt and APE automate parts of prompt creation: demonstrations, where to annotate, and the instruction. Each is only as good as the dev set and the checks around it.
  • ART, DSP and Multimodal CoT are research systems whose ideas survive in function calling, hint generation and vision-language models; do not confuse them with pasteable prompts.
  • Reflexion needs an objective evaluator. PAL needs a code gate.
  • Several names are re-used across fields (meta prompting, graph prompting). Check what is being trained.
  • On modern reasoning models most of these are subsumed. The needs behind them (decomposition, grounding, checking, exact computation) remain.

Terms introduced in this lesson#

Term One-line definition
Output indicator The part of a prompt (for example Sentiment:) that signals the type or start of the answer
Stop sequence A string that makes generation stop when produced
Frequency penalty A sampling penalty that grows with how often a token has already appeared
Presence penalty A sampling penalty applied once to any token that has already appeared
Auto-CoT Building few-shot CoT demonstrations automatically: cluster questions, then generate a chain for one representative per cluster with Zero-Shot CoT
Active-Prompt Choosing which questions to annotate as CoT examples by the model's uncertainty over k sampled answers (Diao et al.)
Disagreement (uncertainty metric) Number of distinct answers divided by number of samples
Automatic Prompt Engineer (APE) An LLM proposes candidate instructions and the best is selected by dev-set score (Zhou et al.)
Generated Knowledge prompting Generating relevant facts first, then answering with each as extra input (Liu et al.)
ART Automatic Reasoning and Tool-use: a frozen LLM with task and tool libraries that pauses at tool calls (Paranjape et al.)
Directional Stimulus Prompting (DSP) A small trained policy model writes a hint added to a black-box LLM's prompt (Li et al.)
Multimodal CoT A fine-tuned two-stage model that generates a rationale from text and image, then infers the answer (Zhang et al.)
GraphPrompt Learnable prompt tuning for graph neural networks; not LLM text prompting
Reflexion An agent that stores verbal self-reflections on failed trials in memory and retries (Shinn et al.)
Meta Prompting (structure-oriented) Prompting with the form of a solution rather than content examples
PAL Program-Aided Language models: the model writes code as its reasoning and an interpreter runs it
Prompt function A named, parameterised prompt invoked and composed like a function

Exercises#

  1. Settings pairs (1.2): for each of these tasks, name the setting you would change and the one you would leave alone: extracting invoice totals; brainstorming product names; a list that must stop at 10 items.
  2. Active-Prompt (3.1): add a sixth question to active_prompt.py whose ten answers split five and five between two values. Where does it rank, and why does entropy order it differently from disagreement?
  3. Auto-CoT (2.1): add three questions on a new topic (for example date arithmetic) to auto_cot.py. Does the clustering create a fourth cluster? What threshold change merges or splits clusters?
  4. APE (4.1): extend dev with two cases where the careless reading still gives the right answer. How does the score gap change, and what does that say about dev-set size?
  5. Reflexion (10.1): change the evaluator so it only returns False, "failed" with no detail. Does the stand-in actor still learn? What does this tell you about evaluator feedback quality?
  6. PAL gate (12.1): the gate allows ast.Attribute. Find a program the gate accepts that you would not want to run, and say what to add to the gate or why a sandbox is the real answer. Hint: think about attribute access on a module-like object.
  7. Prompt chaining (13.5): write the optional step as a third prompt that removes citation markers such as [27], then sketch how you would test that step alone.
  8. Factuality (15.3): write five invented and five real-but-obscure names and design a test that measures both hallucination and over-refusal.

Check yourself#

  1. Which four elements make up a prompt, and which are optional?
  2. Why do guides say to change temperature or top P but not both?
  3. What did the few-shot research find about random labels?
  4. What does Auto-CoT's clustering stage protect against?
  5. How does Active-Prompt decide which questions to annotate?
  6. In APE, what scores a candidate instruction, and what is the main risk?
  7. Why is generated knowledge a hallucination risk, and what replaces it when you can retrieve?
  8. Why are DSP and Multimodal CoT not "prompts"?
  9. What does ART do when generation reaches a tool call?
  10. What does a Reflexion loop need from its evaluator to work?
  11. What is the difference between structure-oriented meta prompting and "using an LLM to write prompts"?
  12. Why must PAL's code be gated or sandboxed?
  13. Why did the guide's self-consistency example need a wrong greedy answer to be convincing?
  14. What does the single-prompt Tree-of-Thought variant lack compared with the search version?
  15. Why does the GraphPrompt paper not belong with LLM prompting techniques?

Further resources#


← 04.10 — Prompt Templates, Versioning and a Prompt Library | Module 04 overview | 04.12 — Prompt Hub, Research Findings and Model Notes →

Esc
02.2Tokens and TokenizationHow LLMs Work · 21k wordsLesson
02.3EmbeddingsHow LLMs Work · 18k wordsLesson
07Retrieval-Augmented Generation (RAG)11 lessons · Everyone who will build LLM features that must answer from knowledge the model doesn't have in its weights: internal handbooks and help centres, contracts, ticket histories, product docs, or any corpus that changes faster than a training run. The module covers the full RAG stack — architecture, retrieval strategy, query understanding, grounded generation, citations, conversation, managed services, advanced patterns, evaluation, debugging and production operation — and shows where each major provider's managed retrieval and citation features fit (OpenAI, Anthropic, Google Gemini and OpenRouter). All code is Python.Overview
08E.1The Model Context Protocol (MCP)Protocols and Extensibility · 12k wordsLesson
↑ ↓ navigate↵ openesc close