<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[HDFC Bank Tech-Hub - Medium]]></title>
        <description><![CDATA[At HDFC Bank, tech meets purpose. Engineering smarter, safer financial futures. - Medium]]></description>
        <link>https://medium.com/hdfcbank-engineering-factory?source=rss----b7b2cf4a8c99---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>HDFC Bank Tech-Hub - Medium</title>
            <link>https://medium.com/hdfcbank-engineering-factory?source=rss----b7b2cf4a8c99---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 11:18:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/hdfcbank-engineering-factory" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Production ready RAG is hard — RAG on Steroids with Multi-step RAG]]></title>
            <link>https://medium.com/hdfcbank-engineering-factory/production-ready-rag-is-hard-rag-on-steroids-with-multi-step-rag-2b30de300ef1?source=rss----b7b2cf4a8c99---4</link>
            <guid isPermaLink="false">https://medium.com/p/2b30de300ef1</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Amit Sehgal]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 08:44:48 GMT</pubDate>
            <atom:updated>2026-01-02T08:44:46.811Z</atom:updated>
            <content:encoded><![CDATA[<h3>Production ready RAG is hard — RAG on Steroids with Multi-step RAG</h3><h3>Background</h3><p>Retrieval-Augmented Generation (RAG) has been a key concept in the NLP/AI world since 2020 <a href="https://arxiv.org/abs/2005.11401">ref</a>. With the rise of GenAI, RAG has become a foundational component of the architecture in most enterprise GenAI applications.</p><p>In our organisation, we’ve often seen RAG-based search/chatbots perform well during POCs, especially when the document corpus is small and low in complexity. However, they struggle as complexity and scale increase in production environments.</p><p>In our organisation we also have faced multiple such challenges and worked on approached to resolve the same to improve efficacy of our RAG based responses on bots and search.</p><p>In this post, we share our journey building a turbo charged RAG platform and we called this <em>Anveṣā</em> (in Sanskrit).</p><blockquote>Acknowledgement</blockquote><blockquote>This was a team effort — both the solution and this article were developed with contributions from <a href="https://medium.com/u/cb477254feab">Vineet Jaiswal</a>, <a href="https://medium.com/u/199466746b41">Rajat Mishra</a>, <a href="https://medium.com/u/62acb2f824f9">Satendra Kumar</a>, and <a href="https://medium.com/u/33736a31e1e0">Himani Jain</a>. Special thanks to this fantastic team!</blockquote><h3>The “aim”</h3><p>As a bank, our goal was to build an intelligent search bot that could span product specifications, SOPs, policies, and procedural documents in diverse formats (PDFs, Word docs, PowerPoints, etc.).</p><p>This search chatbot would solve multiple problems:</p><ul><li>For bank’s employees to get response to various HR policies and queries etc.</li><li>This also serves as an assistant to Relationship Managers (RMs) to help them get answers to various procedures, policies and process related to banking helping them assist the customers better.</li><li>Same bot can then scale to end customer of the bank for public information and SOPs</li></ul><p>The goal was clear: this knowledge bot would increase response accuracy and consistency while reducing human dependency.</p><p>Few functional guardrails:</p><ol><li>Being a regulated entity we need bot to respond accurately with documented evidence to back the responses.</li><li>Bot needs to be monitored for hallucination or producing incorrect or partially correct information</li><li>It was ok to not respond and redirect to humans but not to hallucinates in case of uncertainty of content and query. However passing to humans is considered as a negative point on bots KPIs.</li></ol><h3>Design and Approach</h3><p>We began building Anveṣā — a full-fledged RAG pipeline that includes:</p><p>Hooking to repositories share-point + ad-hoc uploads → parsing various document formats → chunking documents → data modelling and storage of documents → versioning → search and chat bot on top.</p><p>Many recent papers and research have highlight multiple issues with RAG related to chunking, broken context in chunks, duplicity in content leading to LLM hallucinations and incorrect responses.</p><p>In order to cater to these issues we have built a LLM based pre-processing steps to improve the data that goes into our vector DBs.</p><h4>Challenges</h4><p>As we proceeded further in our journey to process all various variety of documents with our organisation we soon realised that a normal parser/ chunker would not cut the cookie.</p><p><strong>Problem 1:</strong> We started to miss context as the chunking logic lacked contextual awareness and was breaking a large section or a paragraph into multiple chunks where some chunks lost the connection to the overall context. We saw our searches with basic processing was missing information as a portion of the information was sliding into another chunk which did not had a linking context.</p><p><strong>Problem 2: </strong>Documents were not LLM friendly i.e. they had tables, document talking about multiple products, the linking section were not in sequence i.e. a portion of Saving Account process was mentioned in page 1 and some information about the same product line was mentioned later in say page 29. That also led to missing context across chunk and losing information in searches and some of the chunk were coming pretty low on score in top-k search.</p><p><strong>Problem 3:</strong> Duplication of information in multiple documents that too with different tonality and slight differences in language and nuances. May be because these documents were written by multiple people across various parts of the country. Note: This issue is still pending resolution. We plan to implement duplicate detection during document upload.</p><p><strong>Problem 4:</strong> Recency and partial updates handling in the documents with time. We haven’t yet addressed this in our current architecture as for now this problem is yet to hit us. We plan to current follow delete all chunks and insert docs afresh approach to save us.</p><h4>Solution</h4><p>The diagram below shows a design of a multi-step efficient RAG process in 2 steps pre and post processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*-dlq-CZjraG3ZiZFpi5ctA.png" /><figcaption><strong>Step 1: Pre-processing Layer</strong></figcaption></figure><p>In the diagram above, all yellow components are the niche components we built to improve the efficacy of the RAG process for us where we improved the completeness and accuracy of our responses from meagre 60% to whopping 90%+ levels. All purple components are the ones are where the active development is happening to improve the entire process even further.</p><p>In order to retain the context we devise various page readers to read multiple pages and used large-context models with controlled temperature settings to ensure coherent chunking — grouping sections, tables, or paragraphs together. This significantly improved our retrieval accuracy.</p><p>Some of the documents which were very complicated were read separate with human-in-the-loop and large context LLMs to help them convert into FAQs / more LLM friendly structures.</p><p>We added another layer using LLMs to extract topics and subtopics and generate likely user questions for each chunk, which we stored as additional metadata to enhance retrieval through BM25 and keyword search.</p><p>So far we talked about the pre-processing of data, chunking strategies and storage policies. Let’s now jump into retrieval arena</p><h3>Retrieval and Generation</h3><p>Once document chunks are embedded and stored in our vector and feature store, we began architecting the Retrieval-Augmented Generation (RAG) pipeline. After several iterations and optimizations, we settled on the design depicted below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*G4hnfGclfOLfsmqIgwHtEg.png" /><figcaption>Retrieval augmented Generation</figcaption></figure><h4>Key Design Elements</h4><p>When a user query enters the system, it is first processed by an <strong>NLU layer</strong>, powered by a combination of large language models (LLMs) and small language models (SLMs). This layer <strong>rephrases the query</strong>, standardizing terminology by replacing colloquial or ambiguous phrases with <strong>canonical keywords and topics</strong>.</p><ul><li><strong>Why this matters</strong>: Standardization significantly boosts both <strong>BM25 keyword retrieval</strong> and <strong>semantic (vector) search</strong> relevance.</li><li>Additionally, <strong>topic detection</strong> enables early-stage filtering in the vector space, reducing noise and improving precision.</li></ul><h4>Dual-Stage Retrieval</h4><p>We execute two parallel searches:</p><ol><li><strong>BM25-based keyword search</strong> over the indexed corpus.</li><li><strong>HNSW-based vector similarity search</strong> using a top-k retrieval strategy.</li></ol><h4>Agentic Response Generation</h4><p>The generation step is orchestrated in two stages:</p><ol><li><strong>Stage 1</strong>: The top-k chunks from the <strong>vector search</strong> are passed to the generation LLM to produce an initial draft.</li><li><strong>Stage 2</strong>: A second agent enhances this draft using <strong>BM25 search results</strong> as supplementary context. This allows for factual enrichment and cross-validation of content.</li></ol><p>This chaining approach has shown a <strong>marked improvement in response accuracy and richness</strong>. Notably, we observed that LLMs perform better when <strong>single-responsibility tasks are chained</strong>, rather than trying to perform all reasoning and generation in a monolithic prompt.</p><h4>Grounding and Governance</h4><p>Given the regulatory and factual constraints in the banking domain, we embedded strict <strong>grounding prompts</strong> at every stage. These prompts instruct the model to:</p><ul><li>Stay within the boundaries of retrieved content.</li><li>Avoid speculative or creative generation.</li><li>Use only validated internal documents as sources.</li></ul><p>This was a <strong>critical requirement from compliance teams</strong>, and one of the hardest challenges we solved through continuous prompt engineering and domain expert feedback.</p><h4>Lessons Learned</h4><ul><li>Iterative testing with <strong>prompt tuning</strong> at each stage was key.</li><li><strong>Close collaboration with domain experts</strong> was essential to identify relevant terms and topics.</li><li>Even subtle changes to how tasks are decomposed and sequenced can significantly affect final output quality.</li></ul><h3>Next Steps</h3><ul><li><strong>Develop a Robust Evaluation Framework</strong><br> We plan to implement an evaluation pipeline that combines both <strong>automated metrics</strong> (e.g., precision, recall, BLEU, faithfulness scores) and <strong>LLM-as-a-judge strategies</strong> for subjective assessments such as factuality, coherence, and completeness.<br> This will help us monitor the quality of responses continuously and guide fine-tuning efforts.</li><li><strong>Implement Duplication Detection</strong><br> As the document store grows, it’s essential to prevent repetitive or redundant content from affecting retrieval relevance. We aim to integrate <strong>document-level and chunk-level deduplication</strong>, likely using hashing, clustering, or embedding similarity techniques.</li><li><strong>Build Recency Awareness</strong><br>To ensure that our system reflects the most up-to-date knowledge, we plan to introduce <strong>recency detection and prioritization</strong>. This involves tagging documents with temporal metadata and incorporating time-awareness into both BM25 and vector retrieval strategies.</li><li><strong>Feedback loop</strong></li><li>We need to build a mechanism to have a feedback loop and re-tuning prompts and also build semantic response caching to reduce cost.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b30de300ef1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hdfcbank-engineering-factory/production-ready-rag-is-hard-rag-on-steroids-with-multi-step-rag-2b30de300ef1">Production ready RAG is hard — RAG on Steroids with Multi-step RAG</a> was originally published in <a href="https://medium.com/hdfcbank-engineering-factory">HDFC Bank Tech-Hub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>