Prompt Engineering

Beginner · Roadmap · 29 lessons · 7 groups

Master the art and science of crafting effective prompts for large language models. From basics to advanced techniques, learn how to communicate with LLMs to get reliable, structured outputs at scale.

0%

Not started

Nothing saved yet. Progress is kept in this browser until you sign in.

Start the path

What is prompt engineering?

4 lessons

  1. 01 / 04What is prompt engineering?Why the words you choose change what a language model produces, and what separates a disciplined prompt from a lucky guess.9 min
  2. 02 / 04How LLMs workNext-token prediction, the mechanism behind every capability and every failure mode a large language model has.8 min
  3. 03 / 04Tokens and contextHow text becomes numbers a model can process, and why the context window is a hard budget on everything it can see at once.7 min
  4. 04 / 04Hallucinations and limitationsWhy models state falsehoods with total confidence, plus the other hard limits — knowledge cutoffs, no persistent memory, bounded reasoning.10 min

Understanding models and their parameters

4 lessons

  1. 01 / 04Choosing a modelCapability, context window, latency, and cost are the four questions that decide which model a prompt should target.7 min
  2. 02 / 04Sampling parametersAn LLM never deterministically picks the next word — sampling parameters control how it rolls the dice over a probability distribution.15 min
  3. 03 / 04Temperature and randomnessTemperature reshapes a model's output distribution before sampling — the single knob that moves output from deterministic to wildly varied.5 min
  4. 04 / 04Top-k and top-pTwo ways to truncate a model's output distribution before sampling — a fixed-size shortlist against one that adapts to the model's confidence.2 min

The fundamental prompting strategies

4 lessons

  1. 01 / 04Zero-shot promptingAsking a model to do a task from a plain instruction alone, with no worked examples, and knowing when that is not enough.2 min
  2. 02 / 04Few-shot promptingShowing a model worked examples of a task instead of just describing it, and knowing how many examples actually help.13 min
  3. 03 / 04Chain-of-thought promptingAsking a model to reason step by step before answering, and why that measurably improves accuracy on multi-step problems.5 min
  4. 04 / 04Prompt anatomyThe structural parts a well-built prompt is made of, and how labeling them clearly keeps a long prompt from confusing the model.25 min

Sophisticated prompting methods

5 lessons

  1. 01 / 05Step-back promptingAnswer a general question first and a specific one second — abstraction before application reduces reasoning errors.11 min
  2. 02 / 05Self-consistency promptingSample several independent reasoning paths and take the answer most of them agree on, instead of trusting just one.8 min
  3. 03 / 05Tree of thoughtsBranch into multiple partial solutions, score them, and search the tree — for problems one straight-line reasoning chain can't solve.8 min
  4. 04 / 05ReAct promptingInterleave reasoning with real actions and their observations in a loop — the pattern behind most tool-using agents.6 min
  5. 05 / 05System and role promptingA standing instruction channel for the whole conversation, and a persona that reshapes tone and angle — two distinct, bounded tools.8 min

Structuring and controlling outputs

4 lessons

  1. 01 / 04Structured output formatsSchema-constrained decoding, JSON mode, and the prompt-parse-retry fallback — three ways to get data back instead of prose.13 min
  2. 02 / 04Output length controlWhy asking for "a short answer" and setting max_tokens are not the same control, and what happens when a response hits the limit mid-thought.14 min
  3. 03 / 04Stop sequencesA string that halts generation the instant it appears — for closing structured output cleanly, stopping role drift, and cutting cost.1 min
  4. 04 / 04Prompt ensemblingRunning several prompts or phrasings for the same task and aggregating their answers, so errors that don't correlate across them wash out.9 min

Making prompts robust and safe

4 lessons

  1. 01 / 04Prompt injection attacksWhy a model can't tell its own instructions from data it's reading, and what that confusion lets an attacker do.12 min
  2. 02 / 04Defending against injectionWhy there is no complete fix for prompt injection, and the layered defenses that reduce the risk instead of pretending to remove it.17 min
  3. 03 / 04Prompt debiasingWhy asking a model nicely to "be unbiased" mostly doesn't work, and the prompting techniques that measurably do better.11 min
  4. 04 / 04Evaluation and testingHow to know a prompt actually works, and the three eval methods that trade speed and cost against the kinds of mistakes each one catches.27 min

Automating and tuning prompts

4 lessons

  1. 01 / 04Prompt tuningA parameter-efficient training technique that learns a soft prompt instead of writing one — not a synonym for prompt engineering.9 min
  2. 02 / 04Automatic prompt engineeringLetting an LLM generate and score candidate prompts against your eval set, and DSPy's compiler-driven version of the same idea.26 min
  3. 03 / 04Fine-tuning vs. promptingWhen prompting hits its ceiling, what fine-tuning actually buys you, and a decision rule for choosing between them.13 min
  4. 04 / 04Production patternsVersioning prompts like code, guardrails before a response ships, monitoring for drift, and feeding user feedback back into the eval set.17 min
Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark