guruswami.ai
Understand AI · Lesson 4 of 8 · 5 min

What a model can hold in mind

A model sees only what is in its context. Longer is slower, and it is not always better.

In the learning lessons you met working memory, the small bench that holds what you are thinking about. A language model has something similar. It is called the context.

The context is all it sees

The context is everything in front of the model when it writes: its instructions, the conversation so far and your latest message. It is measured in tokens.

Every model has a limit, called the context window. Past the limit, the oldest text is dropped or the request is refused.

This explains something that surprises people. The model does not remember you. Each reply is produced from the context alone. If an earlier conversation is not in the context, then for the model it never happened. When a product seems to remember you, it is because something outside the model stored notes and put them back into the context.

Longer costs more

As the model reads, it keeps working notes on every token so that it does not have to read them again. These notes take memory, and the amount grows with every token of context. For a long document, the notes can take more memory than the model itself.

Speed suffers too. The model compares tokens with each other, so the reading phase slows down sharply as the prompt grows. In our testing on the Chakra cluster with a very large model, a short prompt started answering in about a third of a second and wrote about 15 tokens a second. With a prompt 32 times longer, the wait was nearly seven seconds and the writing speed fell to about 3 tokens a second.

More is not always better

Models do not attend to everything equally. They are most reliable with what is at the start and at the end of the context. Material in the middle of a very long context can be missed. Researchers call this “lost in the middle”.

You have seen this in yourself. A full bench does not make better work.

Give the model what it needs for this task, and no more.

How to use this

  • Start a new conversation for a new task. Old material is clutter.
  • Paste the relevant section and not the whole document.
  • Put your key instruction at the start or at the end.
  • If a long chat begins to drift, ask for a summary and continue from that in a fresh one.
Check yourself

Close the page in your mind, then answer

Do not scroll up. Pulling the answer out of your own head is the step that makes it stay.