MLGuerrillaStart M1 →
Free · in beta·intermediate·M5·32 min read·Prereq: The Model as a Component (M4). Datasets & Evaluation (M1) and Observability & Traceability (M2) help for measuring prompt changes and what compaction loses.

Prompt & Context Engineering

The capability

What are prompt and context engineering?

As you already know from M3, the model only sees what your code sends it on each call. So everything it knows about the task, and about the conversation so far, has to be in that one request. Prompt and context engineering is all about deciding what goes into that request. The prompt part is the instructions you write once, like the system prompt and the examples that show the model what a good answer looks like. The context part is everything your code adds on each call, like the conversation history and the results of any tools the model used.

Now you might be asking why that takes a whole module. Well, it's because the request has a hard size limit, which we call the context window, and every token in it costs money and slows things down. So you can't send everything, and the model can't use anything you left out. On top of that, models get worse at reading a request the longer it gets, so adding more text can make the answers worse.

None of this changes the model itself, though. The weights stay the same, so a prompt can only get the model to do things it could already do. And you can't make a rule unbreakable either, because an instruction in the prompt is just text the model reads. It'll usually follow it, but there's no guarantee.

Where it shows up

Every model call has a prompt and a context, so every AI feature runs into this sooner or later. A document summarizer has to figure out how much of a 200-page file it can fit in one call. A coding assistant has to pick which files from your repository to send along with your question. And a chatbot has to decide what happens to a conversation once it's grown past the window.

Keep reading

The rest of this lesson is free with an account

Create a free account to read the remaining 18 sections. It takes about twenty seconds and there's nothing to pay. The same account opens the slide decks and CV reviews.

  1. 02The support agent gets refunds wrong on turn one and forgets the order by turn forty
  2. 03Every call carries more than the conversation
  3. 04Write the system prompt as a task specification
  4. 05Say which rule wins when two of them collide
  5. 06Pick examples that sit on either side of the line
  6. and 13 more

That's the last one written so far

Pick your next module from the board.

All modules →