Keep the chat prompt prefix stable for llama-server prompt caching #77
Reference in New Issue
Block a user
Delete Branch "perf/stable-prompt-prefix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
llama-server reuses a prompt prefix only when it is byte-identical. Simulating conversations through the real build_context / ToolRouter / SummaryStore showed ~80% of prompt tokens re-prefilled every turn on main.
Changes:
static): bind the full role-appropriate tool set in a fixed order, with no discover_tool_groups round trip. Admin gating is unchanged.dynamickeeps the keyword router for comparison. Costs ~1.7k more (cached) tool tokens per call.Re-prefilled share of turn-start prompts (simulation):
Tests: 367 passed.
🤖 Generated with Claude Code