Language ModelsExplainer
What Is Inference in AI? My Laptop Spent 64 Seconds Reading the Prompt and 32 Writing the Answer
Inference is a trained model doing its job: reading your input and producing an output, on every request. I measured both halves on my laptop and lived with their limits on a production GPU. Reading a long prompt took twice as long as writing the answer, and on my own server the bill came in memory, not tokens.
8 min read

Inference in AI is running a trained model on new input to get an output, such as a reply, a classification or an SQL query. Training sets the model's weights once; inference uses those fixed weights on every request. For a language model it has two phases: prefill, which reads the whole prompt, and decode, which writes the answer one token at a time. On a MacBook Air M4, a 14-billion-parameter model took 64.5 seconds to read a 3,500-token prompt and about 32 seconds to write a 200-token answer. Through an API inference is billed per token; on your own server it is paid in GPU memory and GPU time.
Inference is a trained model doing its job: it reads your input and produces an output, every time you send a request. I gave the same task to three models on my laptop. The largest spent 64 seconds reading the prompt, 3,500 tokens of table descriptions with one question at the end, and 32 seconds writing the answer. Given the question alone, the same model started answering in a second and a half. Through an API you pay for inference per token. On your own server you pay in GPU memory and GPU time.
What inference is
A model goes through two stages. First training: its internal numbers, the weights, are fitted on a large set of examples. That happens once and costs a lot. Then inference: the weights stay fixed, the model takes new input and produces a result. A chatbot's reply, an object found in a photo, an SQL query written from a plain-language question. All of it is inference.
Training happens once. Inference happens on every request from every user for as long as the model is in service, so its cost repeats with every request.
The word misleads. In everyday English an inference is a reasoned conclusion. In AI it only means running the model. Calling something inference does not mean the model reasoned, or that its answer is right.
Two phases: reading and writing
A language model works in tokens, short pieces of text; I counted where they go in an earlier test. Every request goes through two phases.
- Reading the prompt, called prefill. The model processes your whole text in one pass, all tokens together. While this runs, you see nothing. The wait until the first word appears is called time to first token.
- Writing the answer, called decode. The model produces one token at a time. Each one depends on the ones before it, so they cannot be computed at once.
I measured both on my MacBook Air: Apple M4, 24 GB of memory, Ollama 0.40.4, three Qwen3 models with the same 4-bit compression (Q4_K_M). There were two prompts. The short one was a single question: write an SQL query for the ten customers with the highest order total in 2025. The long one put a description of 16 made-up tables in front of the same question, about 3,500 tokens. Every answer was capped at 200 tokens. Each case ran three times; the table shows the median of the timings Ollama reports for each request.
| Model | Memory | Short: first token | Short: writing, tokens/s | Short: full answer | Long: reading the prompt | Long: writing, tokens/s | Long: full answer |
|---|---|---|---|---|---|---|---|
| Qwen3 4B | 3.8 GB | 0.15 s | 33 | 6.3 s | 16.8 s | 22 | 26 s |
| Qwen3 8B | 6.7 GB | 0.81 s | 14 | 15.3 s | 35.4 s | 12 | 52 s |
| Qwen3 14B | 10 GB | 1.41 s | 7 | 31.9 s | 64.5 s | 6 | 96 s |
Three things stand out.
Reading took longer than writing. On the 14B model two thirds of the time went to reading the table descriptions, and for all of that minute the screen stayed empty. The 200-token answer took half as long.
Size cost time in proportion, memory less so. The 14B model has 3.7 times the weights of the 4B. Its full answer to the long prompt took 3.7 times as long, and it used 2.6 times the memory.
Writing slows down when the prompt is long. On the 4B model it fell from 33 to 22 tokens per second, because every new token looks back at everything already read.
The test also caught two mistakes of my own, and I threw both runs away. In the first, Ollama served repeated prompts from its cache, and reading came out at up to 95,000 tokens per second. In the second, it quietly cut the long prompt to 4,096 tokens and dropped the beginning. A speed number is only as good as the check behind it.
Where the memory goes: my production case
In production I run a model on my own server. The data must not leave a closed network, so an API was never an option. The system turns plain-language questions into SQL.
I picked the model for one A100 GPU with 80 GB of memory. On my 34 tests, Gemma3-27B stopped at about 70% after four rounds of prompt changes. Qwen3-32B scored 79% at once and 84% after the prompts were tuned. That is an internal measurement on closed data; nobody outside can check it.
Inference memory goes to two things. The first is the weights, and their size is fixed. The second is what the model keeps about every token it has read so it does not compute it again, called the KV cache. For Qwen3-32B in 16-bit that is a quarter of a megabyte per token, by its published configuration. It grows with every token of the prompt and with every request running at the same time.
At first I ran the model in full 16-bit precision. The weights alone took about 65 GB: 32.8 billion of them at two bytes each. That left room for about 7,500 tokens of context per request, with four requests at a time. Four such requests hold more than 7 GB of cache.
Memory was the first wall. The step that plans the SQL needs the database schema with its table descriptions, and the schema did not fit. Any request longer than 7,500 tokens failed. A second problem came later: the container crashed after five to seven days of running.
I tried FP8, an 8-bit number format that would halve the weights. The A100 has no native support for it, and there was no gain. For a while I stayed on 16-bit and restarted the service ahead of time. For steady operation I then moved to AWQ, which compresses the weights to 4 bits. The model shrank to about 20 GB and the context grew to 32,000 tokens. Answers became slower, because the A100 spends time unpacking the weights.
Nobody charged me per token; the server is mine. Every one of these decisions was about GPU memory. Compression traded speed for room to read.
What inference costs on your own server
On your own hardware the meter is GPU time. My open benchmark on BIRD ran 1,534 questions with vLLM in 16-bit on self-hosted GPUs (arXiv:2606.29733, code). In my Conf42 AI Agents 2026 talk I priced its wall-clock times at $1.80 per GPU hour.
The benchmark shows how an inference technique can eat a budget. Self-consistency, where the model answers five times and the most common answer wins, added at most 0.13 percentage points across two runs, which is not significant. It took five times the tokens. The model time per question, measured at the 95th percentile with 64 requests in flight, went from 10.6 to 50.0 seconds. Self-correction, one extra pass of the same model over its own answer, added 1.2 to 4.4 points depending on the model. At $1.80 per GPU hour that extra pass came to $0.12 to $0.22 per 1,000 queries.
So every extra call to the model has a price in GPU seconds, whether or not a bill ever mentions tokens.
Why chip money is moving to inference
In mid-November AMD completed its purchase of Taalas, a company that makes chips only for inference. According to OC3D's coverage, Taalas etches a specific model's weights into the chip. Such a chip does not train or change a model. It only runs it.
The deal points the same way as my laptop and my server. A model is trained once and run millions of times, so the race is for hardware that runs it faster and cheaper.
What to take from this
- Count the length of the prompt, not only the answer. A long schema or document in the prompt costs time before the first word and memory for as long as the request runs.
- Pick the model for the memory you have. Weights, plus context, plus concurrent requests. In my case 80 GB decided more than any leaderboard.
- Compression is a trade. AWQ gave me four times the context and slower answers.
- Price every extra model call. On your own server it is GPU time, even with no token bill.
What this does not show
The laptop test is one computer and one program. It is not the speed of a server handling a queue of requests, and it does not judge the quality of the answers. The script asked every model not to show its reasoning; Qwen3 4B ignored that and wrote its reasoning instead of the query. The timings per token still hold. The production numbers are internal, on closed data. The BIRD benchmark is public and can be rerun from the links above.
Sources
- What is AI inference?, IBM
- Qwen3-32B model configuration, Hugging Face
- Ollama API reference
- AMD completes acquisition of AI inference chip pioneer Taalas, Engineering.com
- AMD strengthens its AI stack with Taalas acquisition, OC3D
- How far do on-premises open LLMs get on Text-to-SQL? A cross-family size and technique frontier on BIRD, arXiv:2606.29733
- nl2sql-onprem-bench, GitHub
- What Is a Token in AI? I Ran the Same 71 Tasks on Three Models, BESK TECH
Vladimir Beskorovainyi, Enterprise AI Architect & CTO, author of the Amazon bestseller "Enterprise AI: The KATA Way", founder of Besk Tech (besk.tech)
More in this section
Language ModelsExplainer
What Is a Token in AI? I Ran the Same 71 Tasks on Three Models
A token is the unit a language model reads, writes and bills in. I gave the same 71 tasks to three Claude models. The mid-size one got 57 of 63 right for about half the price of the largest, which got 58. In this test the model choice moved the bill far more than trimming the context did.
Language ModelsExplainer
What Is RAG? A 1,534-Question Test Where Retrieval Only Took Things Away
Retrieval-augmented generation finds the relevant material and puts it in the model's window before it answers. In my Text-to-SQL benchmark the retrieval step kept 96.5% of the needed tables on average and left accuracy unchanged. Here is why, and how to tell whether retrieval will help on your data.
Language ModelsExplainer
What Is AI Hallucination, and Why You Cannot See It
A hallucination is a confident answer that is wrong. I counted such answers on 1,534 questions. When I made the models repair their failures, the number of wrong answers that look fine went up.
Get new articles by email
One message when something new is published. No other mail, and you can stop at any time.
The address is used for this one letter and nothing else. Privacy