You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hash-based prefix cache for multi-turn conversations. Keep the KV-cache alive between calls, match the new prompt's token prefix against what's already cached, and only prefill the new suffix. Dramatically reduces TTFT for multi-turn chat.
Acceptance Criteria
PrefixCache class with LRU eviction and configurable max entries
PrefixCacheEntry storing live KV-cache + token prefix
SimpleKvCache.SetCurrentLength() to truncate visible cache length
TextGenerator accepts optional PrefixCache, skips prefill for cached prefix
--no-prompt-cache flag to disable, --prompt-cache-size N to configure max entries
/clear in chat CLI resets the prefix cache
TimingsDto.CachedTokens in API response
Chat UI displays cached token count in stats bar
Unit tests for PrefixCache (match, eviction, clear)
CPU SimpleKvCache only for V1 (QuantizedKvCache/GPU fall back to no caching)
Key Design Decision
Live KV-cache reuse (not snapshots): The KV-cache object persists across calls. No memcpy on cache hit — just truncate CurrentLength and prefill only suffix tokens. Ownership transfers to PrefixCache after generation, disposed on eviction.
Activity
Step 54: Simple prompt caching — live KV-cache reuse for multi-turn c…
Clear prompt cache on UI clear, adjust serve defaults (#90)
Address PR review feedback (#90)
Update docs and README for Phase 5 completion (#90)
Step 54: Simple prompt caching — live KV-cache reuse for multi-turn c…