Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. LLMs /
  4. What is LLM Inference?
LLMs

What is LLM Inference?

Updated September 21, 2026 Read 3 min

LLM inference is the process of running a trained large language model to generate a response: processing the prompt, then producing output one token at a time. Its speed and cost depend on model size, context length, hardware and serving techniques.

Contents 12
  1. 01Key takeaways
  2. 02LLM inference explained in simple terms
  3. 03The two phases
  4. 04Key metrics
  5. 05A worked example: estimating response time
  6. 06The KV cache
  7. 07Techniques to speed up inference
  8. 08Where inference runs
  9. 09Limitations
  10. 10Common Use Cases
  11. 11Frequently Asked Questions
  12. 12Related Terms

LLM inference is the process of running a trained large language model to generate output from a prompt. It has two phases: prefill, where the model processes the whole prompt at once, and decode, where it generates the response one token at a time. Inference determines how fast responses appear, how many users a system can serve and how much each request costs.

This page covers inference specifically for LLMs. For inference across all AI models, see What is AI Inference?

Key takeaways

  • Prefill processes input in parallel; decode generates tokens sequentially.
  • The KV cache stores past attention results so each new token is cheaper to compute.
  • Key metrics: time to first token (TTFT), tokens per second and throughput.
  • Decode speed is usually limited by memory bandwidth, not raw compute.
  • Batching, quantization, caching and speculative decoding reduce cost and latency.

LLM inference explained in simple terms

Imagine a writer asked to continue a story. First they read the whole story so far (prefill), which they can do quickly by skimming. Then they write the continuation word by word (decode), and each word needs a moment of thought. They keep notes about what they read, so they do not reread everything before each word. Those notes are the KV cache.

The two phases

PhaseWhat happensPerformance characteristic
PrefillAll prompt tokens pass through the transformer in parallel; the KV cache is builtCompute-heavy; longer prompts increase time to first token
DecodeOne new token per step, using the KV cache; repeat until doneMemory-bandwidth-heavy; sets tokens per second

Key metrics

  • Time to first token (TTFT): delay before output begins. Driven by prompt length and queueing.
  • Tokens per second (per user): how fast text streams once started.
  • Throughput: total tokens per second across all users on the hardware.
  • Cost per million tokens: combines hardware cost and throughput.

A worked example: estimating response time

A model on a given server has a TTFT of 0.4 seconds for a 2,000-token prompt and generates 50 tokens per second. A 400-token answer takes about 0.4 + (400 ÷ 50) = 8.4 seconds. Cutting the answer to 150 tokens reduces it to about 3.4 seconds. This is why concise output instructions and structured output speed up applications, and why reasoning models, which generate many thinking tokens, are slower.

The KV cache

In attention, each token needs the keys and values of all earlier tokens. Recomputing them for every new token would be wasteful, so they are stored in the KV cache. The cache grows with context length and batch size and can consume large amounts of GPU memory. Techniques such as PagedAttention, introduced with the open-source vLLM engine in 2023, manage this memory more efficiently, allowing more concurrent users.

Techniques to speed up inference

TechniqueHow it helps
Continuous batchingGroups many users’ requests to keep the GPU busy
QuantizationSmaller weights mean less memory to read per token
Prompt (prefix) cachingReuses processing for repeated prompt prefixes, such as long system prompts
Speculative decodingA small draft model proposes tokens; the large model verifies several at once
Distillation or smaller modelsLess compute per token
Mixture of expertsActivates only part of the model per token
StreamingShows tokens as they are generated to improve perceived speed

Where inference runs

  • Hosted APIs: simplest; pay per token.
  • Self-hosted cloud GPUs: serving engines such as vLLM or TensorRT-LLM for control and cost at scale.
  • Local and edge: quantized open-weight models via tools like llama.cpp or Ollama.

Limitations

  • Long contexts increase memory use and TTFT.
  • Sequential decoding limits single-user speed.
  • Costs scale with usage, especially output tokens.
  • Performance varies widely between hardware and serving stacks.

Common Use Cases

01

Chat applications

Stream responses quickly with low time to first token.

02

High-volume APIs

Use batching and caching to serve many requests per GPU.

03

Cost optimisation

Route simple tasks to small models and cache repeated prompts.

04

Local AI

Run quantized models on laptops and workstations.

05

Real-time voice agents

Minimise latency for natural spoken conversations.

06

Batch processing

Process large document sets overnight at high throughput.

Frequently Asked Questions

Running a trained language model to generate output, first processing the prompt and then producing tokens one by one.

Prefill processes the entire prompt in parallel. Decode generates the response one token at a time.

Stored attention keys and values for previous tokens, so the model does not recompute them for each new token.

The delay between sending a request and receiving the first output token.

Use smaller or quantized models, shorter prompts and outputs, prompt caching, batching and routing.

Related Terms

  • AI Inference
  • Token
  • Context Window
  • Model Quantization
  • KV Cache
  • Small Language Model

Related AI Terms

What is an Attention Head?An attention head is a single attention unit inside a transformer layer, with its own query, key and…What is Prefix Tuning?Prefix tuning is a parameter-efficient fine-tuning method that learns trainable vectors inserted into the attention keys and values…What is an Attention Mechanism?An attention mechanism is a technique that lets a neural network focus on the most relevant parts of…What is Self-Attention?Self-attention is a mechanism where each position in a sequence attends to every other position in the same…What is Multi-Head Attention?Multi-head attention runs several attention operations in parallel, each with its own learned projections, so a model can…What is RoPE (Rotary Positional Embedding)?RoPE (rotary positional embedding) encodes a token's position by rotating its query and key vectors by an angle…

Contents

  1. 01Key takeaways
  2. 02LLM inference explained in simple terms
  3. 03The two phases
  4. 04Key metrics
  5. 05A worked example: estimating response time
  6. 06The KV cache
  7. 07Techniques to speed up inference
  8. 08Where inference runs
  9. 09Limitations
  10. 10Common Use Cases
  11. 11Frequently Asked Questions
  12. 12Related Terms

AI Topic

  • LLMs

Related Terms

  • What is an Attention Head?
  • What is Prefix Tuning?
  • What is an Attention Mechanism?
  • What is Self-Attention?
  • What is Multi-Head Attention?
  • What is RoPE (Rotary Positional Embedding)?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
September 21, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}