prefix caching
Inference interview questions tagged prefix caching, across every topic.
15 questions · 6 unlocked for you
Concepts behind "prefix caching"
Concept pages for the mechanisms these questions lean on.
Advanced
Prefix Caching and Chained Block HashesAutomatic prefix caching keeps the KV blocks of finished requests and reuses them when a new prompt starts with the same tokens. Each full block is keyed by a hash chained from its parent block, which makes a hit mean the whole prefix matched; that decides TTFT for shared system prompts and how much cache multi-turn traffic needs.🧮 KV Cache & Memory🔒 Premium
Advanced
SGLang's Radix Cache and Overlap SchedulerSGLang stores every cached prefix in a radix tree keyed by token ids, so a hit can end at any token rather than at a block boundary, and its overlap scheduler prepares the next batch while the GPU runs the current one. This page walks both through the v0.5.21 source: matching, lock references, leaf-first LRU eviction, the 128-request cutoff on prefix-aware scheduling, and memory defaults.⚙️ Serving Engines🔒 Premium
Advanced
Prefix-Aware and KV-Aware RoutingWhy a prefix cache is only as good as the router in front of it: round-robin spreads each shared prefix across every replica and shrinks the hit rate, prefix-affinity hashing concentrates it, and KV-aware routing scores replicas on cached blocks against load so one hot tenant cannot melt a node.🏛️ Inference System Design🔒 Premium