> Markdown version of [/videos/1714-reducing-llm-calls-with-vector-search-patterns-raphael-de-lio-redis?t=1159](https://www.wearedevelopers.com/videos/1714-reducing-llm-calls-with-vector-search-patterns-raphael-de-lio-redis?t=1159). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Reducing LLM Calls with Vector Search Patterns - Raphael De Lio (Redis) Are massive context windows making your AI agents slow and costly? Discover how to replace direct LLM calls with Redis vector search patterns to drastically reduce compute overhead. - **Speakers:** - **Event:** - **Published:** August 27, 2025 - **Duration:** 34:39 - **URL:** https://www.wearedevelopers.com/videos/1714-reducing-llm-calls-with-vector-search-patterns-raphael-de-lio-redis ## Summary As LLMs natively support massive context windows, developers often rely on them for every operation—but processing millions of tokens for routine functions is slow and expensive. Emphasizing that "just because you can, doesn't mean you should," this approach explores how developers can optimize agentic applications and chatbots by substituting direct LLM calls with vector search patterns using Redis. By embedding reference concepts into a vector database, systems can perform mathematical similarity checks to resolve user intent faster and more affordably. The broader strategy relies on three core techniques: semantic classification, semantic routing, and semantic caching. Semantic classification streamlines text labeling by comparing user input against embedded reference queries rather than triggering an LLM. Similarly, semantic routing uses similarity thresholds to trigger API tools or enforce guardrails (such as blocking out-of-scope topics) directly from the application layer. Finally, semantic caching stores responses for previously computed prompts, relying on vector proximity to recognize rephrased questions and return answers in milliseconds instead of seconds. Fine-tuning these models is critical to maintaining operational accuracy. Tools like the Redis Retrieval Optimizer allow developers to automatically tune distance thresholds for embedded routes instead of guessing by trial and error. Furthermore, edge cases like negated concepts or complex, multi-clause prompts can be mitigated by chunking inputs and deploying specialized embedding models. By implementing a hybrid fallback architecture—adding successfully routed queries back to the database as new references, and deferring to the LLM only on low-confidence matches—organizations can build compounding accuracy while drastically cutting infrastructure wait times and compute costs. **Keywords:** vector search patterns, semantic caching, semantic routing, semantic classification, llm cost optimization, agentic applications, vector database, redis vector library, similarity threshold tuning, embedding models, zero-shot classification, prompt chunking, ai chatbot guardrails, llm caching strategies, redis retrieval optimizer ## Chapters 1. **Avoiding high costs with large language model context windows** (00:02) — Large context models remain expensive and slow, necessitating vector search patterns for efficiency. 1. **Encoding textual meaning into numerical vector representations** (02:53) — Embedding models convert text into discrete numerical vectors to allow engines to compute semantic similarities. 1. **Classifying text rapidly using reference embedding generation** (05:24) — Pre-generating and storing embedded text references enables fast vector similarity searches for classification tasks. 1. **Demonstrating semantic routing thresholds with the Redis vector library** (10:09) — Implementing categorical text classification using a Python vector library relies on customizable distance thresholds. 1. **Triggering specific application tools through explicit semantic routes** (14:05) — Mapping user intents directly to application tools via vector databases bypasses redundant language model inferences. 1. **Establishing guardrails and block lists using semantic routing** (17:08) — Routing predefined prohibited subjects to block lists prevents irrelevant or dangerous prompts from consuming processing resources. 1. **Reusing language model responses through semantic database caching** (19:19) — Vectorizing user prompts allows applications to surface previously computed responses for semantically identical questions. 1. **Demonstrating semantic latency reductions using Spring AI configurations** (21:07) — Integrating vector databases into application frameworks dramatically reduces repeated prompt latency by retrieving cached data alongside embeddings. 1. **Tuning thresholds and improving accuracy with automated optimizer tools** (24:45) — Combining automated threshold testing with hybrid language model fallbacks refines similarity search precision continuously. 1. **Improving tool calling accuracy by chunking complex user prompts** (28:33) — Splitting verbose queries into discrete clauses ensures accurate vector matching and reliable downstream tool execution. 1. **Addressing caching pitfalls with specialized tools and managed services** (31:34) — Training specific embedding models and mixing semantic routers with caching prevents contradictory logic and enhances relevance. ## Related Moments - [Mitigating language model costs with vector search patterns](https://www.wearedevelopers.com/videos/1709-wearedevelopers-live-vector-similarity-search-patterns-for-efficiency-and-more) (from "WeAreDevelopers LIVE - Vector Similarity Search Patterns for Efficiency and more") - [Optimizing tool calling in chatbots with semantic routing](https://www.wearedevelopers.com/videos/1709-wearedevelopers-live-vector-similarity-search-patterns-for-efficiency-and-more) (from "WeAreDevelopers LIVE - Vector Similarity Search Patterns for Efficiency and more") - [Using semantic caching and pre-generated audio](https://www.wearedevelopers.com/videos/1158-performant-architecture-for-a-fast-gen-ai-user-experience) (from "Performant Architecture for a Fast Gen AI User Experience") - [Architecting a semantic long-term memory system for LLMs](https://www.wearedevelopers.com/videos/830-what-comes-after-chatgpt-vector-databases-the-simple-and-powerful-future-of-ml) (from "What comes after ChatGPT? Vector Databases - the Simple and powerful future of ML?") - [Applying software engineering principles to optimize LLMs](https://www.wearedevelopers.com/videos/1156-lessons-learned-building-a-genai-powered-app) (from "Lessons Learned Building a GenAI Powered App") - [Optimizing server architecture for scalable large language model operations](https://www.wearedevelopers.com/videos/2088-plan-to-link-your-llm-to-your-production-database-what-could-possibly-go-wrong) (from "Plan to link your LLM to your production database? What could possibly go wrong?") ## Related Articles - [Introducing Redis Agent Memory Server](https://www.wearedevelopers.com/magazine/699-introducing-redis-agent-memory-server) - [What Are Large Language Models?](https://www.wearedevelopers.com/magazine/304-what-are-large-language-models) - [Graph and AI Trends 2026: Why Is AI Running but Not Yet Delivering?](https://www.wearedevelopers.com/magazine/680-graph-and-ai-trends-2026-why-is-ai-running-but-not-yet-delivering) - [MLOps And AI Driven Development](https://www.wearedevelopers.com/magazine/82-mlops-and-ai-driven-development) ## Related Jobs - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/353953-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/319507-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [Principal Engineer - AI Search & Vector Infrastructure](https://www.wearedevelopers.com/jobs/ext/381484-principal-engineer-ai-search-vector-infrastructure) at **Redis** - [AI Software Engineer (Germany)](https://www.wearedevelopers.com/jobs/48317-ai-software-engineer-germany) at **Sunhat** - [Golang Software Engineer](https://www.wearedevelopers.com/jobs/ext/1652471-golang-software-engineer) at **Redis** - [Machine Learning Engineer](https://www.wearedevelopers.com/jobs/ext/588393-machine-learning-engineer) at **Twilio**