Back office ops · Production

Semantic multi-component embeddings with Redis reduce LLM token consumption by 91% in enterprise tool selection

The problem

An enterprise AI platform with 70+ automated tools was sending all tool definitions to the LLM on every query, consuming over 8,000 tokens per request, causing spiralling costs, slower responses, and irrelevant tool suggestions.

First attempt

Keyword matching and category filtering failed to bridge the vocabulary gap between natural language queries and technical tool names, and could not disambiguate context-dependent queries.

Workflow diagram · grounded in source
1
User query arrives
trigger
“Every user query was sending all 70 tool definitions to the model, consuming over 8,000 tokens per request—even when users only needed 2-3 relevant tools”
2
Query embedding generated
ai_action
“# Generate query embedding”
3
Multi-component vector search
ai_action
“Search across all component types”
4
Weighted relevance scoring
ai_action
“The relevance scoring combines semantic similarity with practical factors”
5
Adaptive tool selection
ai_action
“Rather than returning a fixed number of tools, the system uses adaptive selection based on score distribution”
6
Minimal tool set sent to LLM
output
“Sent only 3 most relevant tools (638 tokens)”
Reported outcome

Semantic tool selection with multi-component embeddings and Redis vector search reduced token consumption by 91.5% and cost per query by 49%, while improving Precision@3 to 95% and delivering 31% faster response times.

Reported metrics
Token usage reduction91.5%
Cost reduction per query49%
Average input tokens per query (before)7,244
Average input tokens per query (after)198
Show all 16 reported metrics
token usage reduction91.5%
cost reduction per query49%
average input tokens per query (before)7,244
average input tokens per query (after)198
cost per query (before)$0.0118
cost per query (after)$0.0060
Precision@3 (after)95%
Recall@5 (after)90%
Mean Reciprocal Rank (after)0.88
response time improvement31% faster
cache hit rate60%
annual cost savings$20,880
tool library size70+
tokens per request before (stated)over 8,000
tokens in example query before7,433
tokens in example query after638
Reported stack
Redis Stacktext-embedding-3-small
Source
https://mlops.community/blog/how-i-reduced-ai-token-costs-by-91percent-with-semantic-tool-selection-and-redis
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

Semantic tool selection with multi-component embeddings and Redis vector search reduced token consumption by 91.5% and cost per query by 49%, while improving Precision@3 to 95% and delivering 31% faster response times.

What tools did this team use?

Redis Stack, text-embedding-3-small.

What results were reported?

Token usage reduction: 91.5%; Cost reduction per query: 49%; Average input tokens per query (before): 7,244; Average input tokens per query (after): 198 (source-reported, not independently verified).

What failed first in this deployment?

Keyword matching and category filtering failed to bridge the vocabulary gap between natural language queries and technical tool names, and could not disambiguate context-dependent queries.

How is this back office ops AI workflow structured?

User query arrives → Query embedding generated → Multi-component vector search → Weighted relevance scoring → Adaptive tool selection → Minimal tool set sent to LLM.