r/LLMStudio • • 23d ago

Prefixwise (v0.10.0, MIT): Identify, fix, and prevent LLM prompt cache misses across vLLM, SGLang, LMCache, Claude, and OpenAI (zero prompt text stored)

1 Upvotes

Prefixwise tells you why your LLM calls miss the prompt cache, and what each miss costs you. Put it between your agent and the model, or inside vLLM itself, and it identifies the cause of every miss in plain English, fixes the common ones for you, and prevents new ones from reaching production. Your prompts never leave your machine: it stores hashes and counts, nothing else.

Repo: https://github.com/tejachavali/prefixwise
Install: pip install prefixwise (0.10.0 is out today)

Identify: 19 causes, each with its evidence and fix. Tools sent in a changed order, a timestamp in the system prompt (naming whether a date, time, UUID, or file path changed), an edited earlier message, a compaction rewrite, a model switch, a misplaced cache breakpoint, TTL expiry, a retry, an eviction, a routing miss, and more. Agrees with Anthropic's own miss diagnostics 32 of 32.

Fix: --fix canonical_tools lets the proxy repair the most common cause in flight. Measured: 99.9% of the predicted saving realised on Claude, 97.5% on vLLM, task success unchanged.

Prevent: prefixwise check -- pytest tests/agent_scenarios, or the GitHub Action, runs your agent's scenarios against a local mock and fails CI when a change breaks the cache. Nothing is sent anywhere.

Where it runs, each about thirty seconds to set up (no config files to edit):

• prefixwise import claude-code && prefixwise report (or prefixwise import codex): reads the local logs of a subscription, nothing is sent anywhere
• prefixwise run -- claude (or codex, opencode, any agent): wraps the agent, reports when it exits
• prefixwise serve --upstream <url>: a local proxy for a service, several agents, or a gateway
• vllm serve <model> --middleware prefixwise.PrefixwiseMiddleware: inside vLLM, no proxy
• prefixwise.wrap(Anthropic()) or wrap(OpenAI()) in your own Python
• litellm.callbacks = [PrefixwiseCallback()] for LiteLLM, SDK or proxy server

Self-hosted engines: it auto-detects the vLLM or SGLang behind any URL you give it and subscribes to the engine's own KV events. From those it confirms evictions, tells an LMCache or HiCache restore (host_restored) from a GPU hit, and confirms routing misses across replicas.

Data: a report in the CLI, /api/v1, JSONL and CSV export, Prometheus metrics with a Grafana dashboard and an alert rule, OpenTelemetry spans, a collector for many edges.

Measured this week, live on a Colab L4: reasoning models' chat templates drop the thinking from history, so every turn prefills the previous answer again. Qwen3-4B: 25-36% of all prompt tokens. A DeepSeek-R1 distill: 57%. Qwen2.5 and Llama 3.2 keep history as generated: 0%. The engine reports a hit either way; Prefixwise now names the tail per turn (output_rerendered).

Also live: agrees with Anthropic's own miss diagnostics 32 of 32; names injected causes 120 of 120 on vLLM, LMCache and SGLang; evictions confirmed 5 of 5 from KV events; 3 ms overhead per request. Every number in the README links to its run record.

Docs for engine users:
• vLLM: https://github.com/tejachavali/prefixwise/blob/main/docs/VLLM.md
• SGLang: https://github.com/tejachavali/prefixwise/blob/main/docs/SGLANG.md
• LMCache: https://github.com/tejachavali/prefixwise/blob/main/docs/LMCACHE.md


r/LLMStudio • • 24d ago

LLMs Are Not Actually Probabilistic

Thumbnail
lukasniessen.medium.com
1 Upvotes

r/LLMStudio • • 25d ago

B390 local llm

Thumbnail reddit.com
2 Upvotes

r/LLMStudio • • 25d ago

GLM 4.5 going dark December??

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • 26d ago

Why LM Studio Bionic is slower than original LM Studio? Any ideas?

Thumbnail reddit.com
3 Upvotes

r/LLMStudio • • 27d ago

running llm in cpu weirdness.

Thumbnail
reddit.com
1 Upvotes

r/LLMStudio • • 28d ago

Q6 Model + Q8 Cache vs. Q4 Model + FP16: Which Actually Wins? (Smart Bra...

Thumbnail
youtube.com
2 Upvotes

r/LLMStudio • • 28d ago

Seeking feedback on local LM vibe coding

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • 28d ago

Quero começar uma LLM e preciso de conselhos

Thumbnail reddit.com
0 Upvotes

r/LLMStudio • • 29d ago

Best local AI to run on LM Studio

1 Upvotes

Which local AI would you recommend I download on LM Studio? I primarily use it for explaining slides, exploring topics in greater depth, and working with code.


r/LLMStudio • • Nov 01 '26

Local AI on a phone

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Nov 01 '26

Local AI on a phone

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Nov 01 '26

Please assist in setting up local LLM

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Nov 01 '26

trying out deepseek 4.1 but it barfs?

1 Upvotes

error loading model: unknown model architecture: 'deepseek41-sidecar'

^^^ this is trying to load it on a Nvidia 4090


r/LLMStudio • • Oct 31 '26

Building an end-to-end LLM trainer from scratch on my laptop (PyTorch + Rust constraints logic)

Thumbnail
reddit.com
1 Upvotes

r/LLMStudio • • Oct 30 '26

LLM config setup

Post image
1 Upvotes

r/LLMStudio • • Oct 29 '26

What breaks first when an LLM app goes to production?

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Oct 27 '26

AFM 3 PCC now analyzes images through Local Client

Thumbnail
reddit.com
1 Upvotes

r/LLMStudio • • Oct 27 '26

AFM 3 PCC now analyzes images through Local Client

Thumbnail
reddit.com
1 Upvotes

r/LLMStudio • • Oct 27 '26

llmserver – one bash script for local LLMs with model security checks (llama.cpp / vLLM / Ollama)

Thumbnail
github.com
1 Upvotes

r/LLMStudio • • Oct 27 '26

Modello per coding su M1pro 16gb

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Oct 27 '26

I keep getting these message errors, but it stops the process and i have to manually click "try again", is there something i can do about it?

1 Upvotes

r/LLMStudio • • Oct 26 '26

New to Local AI. Need advice

Thumbnail reddit.com
1 Upvotes

r/LLMStudio • • Oct 26 '26

In search of LMStudio security documentation, such as HECVAT

1 Upvotes

I am attempting to convince a US University to install LMStudio on its servers for research purposes. The request is currently stuck in security review. University IT can’t approve installation without security approval, and I can’t provide the requested info, or even an Element Labs contact to provide the info.
Has anyone completed an HECVAT (Higher Education Community Vendor Assessment Toolkit) on LMStudio? Or have security info you’ve used to gain approval to install on corporate or organizational infrastructure? Or other recommendations?