Why this matters: every design so far has shared a hidden assumption — that serving a request is cheap, and the hard part is having the right data in the right place. That assumption is false here, and almost everything follows from its failure.
What the system is
ChatGPT is an advanced conversational application built on a sophisticated AI language model developed by OpenAI. It understands natural language and generates human-like text to assist with various communication tasks.
The source lists what it helps users do: simplifying technical subjects, proposing innovative ideas, and composing clear, well-structured text.
The behaviour worth noticing is in the follow-up. A conversation looks like this:
User: Who wrote Harry Potter?
Model: J.K. Rowling
User: What other books has she written?
Model: She also wrote The Casual Vacancy and the Cormoran Strike series.
ChatGPT-like systems are notable for interpreting incomplete or ambiguous inputs to provide relevant, context-aware responses. Instead of relying on predefined answers, these systems use generative AI and large language models to analyze intent and patterns.
What we are actually designing
In this chapter, we will design a text-to-text generation system. While OpenAI's specific architecture is proprietary, we will apply general principles and best practices for building similar systems.
The three assumptions this chapter breaks
Every previous design in this course rested on assumptions that no longer hold.
Assumption
Everywhere else
Here
Serving a request is cheap
A web server handles ~64,000 RPS. Compute is nearly free; the cost is I/O
A single response can occupy a GPU worth tens of thousands of dollars for seconds
A request is one unit of work
Request arrives, work happens, response returns. Latency is a single number
A response is generated one token at a time, each token a separate forward pass
Correct output is well-defined
The route is shortest or it is not. The video plays or it does not
Output is plausible-sounding text that may be confidently wrong, and no component can tell
The organizing question
Here is the thread to follow through the chapter:
Given that generating a response is expensive and inherently sequential, how does the system avoid doing it?
Nearly every component answers some version of that:
Semantic caching — return a previous response instead of generating a new one.
Redis for recent context — avoid re-fetching history from durable storage.
Batching — amortize one expensive forward pass across many concurrent users.
Retrieval — supply a few relevant facts instead of a vast conversation history.
CDN for static assets — keep everything that is not generation off the expensive path.
Key takeaway
An LLM system breaks three assumptions the rest of the course relied on: serving is expensive rather than nearly free, a response is many sequential forward passes rather than one operation, and correctness is undefined — output can be fluent and wrong with no component able to tell. The model is stateless, so every appearance of conversational memory is architecture. And the thread through every component is the same question: how do we avoid generating?
Interview signal by level
Level
What a strong answer sounds like
L4
"It's a conversational system — the user sends a prompt, a model generates a response, and we keep conversation history for context."
L5
Names the statelessness: "the model has no memory, so context is an architectural responsibility — we retrieve prior turns and prepend them on every call, which means context costs compute."
Staff+
Leads with the inverted cost model: "this is the first design here where compute is the scarce resource, not storage or bandwidth. And generation is autoregressive — a 1,000-token answer is 1,000 sequential forward passes, so a single response can't be parallelized and latency splits into time-to-first-token and inter-token time. That sequential constraint drives batching, caching, and retrieval — every one of them is a way to avoid generating. I'd also flag up front that factual correctness isn't in the requirements and has no architectural fix, only mitigations."
Next: the requirements, and what is conspicuously absent from them.
Enjoying the preview?
Create a free account to unlock the rest of this course, the in-browser judge, and live AI mock interviews.