RagSys: RAG is just RecSys in Disguise

Chang She, LanceDB12:45 · Apr 2024 · 662 views
Thumbnail for RagSys: RAG is just RecSys in Disguise Watch on YouTube
TL;DR
  1. 1

    Retrieval quality becomes a production concern when incorrect context can lead an AI system to produce costly errors.

  2. 2

    RAG pipelines resemble recommender systems because chunking works like feature engineering, retrieval methods work like recallers, and reranking selects the context passed to the language model.

  3. 3

    Hybrid search and reranking can improve retrieval, while user feedback and synthetic data can support later embedding-model fine-tuning.

Summary

Chang She argues that production RAG has more in common with recommender systems than many teams acknowledge. A RAG pipeline experiments with chunking, embedding models, full-text search, vector search, and reranking in much the same way that a recommender system builds features, gathers candidates, and ranks them. He demonstrates this with LanceDB using an Airbnb SEC filing, showing how hybrid search combines vector and full-text scores, then how a Cohere reranker surfaces context about international operations in China. Chang also points to feedback as the next step for improving RAG retrieval, including an example where synthetic data was used to fine-tune an embedding model. He is careful about the limits of the analogy. RAG has a generation step, relevance is tied to a question rather than a user, and small rank differences may matter less when several retrieved passages fit within the context window.

Key ideas
02:26

Production RAG depends on retrieval accuracy

Chang describes RAG as an open-book exam that extends a model's knowledge without changing the model. Building a demo is easy, but production systems depend on retrieving the right material. He gives an example of someone writing 500 basis points when they meant 50, after which a company's stock fell when the error was corrected. That example raises difficult questions about responsibility when an AI application makes a similar mistake. Chang's practical conclusion is that retrieval quality and accuracy matter before the retrieved context reaches the language model.

03:19

RAG retrieval looks like a recommender pipeline

Chang maps common RAG choices onto recommender-system concepts. Chunking experiments resemble feature engineering. Embeddings from different sources and full-text, SQL, or graph search act like recall methods that gather candidates. The system then combines those results and reranks them before producing an answer. In a content recommender, the analogous inputs can include user history, content metadata, demographics, posters, and subtitles. The final ranked output might determine what appears in a Netflix home grid or an Amazon product list.

04:34

LanceDB supports a hybrid search workflow

Chang walks through a notebook using an Airbnb financial dataset. A PDF loader reads an SEC filing, a recursive character splitter breaks it into chunks, and LanceDB stores the page content with vectors generated through an OpenAI embedding model. A vector query asks which factors contributed to Airbnb's increased operating expenses in the last fiscal year. Hybrid search adds a full-text index over the page content and combines normalized vector and text-search scores into a relevance score.

06:45

Full-text search can change the retrieved evidence

The vector-only search returns relevant material about financial headwinds. When Chang switches to hybrid search, the second result changes and includes a passage about a contractor delivering a pricing certificate. The phrase "fiscal year" in the query helps full-text search find that passage. The example shows why combining semantic similarity with exact text matching can alter which evidence reaches the next stage of the RAG pipeline.

08:00

Rerankers can surface more direct context

LanceDB supports several reranking approaches. Chang says the Cohere reranker performed best in his example without fine-tuning, and the API keeps a similar data-frame structure while changing the scores and contents. When he compares responses generated from vector-search context with responses generated from Cohere-ranked context, the latter identifies international operations, particularly in China, as the main factor. He also mentions ColBERT, cross-encoder, and OpenAI-based rankers, plus custom rankers that users can write and plug into the search process.

09:53

Feedback can improve retrieval over time

Chang says recommender systems improve through use because they collect feedback, and RAG systems are beginning to use the same idea. He cites a user who used about $10 of synthetic data to fine-tune an embedding model and make it better than generic best-in-class embedding models for the task. He presents feedback and task-specific training as an area LanceDB plans to work on next.

10:40

The recommender analogy has limits

Chang says RAG and recommender systems are not identical. RAG adds a generation step. Recommender relevance is defined for a particular user, while RAG relevance is defined for a particular question. Ranking precision can matter greatly on a recommender home page, whereas the difference between first, second, and third may matter less in RAG when the top passages all fit inside the model's context limit. The analogy remains useful for borrowing ideas, but quality measurement must account for these differences.

"With RAG, it's sort of the open-book exam of AI where you can extend the model knowledge without having to touch the model itself."02:26
Who should watch
  • You are building a RAG system and need to decide whether vector search alone is enough for production retrieval.
  • You work on search or recommendations and want a concrete mapping between recall, feature engineering, hybrid search, and reranking.
  • You want an example of using LanceDB with document chunks, embeddings, full-text search, and configurable rerankers.