Part VII · Harnesses
Ch 23. The model is not the product
What does the model actually see?
So far you’ve seen the model and the text it reads. But in a chat app, you only write a small part of that text. Apps wrap the model in ordinary code, the harnessharness: The ordinary code around a model that builds its prompt, calls it, and acts on its output. Ch 23, which decides what the model reads and what to do with what it writes.
Everything so far has been about the model and the text you give it. But in a chat app you only write a small part of that text. Chat apps and coding agents wrap the model in ordinary code, the harnessharness: The ordinary code around a model that builds its prompt, calls it, and acts on its output. Ch 23, which decides what text the model gets and what to do with what it writes.
To see it, we recorded a real conversation with a small chat model, Qwen2.5-1.5B-Instruct, inside a simple harness built for this site.[1][1][1] You typed one short line. Peel back the layers to see what the model actually read:
Your 31-character message became a 400-token prompt. The harness wrote most of it: instructions for the model, descriptions of its tools, the earlier messages, and markers around each turn.
Your 31-character message became a 400-token prompt. Most of it was written by the harness:
- a system promptsystem prompt: Instructions in a slot at the start of the chat template that apply to the whole conversation; in apps, usually hidden from the user. Ch 20 with the app’s instructions,
- descriptions of the tools the model may ask for,
- the earlier turns of the conversation, and
- the chat markers from Ch 15 around every turn.
The model doesn’t remember anything between calls. It seems to remember the conversation only because the harness sends all of it again every time.
The model has no memory between calls. It seems to remember the conversation only because the harness sends the whole thing again every time. Here it also asked to look up a rhyme first, so the harness called it a second time with the result added, and the prompt grew to 493 tokens.
Where the 400 tokens go
Counted with Qwen’s tokenizer, the three tool descriptions alone take 295 of the 400 tokens, about
three quarters. The app’s instructions take 53, the earlier exchange 22, and your message 8; the
chat markers and line breaks make up the rest. Each description is a small JSON schema, the tool’s
name, what it does, and its inputs, and Qwen’s chat template wraps them in <tools> tags with a
paragraph on how to call them. So every tool a harness offers costs tokens on every call, used or
not. The second call added 93 tokens: the model’s own tool call, written back as its turn, and the
search result, wrapped in <tool_response> tags in a new user turn.
The model is one part
The reply you see is the harness’s work too: it reads what the model wrote, runs any tools it asked for, and shows you only the answer. The same model can feel very different inside a different harness. The chapters ahead look at its jobs one by one.
The reply you see is also the harness’s work: it reads what the model wrote, spots tool calls, runs them, and shows you only the final answer. The same model can feel very different depending on the harness around it: its instructions, its tools, and the rules it enforces. This holds well beyond chat. In a 2015 paper on the hidden costs of machine learning systems, Google engineers drew the model’s code as a small black box in the middle of everything else a real system needs: collecting and checking data, configuration, serving, and monitoring.[2][2] The chapters ahead look at each job in turn.
Recipe card
Recap
- A chat app or agent is a model plus a harness: ordinary code around it.
- The harness builds the prompt: system prompt, tool descriptions, earlier turns, and chat markers.
- The model has no memory; the harness re-sends the conversation on every call.
- Three tool descriptions were three quarters of this prompt: every tool costs tokens on every call.
Next question: the harness re-sends the whole conversation on every call. What happens when it gets too long to fit?
Sources
- Qwen Team et al. (2024). Qwen2.5 Technical Report. arXiv.
Sources
- Qwen Team et al. (2024). Qwen2.5 Technical Report. arXiv.
- D. Sculley et al. (2015). Hidden Technical Debt in Machine Learning Systems. Advances in Neural Information Processing Systems 28 (NIPS 2015).
Sources
- Qwen Team et al. (2024). Qwen2.5 Technical Report. arXiv.
- D. Sculley et al. (2015). Hidden Technical Debt in Machine Learning Systems. Advances in Neural Information Processing Systems 28 (NIPS 2015).