Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Turbo RAG: AI-basierte Retriever-Auswahl mit Se...

Turbo RAG: AI-basierte Retriever-Auswahl mit Semantic Router

Retrieval Augmented Generation (RAG) verwendet Daten aus Retrieval-Systemen wie Vector-DBs, um die relevanten Informationen zur Beantwortung einer Benutzeranfrage zu finden.

In Real-World-Szenarien geht es häufig um mehrere Quellen (Retriever) mit unterschiedlichen Datenarten. Um den zu einer User-Frage passenden Retriever auszuwählen, können wir eine MultiRoute-Chain nutzen. Hierbei wählt das LLM dynamisch die semantisch am besten passende Datenquelle für die Suche. Allerdings verlängert dieser Ansatz die Antwortzeit unseres AI-Workflows und kostet Tokens - also Geld.

Geht das auch schneller und günstiger? Ja! Ein Semantic Router nutzt für die Quellenauswahl kein LLM, sondern ein Embedding-Modell. Dieser Ansatz liefert eine mit einem LLM vergleichbare Qualität bei der Quellenauswahl und ist dabei deterministisch - jedoch in Millisekunden und zu einem Bruchteil der Kosten.

Mit Live-Coding implementieren wir in einem Sample unter Verwendung des LangChain-Frameworks zuerst eine klassische MultiRoute-Chain und optimieren dann auf eine Variante mit der OpenSource-Library Semantic Router. Letztendlich zeigen beide Ansätze, wie die Leistung von RAG bei der Beantwortung von Benutzeranfragen deutlich verbessert werden kann.

Marco Frodl

March 11, 2025
Tweet

More Decks by Marco Frodl

Other Decks in Technology

Transcript

  1. Basta Spring 2025 Turbo RAG: AI-basierte Retriever-Auswahl mit Semantic Router

    Marco Frodl [email protected] Principal Consultant for Generative AI @marcofrodl
  2. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router About Me Marco

    Frodl Principal Consultant for Generative AI Thinktecture AG X: @marcofrodl E-Mail: [email protected] LinkedIn: https://www.linkedin.com/in/marcofrodl/ https://www.thinktecture.com/thinktects/marco-frodl/
  3. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Turbo 🚀 https://www.aurelio.ai/semantic-router

    Semantic Router is a superfast decision-making layer for your LLMs and agents. Rather than waiting for slow, unreliable LLM generations to make tool-use or safety decisions, we use the magic of semantic vector space — routing our requests using semantic meaning.
  4. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Turbo 🚀 https://www.aurelio.ai/semantic-router

    Semantic Router is a superfast decision-making layer for your LLMs and agents. Rather than waiting for slow, unreliable LLM generations to make tool-use or safety decisions, we use the magic of semantic vector space — routing our requests using semantic meaning. It’s perfect for: input guarding, topic routing, tool-use decisions.
  5. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Turbo 🚀 in

    Numbers In my RAG example, a Semantic Router using remote services is 3.4 times faster than an LLM and it is 30 times less expensive. A local Semantic Router is 7.7 times faster than an LLM and it is 60 times less expensive.
  6. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Refresher: What is

    RAG? “Retrieval-Augmented Generation (RAG) extends the capabilities of LLMs to an organization's internal knowledge, all without the need to retrain the model.
  7. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Refresher: What is

    RAG? https://aws.amazon.com/what-is/retrieval-augmented-generation/ “Retrieval-Augmented Generation (RAG) extends the capabilities of LLMs to an organization's internal knowledge, all without the need to retrain the model. It references an authoritative knowledge base outside of its training data sources before generating a response”
  8. Ask me anything Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router

    Simple RAG Question Prepare Search Search Results Question Answer LLM Vector DB Embedding Model Question as Vector Workflow Terms - Retriever - Chain Elements Embedding- Model Vector- DB Python LLM LangChain
  9. Best source determination before the search Turbo RAG AI-basierte Retriever-Auswahl

    mit Semantic Router Advanced RAG Question Retriever Selection 0-N Search Results Question Answer LLM Embedding Model Vector DB A Question as Vector Vector DB B LLM Prepare Search or
  10. Best source determination before the search Turbo RAG AI-basierte Retriever-Auswahl

    mit Semantic Router Advanced RAG Question Retriever Selection 0-N Search Results Question Answer LLM Embedding Model Vector DB A Question as Vector Vector DB B LLM Prepare Search or
  11. Best source determination before the search Turbo RAG AI-basierte Retriever-Auswahl

    mit Semantic Router Advanced RAG w/ Semantic Router Question Retriever Selection 0-N Search Results Question Answer Embedding Model Vector DB A Question as Vector Vector DB B LLM Prepare Search or Embedding Model
  12. Turbo RAG AI-basierte Retriever-Auswahl mit Semantic Router Speed & Budget

    in Numbers SR Remote is 3.4 times faster than LLM (0,62s vs 0,18s) SR Local is 7.75 times faster than LLM (0,62s vs 0,08s) SR Remote is 30 times cheaper than LLM ($0,60 vs $0,02) SR Local is 60 times cheaper than LLM ($0,60 vs $0,01)