All insights

    Architecture

    Your Inference Bill Is Memory, Not Compute

    · 8 min read · Anton Babayan, Founder

    Capacity for an AI system is usually planned around how fast the hardware can do arithmetic. Then the hardware arrives, the system runs, and the expensive part of it sits idle most of the time. Generating text is limited by how fast data can be moved rather than by how fast it can be multiplied, and most of what looks strange in a hosting bill follows from that.

    Two different jobs wearing one name

    A request to a language model is two operations with opposite characters, and conflating them is where sizing goes wrong.

    Reading the prompt happens once. The whole input is available at the same moment, so the work can be spread across the chip in parallel, and this part genuinely does use the arithmetic the hardware was sold for.

    Producing the answer happens one token at a time, and each token depends on the one before it. Every single token requires the model's weights to be read again, and does relatively little arithmetic with each weight once it arrives. The processor finishes and waits for more data.

    So a long prompt with a short answer and a short prompt with a long answer load the machine in completely different ways, while costing similar amounts of apparent work.

    Why batching is the whole economic model

    If the constraint were arithmetic, two requests would cost twice one request. Because the constraint is reading the weights, and the same weights serve everyone, several requests processed together can share one pass over them.

    That turns utilisation into the dominant term in the cost per request. A machine serving many conversations at once is efficient. The same machine serving one conversation does nearly the same work for one answer, which is why a lightly used dedicated deployment produces a bill that seems unrelated to its traffic.

    It also explains a pattern that confuses people comparing options: a provider's per-token price can be lower than the cost of running the same model yourself, without any subsidy involved. The provider is batching across many customers and you are not. That is one of the real inputs to the decision to host a model or call one.

    The cache nobody budgets for

    To avoid redoing the work for every earlier token at each step, the intermediate state for the conversation so far is kept in the accelerator's memory. This is the part teams forget when they calculate whether a model fits on a card.

    It grows with the length of the conversation and with the number of conversations happening at once, and it competes for exactly the same memory as the model's own weights. The practical ceiling on how many users one machine can serve is usually set here rather than by processing speed.

    Two consequences follow. Longer contexts cost memory as well as money, so a generous context limit is a capacity decision rather than a configuration one. And concurrency is bounded by memory, so the honest capacity question is how many simultaneous conversations of what length, not how many requests per second.

    How that memory is handed out matters too. Reserving a contiguous block per conversation, sized for the longest answer it might produce, wastes most of it, because most answers are shorter. Serving stacks now allocate it in small blocks as the conversation grows, which is why the same hardware and the same model can serve very different numbers of users depending on which serving software is in front of it.

    What this means for a capacity plan

    Size against concurrency and context length rather than request volume, because those are what consume the constrained resource.

    Measure at the load you expect to have rather than the load you hope for. A benchmark run at full batch tells you the best case, and a quiet service never reaches it.

    Treat the serving layer as a real choice. The model and the hardware get all the attention, and the software that schedules and allocates between them changes the throughput of the identical pair by a wide margin.

    And put the running figure in the approval rather than the build figure, since the first year of operation is where this arrives.

    The short version

    Reading the prompt uses arithmetic; writing the answer waits for memory. Cost per request therefore falls with batching and rises when a machine is quiet. The conversation cache competes with the model for memory and usually sets the real user limit. Plan capacity in concurrent conversations and context length, and treat the serving software as part of the capacity rather than as plumbing.

    Frequently asked questions

    Why is generation memory-bound rather than compute-bound?

    Producing one token requires reading every weight the model has, and doing comparatively little arithmetic with each one. The chip finishes the maths and waits for the next batch of weights to arrive. The constraint is the speed of the road rather than the speed of the engine.

    What does that change in practice?

    Batching stops being an optimisation and becomes the whole economic model: serving many requests together amortises one pass over the weights, so cost per request falls sharply with load and rises sharply when the machine is quiet. An under-used GPU is the expensive case.

    What is the KV cache and why does it matter?

    It is the model's memory of the conversation so far, held in GPU memory so earlier tokens do not have to be recomputed at every step. It grows with the length of each conversation and with the number of simultaneous ones, and it competes for the same memory as the model itself. It is usually what limits how many users one machine can serve.

    Related reading

    Planning something similar?

    We find where AI actually fits, build it, and get it running in production.

    Get in Touch