WhoBuilt

The RAG Stack We Landed On After 37 Fails

Jun 3, 2025· 19 min· 12K views·Watch on YouTube

Speaker

Independent AI engineer Jonathan Fernandes shares the RAG stack he settled on after 37 failed attempts, including how he prototypes in Google Colab and deploys production systems, often on premises for financial institutions.

The stack for prototyping and production

Fernandes breaks the stack into orchestration, embeddings, vector storage, language models, monitoring, reranking, and evaluation. He prototypes in Google Colab and often uses Docker for production, where financial institutions may require data and processing to stay on premises. His choices include LlamaIndex, Qdrant, Arize Phoenix, and Ragas, with open models favored for production embeddings and reranking.

How basic RAG retrieves an answer

Using a railway company’s HTML knowledge base, Fernandes frames a question: where to get help in London. Basic RAG embeds the query, retrieves relevant documents from a vector database, then sends the documents and question to a language model. With LlamaIndex and an in-memory database, the first answer points to accessible black cabs, which misses the more useful station assistance information.

Why retrieval needs two kinds of encoders

Fernandes describes query processing and post-retrieval as ways to improve a RAG pipeline. A bi-encoder embeds queries and documents separately, making similarity search fast enough to compare a query against many documents. A cross-encoder compares a query with individual documents more accurately but is slower, so he places it after retrieval as a reranker.

Improve results with embeddings and reranking

He replaces the in-memory vector store with Qdrant and swaps the default embedding model for BAAI BGE-small. Changing the language model and embeddings improves the response, but it still misses the best source. Reranking the top five retrieved results with Cohere produces a more relevant answer: help is available at booth five near the Eurostar gates at London St Pancras International.

Evaluate and deploy the pipeline

Fernandes recommends tracing tools such as Arize Phoenix or LangSmith to see where pipeline time is spent, and Ragas to evaluate answers across more than one query. For production, he outlines Docker Compose containers for data ingestion, Qdrant, a front end, model serving through Ollama or Hugging Face Text Generation Inference, Phoenix, and Ragas. He expects to use open models from BAAI or NVIDIA for embeddings and reranking.

Takeaways

  • Inspect retrieved source documents when an answer seems wrong; the model may be using irrelevant context.
  • Use bi-encoders for broad, scalable retrieval and cross-encoders to rerank a smaller set of results.
  • Test embedding and language model choices against your actual knowledge base and questions.
  • Trace component timings and evaluate across many questions before relying on a RAG system in production.
  • Choose deployment tools around operational needs: Fernandes uses Docker for on-premises environments and favors open models there.

Mentioned in this talk

Search inside this talk

What was claimed 16

Related talks