RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
Glossary / Transformer & LLM components / Prefill (Prompt Processing)
Transformer & LLM components

Prefill (Prompt Processing)

Prefill is the first phase of LLM inference: the model processes the entire prompt in a single parallel pass, building up the KV cache for every prompt token. Prefill is compute-bound — large matrix-matrix operations that saturate tensor cores.

Prefill latency dominates time-to-first-token (TTFT). For a 7B model on an RTX 4090, prefill runs at roughly 3,000–8,000 tokens/sec depending on batch geometry, so a 2K-token prompt takes 250–700 ms before generation even starts.

Optimizations: chunked prefill (process the prompt in slices to overlap with decode), prefix caching (reuse KV from a previous prompt with the same prefix), and Flash Attention (reduce memory traffic during attention).

Practical example

An operator debugging a slow chatbot response notices the delay before the first token appears is inconsistent — fast for short questions, sluggish for anything with a long system prompt or pasted document. Profiling the request shows the lag tracks prompt length almost linearly: a 200-token question returns in well under 100ms, but a 6K-token document dump takes several seconds before generation starts. That's prefill time, not decode — the model is doing one large compute-bound pass over the whole prompt to populate the KV cache. The fix isn't a faster GPU necessarily; it's prefix caching, so a system prompt that's identical across requests doesn't get reprocessed every time, and chunked prefill in servers like vLLM so a huge prompt doesn't block other users' TTFT on a shared server.

Related terms

Flash AttentionKV CacheTime to first token (TTFT)Decode (Token Generation)

Reviewed by Eruo Fredoline. See our editorial policy.

Buyer guides
  • Best GPU for local AI →
  • Best laptop for local AI →
  • Best Mac for local AI →
When it doesn't work
  • CUDA out of memory →
  • Ollama running slowly →
  • ROCm not detected →