You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

Almost done. Check your inbox and press the button in our email to confirm. Close

We could not check that you are a person. Please try again. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode Why a vague prompt gets a plain answer from an AI chatbot

Prompt engineering: why the same question gets a better answer when you ask it well

Context in an AI prompt: why a few details change the whole answer

Add one line of details to a question for an AI chatbot, and the answer can change from top to bottom, even words you never asked for. Nothing inside the model changed. So what did?

  1. 1 This time, you write down what is in your head: the day, the time, the place, the price. You add that the choir has 20 singers, and that this is its first concert.

    This time, you write down what is in your head: the day, the time, the place, the price. You add that the choir has 20 singers, and that this is its first concert.

  2. 2 The new answer has your day, your place and your price. It even sounds like a small choir of neighbours, not a famous one.

    The new answer has your day, your place and your price. It even sounds like a small choir of neighbours, not a famous one.

  3. 3 Each detail rules out the texts that do not fit it. "Free entry" rules out the big concert halls. "Library hall" rules out the stadiums. The crowd of texts that look like your prompt gets smaller and closer to you.

    Each detail rules out the texts that do not fit it. "Free entry" rules out the big concert halls. "Library hall" rules out the stadiums. The crowd of texts that look like your prompt gets smaller and closer to you.

  4. 4 Some words came that you never asked for. "Our first concert" made words like "very first" and "cheer on" likely, because messages about a first concert often say them. A detail also brings other words with it.

    Some words came that you never asked for. "Our first concert" made words like "very first" and "cheer on" likely, because messages about a first concert often say them. A detail also brings other words with it.

  5. 5 Between the two answers, nothing in the model changed. It is the same model, with the same training. Only the text it got was different. The text around your request is called the context.

    Between the two answers, nothing in the model changed. It is the same model, with the same training. Only the text it got was different. The text around your request is called the context.

  6. 6 Then Miva, who writes the choir's posts, shows you a stranger trick. She pastes two of her old posts, and writes no request at all. The model writes a third post in her exact style, with her kind of joke. Nobody described that style to it. So how can two posts teach it?

    Then Miva, who writes the choir's posts, shows you a stranger trick. She pastes two of her old posts, and writes no request at all. The model writes a third post in her exact style, with her kind of joke. Nobody described that style to it. So how can two posts teach it?

  7. Quick check

    A birthday message.

    A birthday message.

    Show the answer

    Each detail rules out the birthday messages that do not fit it. So the likely words now come from messages for an older person who loves gardening, not from messages for anyone.

Next episode Few-shot prompting: how two examples teach an AI chatbot a new style

Share this comic

More comics