Skip to content

Add session-aware prefix caching and /v1/stats endpoint - #199

Draft
stikves wants to merge 1 commit into
apple:mainfrom
stikves:sukru/server-prefix-cache
Draft

Add session-aware prefix caching and /v1/stats endpoint#199
stikves wants to merge 1 commit into
apple:mainfrom
stikves:sukru/server-prefix-cache

Conversation

@stikves

@stikves stikves commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  • X-Session-ID header enables KV cache reuse across requests in the same conversation (engine's TokenHistory detects prefix overlap)
  • GET /v1/stats returns JSON metrics: throughput, prefix hit rate, memory
  • Remove unconditional engine.reset() from chat path — let the engine handle prefix detection internally for 10-20x TTFT improvement on multi-turn conversations
  • Completions endpoint retains reset (lm-eval sends unrelated prompts)

- X-Session-ID header enables KV cache reuse across requests in the
  same conversation (engine's TokenHistory detects prefix overlap)
- GET /v1/stats returns JSON metrics: throughput, prefix hit rate, memory
- Remove unconditional engine.reset() from chat path — let the engine
  handle prefix detection internally for 10-20x TTFT improvement on
  multi-turn conversations
- Completions endpoint retains reset (lm-eval sends unrelated prompts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant