Yashveer Singh
Connect
<- All posts

RAG (Retrieval Augmented Generation) for SaaS: When It Helps and When It Does Not

Retrieval Augmented Generation (RAG) is an AI architecture pattern that combines a retrieval system (typically vector search over a document store) with a large language model. When a user asks a question, the system retrieves relevant documents from the store and includes them in the LLM prompt as context, allowing the model to generate answers grounded in specific documents rather than relying on training data alone. RAG is used when the answer depends on information that is proprietary, recent, or not in the LLM's training data.

Written by Yashveer Singh, founder of Yashveer Labs.

What you need to know

  • RAG is the right architecture when the answer depends on information not in the LLM's training data: proprietary documentation, recent events, company-specific knowledge.
  • RAG is the wrong architecture when the task is reasoning, code generation, summarization of provided text, or any task that does not require external factual lookup.
  • Retrieval quality determines answer quality. A RAG system with good generation but poor retrieval produces confident-sounding wrong answers.
  • Chunking strategy is the most underestimated implementation decision. Poor chunking degrades retrieval quality regardless of embedding model quality.
  • Start with a small, well-curated document corpus before scaling. A RAG system with 100 high-quality documents outperforms one with 10,000 poorly processed documents.

The core argument

RAG became the default recommendation for any AI feature involving proprietary knowledge. That created a generation of RAG implementations that are deployed where they should not be. A product that needs to summarize a user-provided document does not need RAG. A chatbot that answers questions about product features might need RAG, but only if those features change faster than model fine-tuning cycles. An AI assistant that answers support questions about a specific customer's account configuration absolutely needs RAG, because that information cannot be in any model's training data.

The distinction matters because RAG adds significant complexity. The system now has two quality surfaces to maintain: the document corpus (which must be current, accurate, and well-processed) and the generation layer (which must produce coherent answers from retrieved context). Teams that add RAG without this complexity being necessary end up maintaining infrastructure that does not improve the product and introduces new failure modes like outdated documents producing incorrect answers with high confidence.

When RAG is the right choice, the implementation decisions that matter most are: the chunking strategy for the document corpus, the embedding model used for both documents and queries, the retrieval strategy (dense retrieval, sparse retrieval, or hybrid), and the prompt structure that presents retrieved documents to the model. In my experience working on knowledge base search features for Velmora, the chunking strategy had more impact on answer quality than the choice of embedding model. Semantic chunking that preserved paragraph boundaries outperformed fixed-size chunking by a significant margin on the evaluation set.

Common mistakes

  1. Using RAG for tasks that do not require factual retrieval. A summarization feature that summarizes a document the user just uploaded does not need to retrieve anything. The document is already in the context. Adding retrieval to tasks that do not benefit from it adds latency, cost, and complexity for no quality improvement.
  1. Not building an evaluation set before implementing. RAG quality is hard to assess subjectively. "The answers look better" is not a reliable signal. Build a test set of 20 to 50 representative questions with expected answers before implementing, and use it to measure quality changes objectively as the system evolves.
  1. Using fixed-size character chunking. Splitting documents every 500 characters produces chunks that cut sentences in the middle, split code blocks, and separate headings from their content. Semantic chunking that respects document structure (paragraphs, sections, list items) produces better embeddings and better retrieval.
  1. Not handling retrieval failures gracefully. When the retrieval step returns no relevant documents (the question is outside the corpus), the model should acknowledge this rather than hallucinate an answer. The prompt must include instructions for handling low-relevance retrieved context. A RAG system without this handling produces confident wrong answers when the answer is not in the corpus.
  1. Embedding queries and documents differently. Query text and document text often have different linguistic patterns. A question and a document paragraph that cover the same topic may have low cosine similarity if one is phrased as a question and the other as a statement. Embedding models trained specifically for asymmetric retrieval (query-to-document) address this. Using a symmetric embedding model produces lower recall on question-answering tasks.

Where to start

  1. Define the specific knowledge gap the RAG system will fill. Write down what information is not in the LLM's training data that the system needs to answer correctly. If this list is empty or trivially small, RAG is not necessary. If the list contains substantial proprietary or frequently updated information, RAG is justified.
  1. Build the document corpus before the retrieval pipeline. Identify the source documents, process them into clean text, and assess the quality of the processed content manually before writing any embedding code. A corpus of 50 clean, well-structured documents is better than 500 documents with inconsistent formatting and duplicate content.
  1. Implement retrieval and generation as separable components with independent evaluation. Log the retrieved documents alongside the generated answer for every query. This allows debugging retrieval quality and generation quality independently. When an answer is wrong, the log shows whether the right documents were retrieved (generation failure) or not (retrieval failure), which determines the fix.

Related reading

FAQ

Frequently asked

Author

The reason I write these

I write these because the writing is the proof. Yashveer Singh, founder of Yashveer Labs. The systems I build are not theoretical. They are running right now, serving real users, generating real revenue. That is the bar I hold this writing to. If you want to hire someone who can match that bar, I am the call.

Related reading