RAG Explained: Embeddings, Sentence BERT, and HNSW Vector Databases

Added:

LLM Basics
Fine-tuning Limits
RAG Pipeline
Embeddings Intro
Sentence Embeddings
Sentence-BERT
Vector DB Search
NSW Algorithm
HNSW Search
RAG Recap

LLM Basics

2:00
Playing Section
  • 1

    Explains language models as probabilistic text predictors trained on large corpora.

  • 2

    Discusses the limitations of fixed training data and the need for knowledge augmentation.

Basic understanding of Natural Language Processing (NLP) and how Large Language Models (LLMs) generate and process text.
Fundamental concepts of vector spaces and how words or sentences can be represented as high-dimensional numerical vectors (embeddings).
Familiarity with the Transformer architecture, specifically how the BERT (Bidirectional Encoder Representations from Transformers) model functions.
Core mathematical concepts of similarity metrics, such as Cosine Similarity, Dot Product, and Euclidean Distance.
Advanced RAG paradigms, including Query Rewriting, Hypothetical Document Embeddings (HyDE), and two-stage retrieval using Cross-Encoder Re-rankers.
Fine-tuning Sentence-BERT (SBERT) and bi-encoders on domain-specific datasets to improve retrieval accuracy.
Evaluating RAG pipeline performance quantitatively using frameworks like Ragas or TruLens (measuring faithfulness, answer relevance, and context recall).
Production-level vector database administration, exploring alternative indexing methods (like IVF-PQ) and scaling solutions in databases like Qdrant, Milvus, or Pinecone.
84.9K views2.8Klikes49:24@umarjamilaiOriginal Release: 2023-11-27

Retrieval Augmented Generation (RAG) is a technique that enhances language models by integrating external knowledge retrieval through a pipeline: documents are split into sentences, converted to embedding vectors using models like Sentence BERT, stored in a vector database (often using HNSW algorithm for efficient similarity search), and queried by converting the question to an embedding; the top matching documents are retrieved, combined with the query in a prompt template, and fed to a language model to generate answers, thereby augmenting the model's knowledge without retraining.