0:00Intro: MOFUSA Tech Academy
Welcome to MOFUSA Tech Academy. Beyond learning, towards mastery.
0:09Same model, two prompts
Same model. Same customer question: "My kettle arrived dented, what can I do?" Two different prompts. With a one-line instruction, "answer the customer", the reply is vague and invents a policy. With a carefully structured prompt, the same model gives a concise, empathetic answer, grounded in Brightcart's actual policy, with a clear next step. The prompt is the cheapest, fastest lever an AI engineer has: no training, no new infrastructure, just words, and changes can be tested in minutes with the evaluation pipeline we've just built.
Today: what a prompt really is, why models can learn from examples inside it, and how much you can fit. Season Four, Module Seventeen: prompt engineering. First stop: prompts, and in-context learning.
1:08The anatomy of a prompt
A prompt is everything we give the model to work with. A good one has recognisable parts. A role and goal: you are Brightcart's support assistant, here to resolve order issues. Context: the relevant policy text and the customer's order record. Rules: only state policies that appear in the context, offer a human if unsure, keep it under eighty words, ask for a photo when damage is reported. Examples of ideal replies. The output format: friendly text for the customer, and JSON for the order system. And finally, the customer's actual message.
Remember: the model knows nothing about Brightcart except what's in its training data and what's in this prompt. For this task, the prompt is its job description, its rulebook and its reference manual.
2:00System prompts and chat templates
Chat models separate messages by role. The system message holds the developer's instructions: Brightcart's role, rules and format. User messages come from the customer. Assistant messages are the model's replies. Under the hood, a chat template turns these roles into special tokens, and post-training teaches the model to follow system instructions and to treat the user's text as the request. One warning we'll return to: a system prompt shapes behaviour, but on its own it isn't a security wall. Determined users may try to override it, and episode sixty-three is all about defending against that.
2:41In-context learning, explained
Why do prompts work at all? The model's weights don't change while it reads your prompt. Yet show it three examples of a pattern, and it continues the pattern for a fourth. This is called in-context learning. It comes straight from pre-training. The text models learn from is full of patterns: question-and-answer pages, lists, forms, worked examples. To predict the next token well, a model must pick up whatever pattern the current document is following. So when your prompt sets up a pattern, the model follows it. The famous paper introducing GPT-3, in two thousand twenty, described large language models as "few-shot learners" for exactly this reason.
3:27Zero-shot vs few-shot
Prompts with no examples are called zero-shot; prompts with a few examples are few-shot. For common tasks, today's instruction-tuned models often do well zero-shot. Examples help most when the format is unusual, the categories are subtle, or the tone has to be just right. But examples cost tokens. Five examples of about a hundred and twenty tokens each add six hundred tokens to every request. At fifty thousand requests a month, that's thirty million extra input tokens: real money, and a little extra latency too. So add examples when your evaluation shows they help, not by habit.
4:14Choosing good examples
Examples should be chosen carefully. Make them diverse, covering the main kinds of request and the tricky edge cases, like a damaged item that also arrived late, or a question no policy covers. Models copy examples closely: their length, their phrases, even their mistakes, so every example must be one you'd be happy to see repeated. Balance them: four refund examples and one delivery example will nudge the model towards "refund". Order matters a little too. A powerful upgrade is to choose examples dynamically: keep a library of good past replies, and for each new request, insert the few that are most similar.
That's a first taste of retrieval, coming in Season Five.
5:02Context length: what fits, and where
Every prompt has to fit in the model's context window, and Brightcart's typical request uses about three thousand four hundred tokens, plus any examples. Longer prompts aren't free: they cost more, and they slow responses, as we saw with attention and the K-V cache. Position matters too. Models tend to use information at the beginning and end of a long prompt more reliably than information buried in the middle. So put the key instructions at the start, repeat the most critical rules near the end, and place the customer's question last.
Test it with your own content: hide a specific fact deep in a long prompt and check the model finds it. And in long conversations, summarise or trim older messages to stay within budget.
5:53Prompt sensitivity, versioning and caching
Prompts can be surprisingly sensitive: a small change in wording or formatting can shift results, and the same prompt can behave differently on a different model. So treat prompts like code. Keep them in version control, record why each change was made, and run the evaluation pipeline on every change. One practical tip with big savings: many systems can cache a long prompt prefix that stays the same across requests, like the system instructions and standard policies, making repeated requests cheaper and faster. To benefit, put the stable parts first and the changing parts last.
We'll dig into caching in Season Five.
6:36Try it yourself: three examples or five?
Five examples cost about thirty million extra tokens a month, around thirty dollars at our illustrative price. Three examples cost eighteen. Is it worth keeping all five? Pause. The money alone can't answer that; the evaluation set can. Run the golden set with zero, one, three and five examples, and compare the scores. If three examples score just as well as five, drop two. If examples fix a format problem that zero examples can't, keep them. Every example should earn its tokens.
7:19The last example's shadow
A classification prompt has five examples: four labelled "delivery", and the last one labelled "refund". How might that affect the model on ambiguous tickets? Pause. Research has found that models can lean towards the label that appears most often in the examples, and towards the label of the most recent example. So this prompt might over-predict "delivery", or "refund", for borderline cases. The fixes: balance the labels, vary their order, and test whether shuffling the examples changes the results.
7:57A system prompt, section by section
Here's the structure of Brightcart's system prompt. A role: you're Brightcart's support assistant. A goal: resolve the issue accurately and kindly. Sources: only the order data and policy text provided. Rules: never promise dates that aren't in the data, and hand disputes over fifty dollars to a person. Tone and format: warm, concise, under eighty words. And what to do when unsure: say so, and offer a hand-over. Think of a system prompt as a clear job description for a new colleague.
8:32In-context learning vs habits
Here's how powerful in-context learning can be. In research experiments, models were given examples with deliberately flipped labels, where "I love it" was marked negative. Larger models tended to follow the flipped pattern from the examples, while smaller ones stuck with what they already knew. For Brightcart, that's useful: an unusual internal labelling scheme can be taught through examples alone. But keep examples consistent with the instructions; when they conflict, behaviour becomes unpredictable.
9:06Where to put the question
When prompts get long, layout matters. A common pattern: put the instructions first, the long reference material in the middle, clearly marked with tags, and the customer's actual question at the very end, sometimes with a one-line reminder of the most important rule just before it. Remember "lost in the middle" from episode forty-four: information buried in the middle of a long context is the most likely to be overlooked. Test your layout on the golden set, because the best arrangement can differ between models.
9:41Measuring prompt sensitivity
How sensitive is your prompt to wording? Write five paraphrases of the key instruction, such as "be concise", "keep it short" and "reply briefly", and run each over the golden set. If the scores barely move, your prompt is robust. If they swing widely, it's fragile, and a tiny edit by a colleague could break it. Report the range, not just the best score, and keep refining until the spread shrinks.
10:11Why chat templates matter
If you run an open-weight model yourself, the chat template matters. Each model was fine-tuned with special tokens marking the system, user and assistant turns. Format the conversation differently, say as plain text or with another model's tokens, and it may ignore your system prompt or simply continue the customer's message. Always use the template supplied with the model, and re-test whenever you switch models. API providers handle this for you behind the scenes.
10:42Zero-shot or few-shot?
Zero-shot or few-shot? Summarising a ticket in one sentence. Producing a ticket summary in a strict, unusual JSON layout. Writing replies in Brightcart's distinctive voice. Pause. The one-sentence summary: zero-shot; a clear instruction is enough. The unusual JSON layout: a couple of examples show the exact format better than any description. Brightcart's voice: examples help a lot, and if the voice must stay perfectly consistent across thousands of replies, fine-tuning may be worth it, which we'll explore in Season Five.
11:27The wrong order: messy context
The customer asks, "Where's my lamp?", and the assistant replies with the kettle's tracking status. The prompt contained both of the customer's orders, pasted one after the other as plain text. What went wrong? Pause. The context was ambiguous. Nothing clearly separated the two orders, or tied each tracking line to its item, so the model mixed them up. The fix is to structure the data: put each order in its own clearly labelled block, with its ID, items and status, and ask the model to name the order it's talking about.
Many "model mistakes" are really messy context.
12:15Put the stable parts first
One more layout tip, with a cost benefit. Split the prompt into a stable part, the system prompt, rules and examples, which is identical for every request, and a changing part, the order data, history and new message. Put the stable part first. Many providers can then reuse the work already done on that prefix, a feature called prompt caching, which saves money and speeds up the first token. Something as small as a timestamp at the top of the prompt can break that reuse.
12:51Myth vs Fact
Myth: examples in a prompt teach the model permanently. Fact: in-context learning lasts only as long as that prompt. The model's weights never change, so the next request starts fresh. Permanent changes require fine-tuning, which we'll cover in Season Five.
13:09Recap
Let's recap. A prompt combines a role, context, rules, examples, an output format and the user's input. Chat models separate system and user messages through templates. In-context learning lets models follow patterns in the prompt without changing their weights. Few-shot examples help with unusual tasks, but every example costs tokens on every request. Keep prompts within budget, put critical information at the start and end, and version, test and cache them. One sentence to remember: the prompt is the model's whole job description, so write it like one.
13:49Next: prompting best practices
Mission complete. Brightcart's assistant has its first proper prompt, with a role, policy context, rules, a format and a couple of carefully chosen examples, and it passes the evaluation gates. Next, we go from acceptable to excellent: the best practices professionals use, from writing clear instructions and breaking down complex tasks, to giving the model room to think, and iterating systematically. See you on the map.