r/devops • u/Key_Coconut_9269 • Oct 27 '26
AI content why is everyone still using cloud llms just to route tool calls? tested local cpu embeddings vs bm25 on 100k tools
honestly i dont get why current multi-agent setups are built like this.
if you connect 4 or 5 mcp servers (github, postgres, filesystem, slack etc) you easily end up with 40-50+ tool schemas. right now the standard pattern in langchain or claude code is dumping all 4,000+ tokens of json schemas into the prompt on every single turn just so the llm can pick which function to run.
you end up paying token costs and waiting ~2 seconds of network latency just for what is basically an L7 routing lookup.
i spent the last few weeks testing if we can just decouple tool discovery completely from the llm using a local cpu vector mesh (all-MiniLM-L6-v2 + chromadb hnsw index) and a split execution daemon.
instead of embedding just the function name (which fails on synonyms), i combined the tool name, description, schema keys, and tags into a single profile vector. when a prompt comes in, it embeds the query on cpu and pulls the top match before ever touching the llm.
ran a cold-cache benchmark across 100,000 synthetic tool endpoints on my local machine (standard cpu, no gpu):
method top-1 acc avg latency p95 latency
---------------------------------------------------------------
naive keyword scan 38.1% 46.41 ms 57.60 ms
bm25 lexical index 40.4% 194.05 ms 247.25 ms
local vector mesh 70.7% 9.56 ms 11.44 ms
in-memory fast path n/a 0.082 ms 0.15 ms
3
u/paul_h Oct 27 '26
My Claude says of your post: “If you don't use tools, MCPs, or agent setups, none of this affects you. It's an optimization for people building AI systems that juggle lots of tools.”
2
u/Kamikx Oct 27 '26
I just don’t use mcps. GitHub CLI for GitHub. For Postgres you just use psql and if you really want to be careful - a secret forward proxy. For slack you have no choice, and for the filesystem you don’t use anything.
Go the extra mile and run your agents in an Ubuntu container using the gvisor runtime for extra isolation.
2
u/Anreall2000 Oct 28 '26
https://arxiv.org/abs/2505.03275
eh? Just RAG-MCP? Also yeah, why only one tool in resp, you believe in your embeddings so much?
1
u/Unusual-Dinner6355 Oct 28 '26 edited Oct 28 '26
honestly the main reason pure BM25 choked in your benchmark is probably because raw JSON schemas repeat the same boilerplate parameter names (namespace, region, id, type, timeout) across thousands of tools, so lexical scoring just collides on those.
if you strip the parameter schemas out of the BM25 index and only index the tool name + short description alongside local embeddings, hybrid search holds up way better without needing a cloud LLM call just to pick a tool.
1
u/Upper-Warthog5439 Nov 02 '26
Using an LLM for every routing decision can add latency and cost when a simpler retrieval method or deterministic rule would do the job. The important question is whether the routing actually requires reasoning or just matching a request to the right tool. For a large tool catalogue, a hybrid approach could make more sense: use lightweight retrieval to narrow the options and call a model only when the request is ambiguous. That also makes infrastructure planning easier when cloud workloads and services, including those associated with trusted tech, have to be accounted for.
0
u/MrMunchkin Oct 28 '26
It is clear you have a fundamental lack of understanding the MCP specification, and ultimately what they are used for.
MCP is not just a tool lookup. MCP is a predefined set of algorithms that ask the agent to give it SPECIFIC, VALIDATED and often versions requests.
You also SHOULD NOT be enabling MCP servers anywhere you don't actively need them.
Also...token caching. If your cloud provider isn't caching your MCP discovery then you are getting ripped off.
-5
u/[deleted] Oct 27 '26
[removed] — view removed comment