Applied GenAI Curriculum for AI PMs  ·  Core Sequence

Unit 08 — Prompting as an Engineering Discipline

In-context learning, system vs. user prompts, context-length economics, and the best-practices set — plus how to tell a team doing disciplined prompt iteration from one running on vibes.

Tags
prototyping
Layer
CORE — read in sequence
Objective
Tell disciplined prompt iteration from vibes — and know when "just fix the prompt" is right and when it's a smell.
Connects
The first improvement lever aimed at the targets defined in Unit 07. Its security counterpart is Unit 22 (defensive prompting).

Why prompting is engineering, not typing

Unit 07 set the target — the criteria you're optimizing toward. This unit is the first and cheapest lever to hit it. The trap is treating prompting as casual wordsmithing. Done well, it's a disciplined loop: change one thing, measure against your evals, version it, keep or revert. Your job as a PM isn't to write the prompt — it's to recognize whether the team is iterating like engineers or guessing like it's a chat window.

1. What a prompt actually is

A prompt is an instruction to a model to perform a task. It generally has up to three parts:

Task descriptionWhat you want done — including the role the model should play and the output format.
Example(s)Demonstrations of how to do it — e.g. samples of toxic vs. non-toxic text.
The taskThe concrete instance — the question to answer, the document to summarize.

Prompting only works if the model can follow instructions in the first place (Unit 07's instruction-following criterion). How much prompt-fiddling you need depends on the model's robustness to perturbation — whether writing "5" instead of "five," adding a newline, or changing capitalization swings the output. Both instruction-following and robustness track overall model strength, which yields a practical shortcut: a stronger model often saves you days of prompt-tweaking.

2. In-context learning: teaching without training

The foundational idea: a model can learn a desired behavior from examples in the prompt alone, no weight updates — this is in-context learning. Each example is a "shot":

Zero-shotNo examples — just the instruction.
Few-shotSeveral examples in the prompt (five examples = 5-shot). Generally, more examples help — bounded by context length and cost.

This is also a form of continual learning: to teach a model about a new library version, you don't retrain — you put the new info in its context, letting it answer beyond its training cutoff. One nuance worth carrying: as models get stronger, few-shot adds less over zero-shot for general tasks — but examples still matter a lot for domain-specific content the model rarely saw in training.

3. System prompt vs. user prompt

Most APIs split the prompt in two: the system prompt (think: the task description / role, set by you the developer) and the user prompt (the task, from the end user). A real-estate assistant might carry "You're an experienced real estate agent…" in the system prompt, and the uploaded disclosure + "How old is the roof?" in the user prompt.

Two things a PM should know here (1) System prompts can genuinely boost performance — partly because they come first (models attend better to early instructions) and partly because models are often post-trained to prioritize them (which also helps resist prompt attacks — Unit 22). (2) Chat templates are a silent-failure trap — the model combines system + user prompts using an exact template defined by the model's makers. An extra newline or the wrong template can quietly degrade behavior while still looking "reasonable." If quality mysteriously drops, "print the final prompt and check the template" is a legitimate debugging step.

4. Context-length economics

How much you can put in a prompt is capped by the model's context length. Windows have exploded (from ~1K tokens to millions), but two economic facts matter more than the ceiling:

Every token costsAPIs charge per input and output token, and longer outputs add latency (tokens are generated one at a time). "Be concise" is a cost-and-speed lever, not just style.
The middle gets lostModels attend best to the beginning and end of a prompt, worst to the middle. The "needle in a haystack" test measures this by hiding a fact at various positions and checking recall. Put critical instructions at the edges.

The takeaway: a bigger context window is not free capacity. If quality degrades as prompts grow, the fix is often to shorten, not stuff.

5. The best-practices set

These techniques work across a wide range of models and outlast the throwaway tricks ("offer the model a $300 tip"). This is the checklist to hold a team's prompt work against.

1

Write clear, explicit instructions

Remove ambiguity: state the exact scoring scale, whether "I don't know" is allowed, integer vs. fractional. Assign a persona to set perspective ("act as a first-grade teacher"). Give examples to pin down the response you want. Specify the output format precisely (JSON keys, no preambles) and use end markers for structured outputs so the model doesn't just continue your input.

2

Provide sufficient context

Like giving a student a reference text — supplying context improves answers and curbs hallucination (without it, the model falls back on unreliable internal knowledge). Either hand it the context or give it tools to fetch it (context construction — RAG, web search, Units 05/17). Restricting a model to only its context (for roleplay/grounding) is genuinely hard; prompting helps but doesn't guarantee it.

3

Break complex tasks into simpler subtasks

Decompose into chained prompts (e.g. classify intent → respond to that intent). Models handle simple instructions better, and decomposition adds real benefits: you can monitor and debug each step, parallelize independent ones, and write simpler prompts. Costs can even drop (smaller prompts, cheaper models for easy steps). The trade: more steps can raise perceived latency. One team's support prompt bloated past 1,500 tokens; decomposing it improved quality and cut cost.

4

Give the model time to think

Chain-of-thought (CoT) — "think step by step" or supplying the steps — nudges systematic reasoning and reliably improves results (and reduces hallucination). Self-critique asks the model to check its own output. Both cost latency, since the model works through intermediate steps before the user sees a token.

5

Iterate — and version — like code

Prompting is back-and-forth; each model has quirks (numbers, roleplay, instruction placement). But iteration must be systematic: version your prompts, use an experiment-tracking tool, standardize eval metrics and data so you can compare, and evaluate each prompt against the whole system — a change can help a subtask yet hurt the end-to-end result.

The distinction that is the whole point

Disciplined iteration vs. vibes Disciplined: one change at a time, versioned, measured against a fixed eval set, judged on whole-system impact. Vibes: ad-hoc edits in a playground, "looks better to me," no tracking, no rollback. When a team can't tell you whether their last prompt change helped on the eval set, they're doing vibes — and this connects straight back to Unit 06.
When "just fix the prompt" is right — and when it's a smell Right: the failure is genuinely instructional — ambiguous ask, missing format spec, no examples, needs decomposition or CoT. Cheap to try, so try it first. A smell: the prompt has already ballooned patching endless edge cases, the same fix keeps breaking elsewhere (whack-a-mole), or the real gap is missing facts (needs RAG) or wrong behavior/format (needs finetuning) — Unit 05's fork. "Add another line to the prompt" as a reflex is how prompts rot.

What "good" looks like after this unit

You can now: