section A-resources
01 AI Vendor & Technology Evaluation 03 RAG Types 04 From Wireframes to Prototypes — Bringing Blueprints to Life for Testing & Alignment 05 Wireframing in the Age of GenAI — Why, How, and When Human Blueprinting Still Reigns Supreme 06 Applied Pricing Strategies — From Cloud Giants to Retail Titans 07 Decision Architecture — Designing Choices That Empower Users (and Drive Results) 08 Behavioral Economics in Product — Designing Ethical Nudges That Drive Value 09 Retention Engineering — Build Products Users Can't Quit 10 Subscription Models — Building Predictable, Recurring Revenue Machines 11 Pricing Strategies — Mastering the Art & Science of Value Capture 12 Self-Service Workshop: Mastering the Product Lifecycle (Vision to Launch) 13 Mastering the Product Lifecycle — From Vision to Impactful Launch 14 How to Figure Out Trade-offs When Prioritizing — Balancing Strategy, Value, and Reality 15 Resource Guide: Lewis C. Lin — Mastering Interviews, LinkedIn & Negotiation 16 Ecosystem Strategies — Building Platforms That Lock In Value and Lock Out Competitors 17 Product-Market Fit 201 — Diagnose, Iterate, and Scale Beyond “Good Enough” 18 The Three Levels of a Product — From Core Need to Delightful Experience 19 Tokens, Context Windows, and Scaling Laws 20 GenAI Architecture — Mastering RAG (Retrieval-Augmented Generation) 21 Ethical Considerations in AI — Building Tech That Does Good (and Avoids Disaster) 22 Team Dynamics — Turn Silos into Synergy and Conflict into Collaboration 23 Leadership Skills — Inspire Teams & Drive Results Without Formal Authority 24 Tools Used in PRDs — Write Requirements Engineers Actually Love (and Follow) 25 Preparing for and Executing a Product Hunt Launch 26 Impactful Launches — Make Your Product the Talk of the Town (Without a Super Bowl Ad) 27 Market Timing — Launch When the World Is Ready (But Not Too Ready) 28 QA (Quality Assurance) — Build Quality In Without the Drag 29 Product Execution — Ship Fast and Reliably Without Breaking Your Team (or Product) 30 A/B Testing — Let Data Drive Decisions, Not Opinions 31 No-Code Tools — Build Faster, Validate Smarter, Maybe Even Launch an Empire 32 Go-to-Market Strategies — Launch Like a Navy SEAL (Precision, Speed, Impact) 33 North Star Metric — Aligning Your Team Around the One Metric That Matters 34 Product Revitalization — How to Breathe New Life into a Zombie Product 35 Scalability Strategies 36 Customer Success — Turning Support Tickets into Growth Engines 37 Strategic Negotiation Techniques 38 Crossing the Chasm 39 Prototyping - The Pragmatic Sprint 40 UX Design - Decoding Good vs. Bad Design 41 User Engagement - The Pragmatic Sprint 42 Solution Architect role 101 43 Solution Architect Role 102 44 Van Westendorp Pricing Model 46 Product-Market Fit 101 47 Mom Test 49 Stakeholder Management 51 Mastering Trade-offs 52 Go To Market (GTM) Resources 53 How to do Conjoint Analysis 54 Core Financial Strategies in Product Management 56 Product Management Terms & Jargons Courses / section A-resources GenAI Architecture — Mastering RAG (Retrieval-Augmented Generation) Section
section A-resources
genai architecture — mastering rag (retrieval-augmented generation) · 0% 15 min left Aa ✕
← 1 / 1 →
Case Study: Perplexity.ai - RAG as a Core Differentiator Perplexity.ai rapidly gained traction and a $1B+ valuation by positioning itself as an "answer engine" directly challenging traditional search and base LLMs like ChatGPT. RAG is fundamental to their success: - The Problem They Solved: Users found ChatGPT incredibly capable but often lacked up-to-date information and couldn't cite its sources, making it unreliable for factual queries. - Their RAG Strategy: 1. Hybrid Search at Scale: Implemented sophisticated retrieval combining semantic understanding (vector search) with precise keyword matching across a massive index of web pages, academic papers (arXiv), news sources, etc. 2. Real-Time Information Access: Integrated live web search capabilities, ensuring answers could incorporate breaking news and current events, overcoming the LLM knowledge cut-off. 3. Focus on Summarization with Citations : Their LLM is specifically prompted and possibly fine-tuned not just to answer questions but to synthesize information from retrieved sources and prominently display citations/links back to those sources, building user trust. 4. Iterative Refinement: Likely employs advanced RAG techniques (re-ranking, potentially iterative steps) to ensure the quality and relevance of sources before generation. - Result: A user experience centered on accurate, up-to-date, and verifiable answers, attracting millions of users seeking reliable information and positioning Perplexity as a serious contender in the information discovery space. Their success is built on executing RAG exceptionally well. ---
Previous ← Tokens, Context Windows, and Scaling Laws Next Ethical Considerations in AI — Building Tech That Does Good (and Avoids Disaster) → // on this page the multi-million dollar hallucination & the rag rescue mission imagine launching an innovative ai-powered chatbot for your healthcare startup, designed to provide helpful information to patients based on a vast medical knowledge base. excitement is high. then, disaster strikes. the chatbot starts "hallucinating" – confidently inventing incorrect drug dosage recommendations or misinterpreting symptoms based only on patterns learned during its initial training, detached from factual medical literature. a patient follows the wrong advice. a lawsuit follows. trust evaporates. the company faces ruin. this isn't science fiction; scenarios like this became terrifyingly real for early adopters of pure large language models (llms) in high-stakes domains. one such company, facing precisely this crisis in 2023 after their initial chatgpt-like tool exhibited dangerous inaccuracies (accuracy hovering around a dismal 65%), had to pull the plug. their solution? rebuilding the entire backend using retrieval-augmented generation (rag). by forcing the ai to base its answers specifically on information retrieved in real-time from approved medical journals, internal clinical guidelines, and anonymized patient record summaries, accuracy soared to over 95%. the lawsuit was settled, trust began to rebuild, and the business was saved. moral: for ai applications where factual accuracy, timeliness, and verifiability are paramount, relying solely on a base llm's pre-trained knowledge is often insufficient and potentially dangerous. rag isn't just a fancy add-on; it's a fundamental architectural pattern essential for building ai products that deliver reliable, trustworthy information grounded in real-world data, moving beyond plausible-sounding fiction to verifiable fact. --- why rag is a pm's crucial ally in building responsible ai as a product manager navigating the ai landscape, understanding rag is critical because it directly addresses core challenges of llms and unlocks significant product advantages: 1. dramatically improved accuracy & reduced hallucinations: this is the primary driver. base llms often "hallucinate" or confabulate answers because they are optimized to generate probable text sequences based on their training data, not necessarily factual information from a specific, current source. rag forces the llm to base its response on retrieved evidence, significantly reducing the likelihood of factual errors and making the output more reliable. think of it as an "open-book exam" (rag) versus a "closed-book exam" relying only on memorization (base llm). 2. access to real-time & proprietary knowledge: llms have a knowledge cut-off date based on their training data. they don't know about recent events, product updates, or your company's internal documents. rag allows the ai to access and incorporate up-to-the-minute information from specified knowledge bases (databases, document repositories, apis, websites), making responses timely and relevant. 3. increased trust & transparency: rag systems can (and should) be designed to cite their sources. providing users with links or references to the specific documents or data points used to generate an answer allows them to verify the information, building trust and transparency, which is crucial in domains like finance, legal, healthcare, and customer support. 4. cost-effectiveness & faster knowledge updates: fine-tuning a massive llm on new domain knowledge can be computationally expensive and time-consuming. with rag, updating the ai's knowledge often involves simply adding new documents to the knowledge base and re-indexing – a much faster and cheaper process than retraining the entire model. 5. personalization & contextualization: rag can retrieve information specific to a user (e.g., past support tickets, account details, user preferences) to generate highly personalized and contextually relevant responses, improving the user experience dramatically. shift your mindset: stop thinking of llms as just creative text generators. start thinking about how to ground their generative power with factual, relevant, and up-to-date information using rag to build truly useful and reliable ai products. --- rag architecture 101: the core components & workflow at its heart, rag combines the strengths of information retrieval (finding relevant data) and large language models (generating human-like text). 1. the core components 1. knowledge base (the library): - what: this is the collection of information you want your ai to draw upon. it can be structured data (sql databases, csvs), semi-structured data (json, apis), or unstructured data (pdfs, word docs, html pages, transcriptions, knowledge base articles). - preparation is key: unstructured data usually needs preprocessing: - chunking: breaking down large documents into smaller, meaningful paragraphs or sections (chunks). this helps the retriever find specific relevant pieces. chunking strategy (size, overlap) significantly impacts performance. - embedding: converting text chunks into numerical representations (vectors) using an embedding model (e.g., openai's text-embedding-ada-002, sentence-transformers models like all-minilm-l6-v2). these vectors capture semantic meaning, allowing searches based on concepts, not just keywords. - indexing: storing these embeddings (and often the original text chunks + metadata) in a specialized database optimized for fast similarity searches. - pm consideration: what are our trusted sources of truth? how will we keep this knowledge base up-to-date? what data formats do we need to handle? how will we manage access control/permissions? 2. retriever (the librarian): - what: this component takes the user's query and searches the indexed knowledge base to find the most relevant chunks of information. - common techniques: - dense retrieval (vector search): embeds the user query into a vector and finds the chunks whose embeddings are closest (most similar) in vector space. excellent for semantic relevance. tools: vector databases like pinecone, weaviate, milvus, chromadb, qdrant; libraries like faiss. - sparse retrieval (keyword search): uses traditional algorithms like bm25 or tf-idf to find chunks containing matching keywords. good for specific term matching. tools: elasticsearch, opensearch, built-in database full-text search. - hybrid search: combines both dense and sparse methods to get the benefits of both semantic understanding and keyword precision. often yields the best results. - pm consideration: how do we define "relevance"? how many chunks should we retrieve (top-k)? do we need keyword matching, semantic matching, or both? how fast does retrieval need to be? 3. generator (the author): - what: this is a large language model (llm) like gpt-4, claude 3, llama 3, mistral large, etc. - its job: takes the original user query and the relevant chunks retrieved by the retriever, and synthesizes them into a coherent, human-readable answer. - prompt engineering is crucial: the prompt sent to the llm is carefully crafted to instruct it to base its answer only on the provided context (the retrieved chunks) and often to cite its sources. - example prompt snippet: context: [retrieved chunk 1 text] \\\\n [retrieved chunk 2 text] \\\\n ... \\\\n question: [user query] \\\\n answer the question based only on the provided context. if the context doesn't contain the answer, say 'i don't have enough information from the provided documents.' cite the source for each part of your answer. - pm consideration: which llm offers the best balance of capability, cost, latency, and safety for our use case? how do we design prompts to maximize accuracy and minimize hallucination? how do we handle cases where relevant information isn't found? 2. the basic rag workflow 1. user query input: user asks a question (e.g., "what are the side effects of drug x for patients with kidney disease?"). 2. query embedding (optional but common for vector search): the user query is converted into a vector embedding. 3. retrieval: the retriever searches the indexed knowledge base (using vector similarity, keyword matching, or hybrid search) for chunks relevant to the query vector or keywords. it returns the top-k most relevant chunks. 4. context augmentation: the retrieved chunks are combined with the original user query into a carefully crafted prompt for the llm. 5. generation: the llm receives the prompt (query + context) and generates an answer based primarily on the provided context. 6. post-processing (optional but recommended): the generated answer might be checked for factual consistency against the retrieved chunks, filtered for toxicity, and formatted with citations pointing back to the source documents/chunks. 7. final response: the user receives the generated answer, often with citations. (e.g., "common side effects include nausea [source: fda label sec 5.2] and headache [source: clinical trial xyz paper, pg 15]. dosage adjustments may be needed for severe kidney disease [source: internal guidelines doc abc].") --- types of rag architectures: choosing your level of sophistication rag isn't one-size-fits-all. implementations range from simple to highly complex. 1. naive rag (the starting point) - what: the most basic implementation following the core workflow: index -> retrieve -> generate. often uses standard chunking and basic top-k vector retrieval. - pros: relatively simple and fast to implement, good for initial proofs-of-concept. - cons: highly sensitive to retrieval quality – if irrelevant chunks are retrieved ("garbage in"), the llm generates poor answers ("garbage out"). struggles with complex queries or nuanced information needs. doesn't handle context well across multiple turns. - tools: basic pipelines built with langchain or llamaindex, using a vector store like chromadb or faiss, and a standard llm api call. - use case: internal q&a bots for static documentation (e.g., hr policies, simple technical docs) where queries are relatively straightforward. 2. advanced rag (optimizing retrieval & generation) - what: introduces techniques before and after the core retrieval step to improve the quality and relevance of the context provided to the llm. - key techniques: - pre-retrieval (query optimization): - query expansion: rewrites the user's query to be more effective for searching (e.g., using an llm to add synonyms, break down complex questions, generate hypothetical document excerpts that match the query intent). - query routing: directing the query to different indexes or retrievers based on its type (e.g., keyword search for specific terms, vector search for concepts, sql query for structured data). - during/post-retrieval (context optimization): - hybrid search: combining scores from keyword and vector search for better relevance. - re-ranking: retrieving a larger set of initial candidates (e.g., top 50) and then using a more sophisticated (but slower) model, often a cross-encoder, to re-rank the candidates and select the best top-k (e.g., top 5) to send to the llm. cohere rerank is a popular tool here. - contextual compression/filtering: removing redundant or irrelevant information from retrieved chunks before sending them to the llm. - pros: significantly improves accuracy (often 30-50%+ lift over naive rag) by providing cleaner, more relevant context to the llm. more robust to varied queries. - tools: frameworks like llamaindex and haystack offer modules for many of these techniques. integration with services like cohere rerank. - use case: most common production rag systems fall here. customer support chatbots needing access to dynamic knowledge bases, product documentation q&a, basic research assistants. 3. modular rag (building flexible, task-specific pipelines) - what: views rag not as a fixed pipeline, but as a collection of interchangeable modules (retrieval methods, llms, memory modules, post-processing steps) that can be combined and orchestrated in complex ways depending on the task. - key concepts: - swappable components: easily switch between different vector databases, keyword search engines, embedding models, or llms based on performance or cost needs. - diverse retrieval strategies: integrate retrievers that query structured databases (sql), call external apis, search graph databases, alongside standard document retrieval. - specialized modules: add components for conversation memory, fact-checking against external sources, toxicity filtering, data transformation, or task-specific reasoning steps. - agentic behavior: modules might decide which tool or retriever to use based on the query (similar to llm agents). - pros: highly flexible and adaptable to specific domain requirements and complex workflows. enables sophisticated reasoning and data integration. - tools: frameworks designed for modularity like haystack, langgraph (part of langchain), microsoft guidance, dspy (focuses on optimizing prompts/modules). - use case: enterprise applications requiring integration with multiple internal systems (e.g., financial report generation pulling data from sec filings api, internal sql databases, and real-time market data feeds). complex scientific research tools needing specialized ontologies (like umls for healthcare). 4. iterative rag / self-correcting rag (closing the loop) - what: implements loops where the system can refine its retrieval or generation based on intermediate results or detected issues. moves beyond a single retrieve-generate pass. - key techniques: - iterative retrieval: the llm first generates a preliminary answer. if the answer lacks sufficient detail or confidence, the system automatically generates new search queries to retrieve more specific information needed to improve the answer. (e.g., flare - forward-looking active retrieval). - self-correction / corrective rag (crag): the system includes a step to evaluate the relevance of retrieved documents or the factual consistency/hallucination level of the generated answer. if issues are detected (e.g., retrieved docs seem irrelevant, answer contradicts sources), it triggers a re-retrieval step with modified queries or filters out bad information before final generation. - pros: can achieve the highest levels of accuracy and robustness by actively seeking missing information or correcting its own mistakes. better handles ambiguous queries. - tools: requires more complex orchestration, often built using frameworks like dspy, advanced langchain agents/chains, or custom implementations. techniques are still evolving rapidly. - use case: high-stakes domains where accuracy is absolutely critical and errors are unacceptable. examples include legal research tools needing to find all relevant precedents, complex technical troubleshooting guides, or medical diagnostic support where missing information could be harmful. --- case study: [perplexity.ai](http://perplexity.ai/) - rag as a core differentiator [perplexity.ai](http://perplexity.ai/) rapidly gained traction and a $1b+ valuation by positioning itself as an "answer engine" directly challenging traditional search and base llms like chatgpt. rag is fundamental to their success: - the problem they solved: users found chatgpt incredibly capable but often lacked up-to-date information and couldn't cite its sources, making it unreliable for factual queries. - their rag strategy: 1. hybrid search at scale: implemented sophisticated retrieval combining semantic understanding (vector search) with precise keyword matching across a massive index of web pages, academic papers (arxiv), news sources, etc. 2. real-time information access: integrated live web search capabilities, ensuring answers could incorporate breaking news and current events, overcoming the llm knowledge cut-off. 3. focus on summarization with citations: their llm is specifically prompted and possibly fine-tuned not just to answer questions but to synthesize information from retrieved sources and prominently display citations/links back to those sources, building user trust. 4. iterative refinement: likely employs advanced rag techniques (re-ranking, potentially iterative steps) to ensure the quality and relevance of sources before generation. - result: a user experience centered on accurate, up-to-date, and verifiable answers, attracting millions of users seeking reliable information and positioning perplexity as a serious contender in the information discovery space. their success is built on executing rag exceptionally well. --- choosing the right rag type: a pm's decision guide match the complexity of your rag architecture to your product's needs and constraints: | factor | naive rag | advanced rag | modular rag | iterative rag | | --- | --- | --- | --- | --- | | accuracy needs | low (proof-of-concept) | medium to high | high (domain specific) | very high (critical) | | implementation speed | very fast (hours/days) | moderate (days/weeks) | slow (weeks/months) | very slow (months+) | | flexibility / customization | low | medium | high | very high | | development cost/effort | $ | $$ | $$$ | $$$$ | | maintenance overhead | low | medium | high | very high | | best for | internal tools, prototypes | most saas features, chatbots | enterprise apps, complex integrations | mission-critical systems (legal, medical) | guidance: start simple (naive or basic advanced rag) for validation and mvps. incrementally add sophistication (re-ranking, hybrid search, query expansion) as needed based on measured performance gaps and user feedback. only invest in highly complex modular or iterative rag if the use case absolutely demands the highest levels of accuracy and flexibility, and you have the resources to build and maintain it. --- evaluating your rag system: the pm's checklist you need objective ways to measure if your rag system is actually working well. 1. retrieval quality (is the librarian finding the right books?): - recall: did we retrieve all the relevant documents/chunks needed to answer the question? (hard to measure perfectly without ground truth). - precision: of the documents we retrieved, how many were actually relevant? (easier to measure on a sample). high precision means less noise for the llm. - metrics: hit rate, mean reciprocal rank (mrr), normalized discounted cumulative gain (ndcg) - often calculated using benchmark datasets or human evaluation. 2. generation quality (is the author writing well, based only on the books?): - faithfulness / groundedness: does the generated answer accurately reflect the information in the retrieved sources? does it avoid contradicting the sources or introducing outside information (hallucinations)? - answer relevance: does the generated answer directly address the user's query? - evaluation: often requires human review comparing the answer to the retrieved context. automated metrics (e.g., rouge, bleu comparing to reference answers) can be used but are less reliable for factual accuracy. tools like ragas (specifically faithfulness, answerrelevancy), trulens, or deepeval provide frameworks and some automated checks. 3. end-to-end performance: - latency: how long does the entire rag process (query -> retrieve -> generate -> response) take? users expect fast responses (ideally \<2-5 seconds for interactive chat). monitor p50, p90, p99 latencies. - citation quality: are citations provided? are they accurate (pointing to the correct source)? are they easy for the user to access and verify? (requires human check). 4. overall user satisfaction: standard product metrics like csat, task completion rate, reduction in support tickets related to the rag feature's domain. key: combine automated metrics with regular human evaluation, especially for faithfulness and citation quality, as automated metrics can be misleading. --- actionable takeaway: the 5-day rag prototyping sprint get hands-on experience building a simple rag pipeline: 1. day 1 (knowledge base): choose a small set of relevant documents (e.g., 5-10 product faqs, a few key pages from your documentation). use a library like llamaindex or langchain with a simple embedding model (like sentence transformers) and a local vector store (like chromadb or faiss) to chunk, embed, and index this data. 2. day 2 (naive rag): build a basic rag chain using langchain or llamaindex. connect your index from day 1, use a standard llm (like gpt-3.5-turbo via api), and create a simple interface (e.g., streamlit or gradio) to ask questions against your documents. test a few queries. 3. day 3 (advanced retrieval - re-ranking): retrieve more initial documents (e.g., top 20) in your chain. integrate a re-ranking step using a library or api (like cohere rerank or a local cross-encoder model via sentence transformers) to select the best top 5 before sending to the llm. compare results to day 2 for a few tricky queries. 4. day 4 (evaluation): define 5-10 test questions relevant to your documents. run them through both your naive rag (day 2) and advanced rag (day 3) pipelines. manually evaluate the answers for accuracy, relevance, and whether they seem grounded in the source documents. note any hallucinations. measure response time. 5. day 5 (analysis & next steps): analyze your evaluation results. did re-ranking help? where did it still fail? brainstorm potential next steps based on failures (e.g., "need better chunking," "try query expansion," "prompt needs explicit instruction to cite sources"). --- your next step: take your company's internal product documentation or knowledge base (e.g., confluence space, shared google drive). can you imagine building a simple rag-powered q&a bot over it? spend 1-2 hours today exploring a tool like llamaindex or langchain via their quickstart tutorials, perhaps trying to index just one document and ask a question. see how feasible the first step feels. ---