惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
O
OpenAI News
酷 壳 – CoolShell
酷 壳 – CoolShell
The GitHub Blog
The GitHub Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
博客园 - 聂微东
Engineering at Meta
Engineering at Meta
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
D
Docker
F
Full Disclosure
AI
AI
罗磊的独立博客
博客园 - 【当耐特】
U
Unit 42
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Palo Alto Networks Blog
博客园_首页
H
Help Net Security
量子位
月光博客
月光博客
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - 司徒正美
F
Fortinet All Blogs
D
DataBreaches.Net
B
Blog RSS Feed
Webroot Blog
Webroot Blog
TaoSecurity Blog
TaoSecurity Blog
S
Secure Thoughts
爱范儿
爱范儿
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
C
CERT Recently Published Vulnerability Notes
Martin Fowler
Martin Fowler
Blog — PlanetScale
Blog — PlanetScale
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Securelist

Redis

Real-Time Fraud Detection: Latency, Features & Scale Context window in AI: why every token is a budget decision Connecting to Redis Cloud with AWS PrivateLink vs. VPC peering | Redis Redis Data Integration in Redis Cloud is now GA in AWS | Redis Why AI Misses Business Context & How Teams Fix It AI Reasoning Explained: Why Context Matters Semantic Layer vs Context Layer: Key Differences Redis array data type: How it works and when to use it Context Graphs vs. Vector Search: When RAG Falls Short What’s new in two – May 2026 edition Redis 8.8 performance improvements: Faster string, hash, streams, SCAN & more Redis 8.8: New array data structure & open source features How Conflict-free Replicated Data Types power active-active database replication Context Orchestration: What It Is & How It Works Context Compaction for AI Agents: A Complete Guide Prompt Bloat: Causes, Costs & Fixes for LLM Apps Agentic Retrieval Techniques: A Complete Guide Single-shot reliable consumers with XREADGROUP CLAIM in Redis 8.4 | Redis Long-Horizon AI Agents: Memory & State Infrastructure What is a context engine? What Is a Context Layer? AI Agent Infrastructure Context Retrieval for AI Agents: What It Is & Why It Matters Context Poisoning: How Bad Data Breaks Agent Reasoning Context is all you need: Introducing Redis Iris | Redis Context Engineering for AI: What It Is & How to Build It Dynamic endpoints: Migrate databases without changing your endpoint | Redis AI Shopping Assistants: How They Work & What to Build Endless Aisle Retail: Infrastructure & Real-Time Data LLM Speed Benchmarks: Metrics & Infrastructure Guide Context Pruning: Cut LLM Tokens Without Losing Quality What’s new in two – April 2026 edition Agentic AI Architecture: 5 Patterns Explained AI Agent vs Chatbot: Key Differences Explained Advantages of Building a Vector Search Solution API Latency in LLM Apps: Causes & How to Fix It Security advisory: [CVE‑2026‑23479] [CVE‑2026‑25243] [CVE-2026-25588] [CVE‑2026‑25589] [CVE-2026-23631] | Redis Edge Computing Latency: Causes & How to Reduce It AI Agents vs Workflows: When to Use Each Streaming LLM Responses: Make Your AI App Feel Fast Active-Active vs Active-Passive Database Architecture Prefill vs Decode: LLM Inference Phases Explained Long-Term Memory Architectures for AI Agents Time to First Byte Test: Tools, Causes & Fixes Speculative decoding: how it works & when to use it P95 Latency: What It Is & Why It Matters Why Multi-Agent LLM Systems Fail & How to Fix Them AI Human in the Loop: Production Oversight Patterns Native OpenTelemetry metrics for Redis client libraries | Redis Client-side geographic failover for Redis Active-Active | Redis Use Redis with SQL | Redis Introducing Redis Feature Form Build Google ADK Agents with persistent, real-time memory on Redis | Redis Startup Spotlight: Neuron Systems API Throttling: Algorithms, Patterns & Mistakes Agentic AI Examples Across 6 Industries Best Chunking Strategies for RAG Pipelines Agentic AI Guardrails: Controls That Work Redis joins AWS at GDC to support the next generation of gaming | Redis Designing a semantic routing system: From static rules to dynamic intelligence with Redis and Java | Redis Real-Time Dispatch System: A Complete Guide P99 Latency: What It Means & How to Fix It Tokenization in LLMs: What AI App Devs Need to Know Atomic slot migration with Redis 8.4 Hybrid search benefits: Why your RAG system needs both keyword & vector search What’s new in two: March 2026 edition Vector embedding generators: How they work & how to use them Throughput-optimizing Redis for L2 KV Cache Reuse What is a data pipeline? Building AI agent pipelines that don't forget, fail, or fall apart Redis achieves Google Cloud Ready, Distributed Cloud status ahead of Google Cloud Next ‘26 | Redis Real-time network monitoring: what your data platform needs to keep up AI agent API: How agents connect to the real world What is multicloud infrastructure? A guide for 2026 What is a transaction monitoring system & how does it work? Why your AI agent fails in production & how tracing helps AI agent benchmarks: Where they fall short & why your infrastructure matters What is a JSON database (and when should you use one)? Introducing the Redis Partner Network: A new foundation for real-time innovation How real-time customer segmentation works in retail Payment orchestration & vault architecture in retail Agentic systems vs. GenAI: when generation isn't enough What is fuzzy matching? Semantic caching & routing: two powerful patterns for vector classification Redis alternatives: Why there are no exact substitutes Connect to Azure Managed Redis with Redis Insight 3.2.0 How to tame the thundering herd problem Redis to Manage Storage Replication | Redis How hierarchical navigable small world (HNSW) algorithms can improve search | Redis How leading financial institutions use Redis to drive growth | Redis What’s new in two: May 2025 | Redis Introducing Model Context Protocol (MCP) for Redis | Redis Redis vs. Elasticsearch: What’s faster for GenAI & vector search? | Redis Build fast, production-worthy AI apps with Spring AI and Redis | Redis Azure Managed Redis is GA today | Redis Redis then & now: Adapting with developers through every era | Redis Supercharge Your AI with OpenShift AI and Redis: Unleash speed and scalability | Redis What’s new in two: April 2025 | Redis Redis 8 is now GA, loaded with new features and more than 30 performance improvements | Redis What is a data strategy? 6 key components explained Data replication explained: types, examples & use cases
TTFT Meaning: What is Time to First Token?
Redis · 2026-04-02 · via Redis

Have you ever stared at a chatbot where nothing is happening and wondered whether it crashed? That delay between pressing send and seeing anything happen is what Time to First Token (TTFT) measures: the time between sending a request and the first output token appearing. It's one of the most visible metrics for production LLM apps because it directly shapes perceived responsiveness—users don't wait long before assuming something's wrong.

The metric itself is straightforward: start the clock when you send the request, stop it when the first token shows up. What drives that number, and what you can do about it, is where it gets interesting.

This guide covers what TTFT actually measures, how it fits alongside other LLM metrics, why it matters for product teams as much as infra engineers, and practical ways to bring it down without tanking throughput.

What TTFT measures under the hood

To understand the UX impact, start with what TTFT typically includes. The number is often broken down into three parts: network latency getting the request to the server, time spent waiting in the request queue, and the prefill phase where the model processes your prompt.

The prefill phase is often where much of the time goes. During prefill, the model computes attention across all input positions to build what's called a key-value (KV) cache. In a standard serving setup, the model finishes processing the full prompt before generating the first output token, so longer prompts generally mean higher TTFT.

This is why TTFT behaves differently from other latency metrics. It scales with prompt length. A 100-token prompt and a 10,000-token prompt might generate the same response, but the second usually takes longer to produce its first token.

Example TTFT measurements under different workloads

That prompt sensitivity is also why "good" TTFT depends heavily on the model and infrastructure. Exact figures vary by benchmark setup, so it's more useful to think in workload types than to chase a single universal target.

Some reasoning models generate longer or more complex intermediate traces before emitting the first visible token, which can inflate TTFT. In those cases, the delay goes beyond standard prefill latency, and those architectures may need different latency methods for real-time apps.

For self-hosted models, the range is wider, and load is often the deciding factor. Under high load, queueing can dominate, and a single optimization may not fully offset that when the system is saturated.

How TTFT fits into the LLM performance picture

Once you see where TTFT comes from, the next step is placing it in the rest of the latency picture. Here's how the main metrics relate:

  • TTFT: Time from request arrival to first token. Reflects prefill speed and queue depth.
  • Time Per Output Token (TPOT): Average time between consecutive tokens during generation. Governs how smooth the streaming experience feels.
  • End-to-end (E2E) latency: Time from request to last token. A common approximation: TTFT + (output tokens × TPOT), though TPOT varies under load.
  • Throughput: Total tokens or requests the system handles per second. The efficiency metric.

These metrics pull against each other in real systems. Moderate batching can improve both throughput and latency on underutilized GPUs, but past a point, larger batches trade throughput for per-request latency. You need to know which metric matters most for your workload.

Which metric matters most depends on the workload

That tradeoff also changes depending on the app you're building. Interactive chat cares most about TTFT and inter-token latency because users need that first token fast and a smooth flow after. Batch pipelines prioritize throughput. Code generation often cares about E2E latency since the IDE can't act until the full response arrives. For agentic workflows with long context, TTFT often dominates because large prompts make prefill the bottleneck. Knowing where your app falls on that spectrum tells you which metric to optimize first.

Redis Iris

Build fast, accurate AI apps that scale

Get started with Redis for real-time AI context and retrieval

TTFT is a product metric, not just an infra number

TTFT isn't only an infra metric, though. It's about perceived responsiveness, the difference between a user who stays engaged and one who's already reaching for the refresh button. You can have the best model in the world, but if the first token takes too long, the experience feels broken before it starts.

How long is too long? The classic response-time thresholds still hold up: 0.1 seconds feels instantaneous, 1 second keeps the user's flow of thought intact, and 10 seconds risks losing attention entirely. These weren't designed for LLM apps, but they map well to TTFT because they describe the same thing: how long a person will wait before they disengage.

LLM-specific research points in the same direction. In conversational AI work, much of it voice-oriented, a voice study reports that lower TTFT was rated more favorably, with worse ratings at longer delays in that study. The pattern is consistent: the longer users wait for that first token, the worse their experience.

Streaming changes the equation

That UX framing also explains why streaming matters so much. Streaming is one of the clearest ways to improve perceived responsiveness with minimal changes to your model-serving stack, though your clients and gateways need to support it.

There's a subtler point here too. Showing intermediate steps can improve user satisfaction even when total completion time stays the same. Perceived TTFT is a design variable that product teams can shape independently of infrastructure-level TTFT.

Practical levers to reduce TTFT

Because TTFT is both a systems metric and a UX metric, the fix list spans both layers. You've got several options here, and many of them stack cleanly.

KV cache prefix caching

When multiple requests share a common prefix, such as a system prompt, few-shot examples, or shared document context, prefix caching computes the key-value tensors once and reuses them. This directly avoids recomputing prefill work for the shared portion, and the savings grow with prompt length.

For API users, many inference platforms offer prompt caching that reuses computation for repeated prefixes, reducing both latency and per-token costs on cache-eligible requests.

Semantic caching

Semantic caching takes a different approach: instead of caching key-value state, it caches complete LLM responses indexed by vector embeddings. When a new query is semantically similar enough to a previously answered one, the system can return a cached response without invoking the LLM on that request. "Who is the king of England?" and "Who is the United Kingdom's monarch?" can map to the same cache entry given typical similarity thresholds.

That setup fits naturally with a fast vector-capable cache layer. You store query-response pairs as vector embeddings and retrieve similar results with low-latency lookups. Cache hits skip the LLM entirely, while cache misses add a small vector search overhead before falling through to the model. Redis supports this pattern natively because it combines vector search with in-memory caching in a single real-time data platform, reducing the need to manage a separate vector database alongside your cache.

Redis Iris

Make your AI apps faster and cheaper

Cut costs by up to 90% and lower latency with semantic caching powered by Redis.

The tradeoff is straightforward: semantic caching works best for workloads with high query repetition, such as customer support bots, frequently asked question systems, and internal knowledge assistants. For highly creative or unique queries, hit rates stay low.

Prompt compression

Another direct lever is reducing prompt length. Fewer tokens means shorter prefill, which means lower TTFT. The LLMLingua family of prompt compressors can achieve up to 20× compression with only a small reported performance drop in that paper. For retrieval-augmented generation (RAG) workloads, LongLLMLingua reported a 21.4% gain while using only one-quarter of the tokens in that paper, with that improvement tied to reducing lost-in-the-middle degradation at long contexts.

Chunked prefill & disaggregated serving

Prompt-side changes aren't the only levers. For self-hosted systems, infrastructure choices matter too. Chunked prefill breaks large prompt processing into smaller pieces batched with active decode requests, reducing the risk of long prefills monopolizing the GPU. In vLLM, chunked prefill is enabled by default at the time of writing, with behavior and tradeoffs controlled primarily through batching configuration. An emerging pattern called disaggregated serving takes this further by separating prefill and decode onto dedicated hardware, though the approach is still experimental in most stacks.

TTFT in RAG & retrieval-heavy apps

Prompt-side and infra-side levers help, but RAG pipelines add another layer: a large share of TTFT can come from retrieval work that happens before the model ever sees the request. The app has to embed the query, search a vector store, optionally rerank results, and assemble context—all before prefill starts. Then the retrieved context increases prompt length, extending prefill time.

In one RAG benchmark, retrieval accounted for 41% of E2E latency and 45-47% of TTFT. That makes retrieval a big contributor in some architectures, but not all.

Reranking can be another bottleneck. LLM-based rerankers can cost significantly more per query than the initial retrieval. Two-stage retrieval helps: fast vector embedding search first, expensive reranker on a small shortlist.

At the system-design level, this is where low-latency retrieval infrastructure matters. Redis combines vector search and semantic caching in one place, which can help keep retrieval overhead low. The impact depends on the workload, architecture, and whether the request is a cache hit or miss.

How to monitor & act on TTFT

Retrieval, prefill, and queueing all contribute to TTFT, and monitoring needs to separate them clearly. Tracking TTFT in production means going beyond averages. P50 shows the typical experience, P90 and P95 show near-worst-case behavior, and P99 shows your slowest users. In LLM serving, a useful composite metric is goodput: the fraction of requests meeting all your service-level objective constraints at the same time.

The percentile pattern tells you a lot. When P99 spikes while P50 stays flat, queue contention during traffic bursts is often the cause. When all percentiles rise together, the model or hardware may be undersized for the workload. When both jump after a deployment change, prompt length or configuration regressions are good suspects.

Track supporting metrics alongside TTFT, especially queue depth, cache hit rate, and prefill time isolated from queue time. vLLM exposes Prometheus metrics that you can pipe into Grafana dashboards for real-time visibility, and tools at the trace or gateway layer can capture TTFT too.

One more reality check matters here: your load test traffic has to match production. One documented failure occurred when load testing used short documents, but actual traffic included lengthy contracts generating 10× more tokens. Clean P95 numbers in testing didn't carry over to production.

Fast first tokens mean better products

Once you've measured TTFT well, the takeaway is pretty simple: it shapes how users perceive your LLM app in its most vulnerable moment, the seconds before any response appears. It's driven by queueing, prefill computation, and, in some RAG architectures, retrieval latency. Under load, those delays can stack fast.

The optimization playbook is layered. Prefix caching helps when prompts repeat. Semantic caching can skip the LLM entirely for repeated intents. Prompt compression shrinks prefill work. Infrastructure techniques like chunked prefill and disaggregated serving can help self-hosted deployments. Monitoring TTFT from P50 through P99, with queue and prefill time broken out separately, turns a vague responsiveness complaint into something you can actually diagnose.

For teams already using Redis for caching or session management, adding AI capabilities means fewer systems to manage. Redis LangCache is a fully managed semantic caching service that has reported up to 73% lower LLM inference costs for high-repetition workloads, and Redis Query Engine provides vector search for fast RAG retrieval.

Try Redis free to test semantic caching and vector search with your own workloads, or talk to the team about optimizing TTFT across your AI infrastructure.

Redis Database

Now see how this runs in Redis

Use Redis to power real-time data, retrieval, and caching at scale.