Chapter 14 · Layer 3 · Context and Memory
Thirteen Seconds to Half a Second
On 2 August 2024, DeepSeek announced a change to its developer service under a blunt headline: context caching on disk, "cutting prices by an order of magnitude".
Sanket Kulkarni · · 6 min read
Part of The Seven-Layer Tokenomics Stack
The same question, a tenth of the price
On 2 August 2024, DeepSeek announced a change to its developer service under a blunt headline: context caching on disk, "cutting prices by an order of magnitude".
The idea was simple. If a request starts with text the system has already read recently, it does not read it again from scratch. It reuses its earlier work. DeepSeek priced that reused text at $0.014 per million tokens, against $0.14 for fresh text: one tenth.
DeepSeek API, August 2024 announcement
Ten times cheaper when the text was read before
Fresh text per million tokens
$0.14
Reused text per million tokens
$0.014
13s → 0.5s
first-token wait on a ~128,000-token heavily reused prompt
>50%
average bill saving reported ("save over 50% on average")
Source: DeepSeek context caching news, 2 August 2024. Prices since updated; principle unchanged.
(A token is a small chunk of text, roughly a short word or part of a longer one.) For a very long prompt (the text sent to the model) of about 128,000 tokens that is reused heavily, the company said the wait for the first word of the answer fell from 13 seconds to half a second. It added that users "save over 50% on average" even without changing anything. Those 2024 prices have since been updated, as the page itself notes. The principle has not.
Two years on, the idea is standard practice. Anthropic charges one tenth of the normal input price for reused text on most of its models as of today. OpenAI's documentation says reused text is "discounted up to 95%". This is today's component, and the first time in this series that we stop talking about what a token costs and start talking about how many we need.
The railway enquiry window
Picture the enquiry counter at a big railway station. The same questions arrive all day. Is the Rajdhani on time? Which platform for Pune? A good clerk does four things.
- Reusing answers to similar questions. The clerk notices that "When does the Mumbai train leave?" and "Mumbai train departure time?" are the same question, and gives the answer already prepared. Engineers call this a semantic cache: a store of past answers, looked up by meaning rather than exact wording.
- Reusing work on repeated text. Every request to an AI system carries a long opening: standing instructions, a manual, a policy document. The model builds working notes on every word it reads (the industry calls these the key-value cache). If the next request opens with the same text, word for word, those notes can be reused instead of rebuilt. That is what DeepSeek was pricing. Think of the clerk who has memorised the rule book instead of reading it before each passenger.
- Searchable knowledge stores. The clerk does not memorise every timetable. He keeps an indexed book and looks up only the page he needs. In AI this is a vector database: documents stored so they can be found by meaning, and only the relevant passages are handed to the model. A 2020 research paper by Patrick Lewis and colleagues named this approach retrieval-augmented generation: the model's built-in knowledge plus, in the paper's words, "a dense vector index of Wikipedia" it could search.
- Conversation memory. The clerk remembers what you asked a minute ago. Here is the catch. An AI model, by default, remembers nothing between requests. Anthropic's documentation describes how it works: each new turn "contains all previous conversation history plus the current user message". Imagine a clerk who can only answer if you repeat everything you have said since you reached the window.
In the restaurant from Chapter 0, this is the base gravy made once and served a hundred ways. Yesterday the kitchen manager built the store room. Today the cooks decide what they make fresh and what they take off the shelf.
The first volume lever
The bill is price multiplied by volume. Layers 0 to 2 set the price. The Seven-Layer Tokenomics Stack calls Layer 3 "the first layer where consumption is suppressed rather than merely priced", and "usually the single largest source of optimization". It names one number above all: "Cache hit rate is the number that matters most, and it is won largely through prompt and prefix stability." In plain words: how often the system finds work it can reuse, and that depends on keeping the opening of every request identical.
Three things decide whether this lever pays.
Order matters more than it looks. Reuse of working notes needs an exact match from the first word. Anthropic's documentation says hits "require 100 percent identical prompt segments". OpenAI's advice is to "Put stable developer instructions and shared reference material first" and anything that changes at the end. Put today's date or the customer's name at the top of a ten-page instruction and you have broken the reuse for every request.
Conversation memory grows faster than the conversation. Take an illustration, my own arithmetic: a chat of 20 turns where each turn adds 500 tokens. Only 10,000 tokens of new text are ever written. But because each turn rereads everything before it, the model reads 105,000 tokens of input in total, more than ten times the text that was written. That is where reuse earns its keep, and where trimming old history matters.
Reuse has a shelf life and an entry fee. Anthropic's default cache lasts five minutes, refreshed each time it is used; writing to it costs 1.25 times the normal input price, or twice the price for a one-hour cache. Reuse that never comes is a cost, not a saving. Reusing answers by meaning carries a different risk: a wrong match gives a confident wrong answer. One 2024 study of this approach reported that it cut calls to the model by up to 68.8%, with over 97% of matches correct. Useful, and also a reminder that a few in a hundred were not.
On the engine side, the open-source serving software SGLang reported in a 2023 paper that organising these working notes for reuse, among other optimisations, delivered up to 6.4 times the throughput of other leading serving systems: more work from the same chips. Reuse lowers volume and frees capacity at the same time.
What I would do on Monday morning
- Put the reuse rate (cache hit rate) on the weekly dashboard, next to spend. Providers report how many input tokens were reused; DeepSeek, for example, splits every bill into cache hits and misses. If nobody in the business knows that number, you are paying full price for repeated work.
- Audit the order of every high-volume prompt. Fixed instructions and reference documents first, anything that changes last. It is a small engineering task with a lasting effect on the bill.
- Set rules for conversation memory and answer reuse. Decide when old turns get summarised or dropped. For reusing past answers, start only with low-risk questions (opening hours, policy lookups) and check a sample of matches by hand every week before widening it.
Tomorrow
Chapter 15 stays on the cooking line with Tools and Actions: connectors to outside tools, running software functions, web search and databases. Today the cooks used what was already on the shelf. Tomorrow they start calling suppliers, and every call has a price.
This series builds on The Seven-Layer Tokenomics Stack by the Tokenomics Foundation, used under a Creative Commons Attribution 4.0 licence. The commentary, and any mistakes, are mine. Views are my own and do not represent my employer.
Sources
Every figure was checked against its source on 17 November 2026.
- Tokenomics Foundation, The Seven-Layer Tokenomics Stack (full paper), 14 October 2026, Creative Commons Attribution 4.0 licence. Context and Memory items (semantic cache, key-value cache, vector database, session memory); Layer 3 as the first layer where consumption is suppressed rather than priced; "Cache hit rate is the number that matters most, and it is won largely through prompt and prefix stability."
- Tokenomics Foundation, The Seven-Layer Tokenomics Stack (overview page), as of 17 November 2026. "Usually the single largest source of optimization"; "the first layer where consumption is suppressed rather than merely priced".
- DeepSeek, DeepSeek API introduces Context Caching on Disk, cutting prices by an order of magnitude, 2 August 2024. Cache hits at $0.014 per million tokens against $0.14 for misses; first-token wait for a 128,000-token prompt cut from 13 seconds to 500 milliseconds; "save over 50% on average"; note that prices have since been updated; bills split into cache hit and miss tokens.
- Anthropic, Prompt caching documentation, as of 17 November 2026. Reused text at 0.1 times the base input price on most models (lower on some newer ones); cache writes at 1.25 times (five-minute cache) or 2 times (one-hour cache); five-minute default lifetime, refreshed on use; hits "require 100 percent identical prompt segments".
- Anthropic, Context windows documentation, as of 17 November 2026. Each turn's input "contains all previous conversation history plus the current user message".
- OpenAI, Prompt caching guide, as of 17 November 2026. Reused input "discounted up to 95%"; on by default for supported models; "Put stable developer instructions and shared reference material first."
- Sajal Regmi and Chetan Phakami Pun, GPT Semantic Cache: Reducing LLM Costs and Latency via Semantic Embedding Caching, arXiv, 8 November 2024. Calls to the model reduced by up to 68.8%; positive hit rates above 97%.
- Lianmin Zheng and others, SGLang: Efficient Execution of Structured Language Model Programs, arXiv, 12 December 2023 (revised 6 June 2024). A technique called RadixAttention for reusing working notes; up to 6.4 times higher throughput than other leading serving systems.
- Patrick Lewis and others, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, arXiv, 22 May 2020. Built-in model memory combined with "a dense vector index of Wikipedia".
The 20-turn conversation (10,000 tokens written, 105,000 read) is the author's illustration: 500 tokens multiplied by (1 + 2 + ... + 20) = 105,000, assuming the full history is resent each turn with no trimming.