<?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[Stories by Chen Probstein on Medium]]></title>
        <description><![CDATA[Stories by Chen Probstein on Medium]]></description>
        <link>https://medium.com/@chenp_88319?source=rss-0ef40a74e497------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*x8Ofo3UIKZPsQmMT</url>
            <title>Stories by Chen Probstein on Medium</title>
            <link>https://medium.com/@chenp_88319?source=rss-0ef40a74e497------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:27:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chenp_88319/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Baking the Future of AI with RAG and VectorDB]]></title>
            <link>https://medium.com/eleos-health/baking-the-future-of-ai-with-rag-and-vectordb-a29bf741530d?source=rss-0ef40a74e497------2</link>
            <guid isPermaLink="false">https://medium.com/p/a29bf741530d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Chen Probstein]]></dc:creator>
            <pubDate>Thu, 19 Sep 2024 14:00:39 GMT</pubDate>
            <atom:updated>2024-09-19T14:00:39.331Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Journey Towards Vector Databases and RAG</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cLdP3inRJVg3OZErqekl4A.png" /></figure><p>Imagine you’ve just walked into a bakery, excited to buy your favorite pastry. The smell is inviting, the counter looks promising — but when you take a bite, something’s missing. It’s technically the right pastry, it meets all the standards, but it lacks that special touch, the one that makes it feel like it was made just for you.</p><p>That’s exactly what we experienced at Eleos Health. Our data team, a dedicated group of data scientists, engineers, and analysts, is responsible for developing and maintaining various AI products. One of our primary tasks is to help our users, therapists, and clinicians, efficiently summarize their therapy sessions with clients while adhering to compliance standards. We take pride in the work we do, always striving to push the boundaries of what’s possible. And to keep improving, we make it a point to regularly gather feedback from our users to understand their needs and pain points.</p><p>From this ongoing feedback, we learned something crucial: while our AI was effective in creating compliant notes, it often fell short in terms of personalization. The notes generated were compliant, yes, but they sometimes felt generic — lacking the unique voice of each therapist and the specific nuances of each session.</p><p>That’s when the lightbulb went on. We realized it wasn’t just about generating compliant notes; it was about capturing how each therapist worked. To do that, we turned to Retrieval-Augmented Generation (RAG) and Vector Databases, enabling us to enhance our AI solutions with personalized, context-rich examples.</p><p>The result? Notes that didn’t just meet standards — they felt authentic, just like that perfect pastry you were craving.</p><h3><strong>Understanding the Building Blocks: Embeddings and VectorDB</strong></h3><p>Think of embeddings as the secret ingredients in your favorite pastry recipe — the ones that give the final product that special flavor you can’t quite describe but can definitely taste. Simply put, embeddings are numerical representations that capture the meaning and context of data — whether it’s text, audio, or video.</p><p>What makes embeddings powerful is their versatility. They allow us to convert various types of data into high-dimensional vectors that can be stored and searched within a Vector Database. Whether the data comes from an audio recording, a written note, or a video, specialized models can create embeddings that encapsulate the essence of that data.</p><p>This unified approach means we can perform semantic searches across different data types, retrieving relevant information regardless of its original form. It’s like having a universal recipe that works for any type of pastry, ensuring that our AI systems can pull up the right “flavors” and deliver the best results.</p><h4>What is Vector DB and What Problems Does It Solve?</h4><p>Picture a traditional recipe book with clear instructions and precise measurements — perfect for simple cookies where everything is straightforward. Traditional databases are like that: great for handling structured, orderly information.</p><p>But what about when you’re making something more complex, like a croissant, where intuition and experience matter? That’s where traditional databases fall short, struggling with unstructured data like text or images that need more than just rigid structure.</p><p>Now, think of a seasoned pastry chef who knows how to blend ingredients based on their essence. Similarly, VectorDB is designed to handle high-dimensional vector data, allowing searches based on meaning rather than just exact matches — perfect for complex applications where context is key.</p><h4>Vector Databases VS Vector Libraries</h4><p>After understanding how VectorDB operates — it’s important to see how VectorDB stacks up against other tools in the kitchen. Think of vector libraries, like <a href="https://ai.meta.com/tools/faiss/">FAISS</a>, as a small bakery specializing in made-to-order pastries — quick and efficient for small batches. Vector libraries store data in RAM, making them fast but limited. If the service goes down, all data is lost, requiring re-embedding, much like a bakery without storage for extra ingredients.</p><p>VectorDB, on the other hand, is like a commercial bakery with well-stocked shelves and backup systems. It doesn’t just store data reliably, but it also ensures low latency, keeping things quick even for large datasets. By separating compute from storage, VectorDB provides both speed and scalability, making it perfect for long-term, high-performance applications where precision and reliability are key.</p><h4>The Impact of Vector Databases</h4><p>Using Vector Databases has brought significant benefits:</p><ol><li><strong><em>Efficiency</em></strong><em>:</em> They speed up the processing of complex, unstructured data, allowing us to deliver insights faster and manage large data volumes effectively.</li><li><strong><em>Accuracy</em></strong><em>: </em>Improve the accuracy of our AI by enabling precise, context-based searches, resulting in more relevant and reliable outputs for therapists.</li><li><strong><em>Scalability and Innovation</em></strong><em>:</em> Ensure we remain a leading AI force in the mental healthcare field. They allow our systems to scale easily and keep us at the forefront of technology, always working with the most cutting-edge solutions available on the market.</li></ol><p>Overall, Vector Databases not only enhance our current capabilities but also secure our position as innovators in mental healthcare technology.</p><h3>What is Retrieval-Augmented Generation (RAG)?</h3><p>Imagine a baker who, instead of just using what’s already in the pantry, can quickly gather the best, freshest ingredients from across markets. That’s what RAG does for AI — it brings in the most relevant, up-to-date information before creating the final output.</p><p>Retrieval-Augmented Generation (RAG) is a powerful technique that enhances the capabilities of large language models (LLMs) by incorporating relevant external information before generating a response. This approach improves both the precision and relevance of the outputs, making AI responses more accurate and contextually appropriate.</p><h4>How RAG Works: The Three Steps</h4><ol><li><strong><em>Indexing</em></strong><em>:</em> The process begins by splitting documents into shorter, manageable chunks and indexing these chunks in a Vector Database (VectorDB). The VectorDB stores these chunks as high-dimensional vectors, capturing the semantic meaning of the text. This structured storage makes it easy to access specific information quickly.</li><li><strong><em>Retrieval</em></strong><em>: </em>When a question or prompt is provided, RAG leverages the VectorDB to retrieve the most relevant chunks based on semantic similarity. This retrieval process ensures that the LLM is fed contextually rich and relevant information (which is usually termed “context”) that directly aligns with the query.</li><li><strong><em>Generation</em></strong><em>:</em> With the retrieved information, the language model generates a response that is enriched with the aforementioned retrieved context. By using the relevant data from the VectorDB, the model can produce answers that are not only more accurate but also better tailored to the specifics of the question.</li></ol><h4>Enriching Prompts and Dynamic Fine-Tuning with VectorDB</h4><p>RAG works by dynamically enriching the prompts fed into the LLM, allowing it to be fine-tuned “on the fly” using the most pertinent context and examples stored in the VectorDB. This dynamic fine-tuning process ensures that the AI delivers precise, context-aware results tailored to individual queries, very quickly.</p><p>The integration of VectorDB into RAG is crucial because it provides a persistent, scalable way to manage and query vast amounts of data. VectorDB ensures that data is always accessible and can handle large-scale queries efficiently, making it an essential backbone for real-time, context-driven AI responses.</p><h4>Going Beyond Training Limitations</h4><p>Just as a baker’s skill goes beyond just following the recipe, RAG not only enhances the accuracy of AI responses but also allows the AI to provide answers that might otherwise be impossible due to the limitations of its training data. For instance, an AI model trained only up to a certain date might lack knowledge of more recent events. RAG, with its ability to tap into a continually updated VectorDB, can retrieve the latest information to answer questions accurately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-yCeOHrgLSOrihq1WWcXtA.gif" /><figcaption>Basic RAG process with query, vector database, and LLM</figcaption></figure><h3>Vector Database Market Review and Proof of Concept</h3><p>Just as a baker meticulously tests ingredients before selecting the perfect flour for their signature pastry, we at Eleos Health conducted a comprehensive market review and a detailed Proof of Concept (POC) to identify the ideal Vector Database for our AI needs.</p><p>Our goal was to find a solution that would effectively support our Retrieval-Augmented Generation (RAG) processes, enhancing our AI capabilities and ensuring robust performance. Here’s a look at our evaluation process, considerations, and findings:</p><h4>Database Size Considerations</h4><p>Think of our database like the storage space in a bakery. Initially, we estimated our storage requirements based on 6,000 sessions per day, with each session generating six vectors of 768 dimensions each. This put us at a projected size of around 225 GB over five years. At that point, using multiple vectors seemed necessary to capture the full complexity of each therapy session.<br>Later, we found that one vector per session is probably enough for our needs at the time, making our data storage more efficient.</p><p>These size estimates were for just this project. We didn’t account for our broader plans to use vector databases across multiple products and internal applications, which would require even more storage. Plus, the five-year projection didn’t consider company growth, so we expect the database size to expand significantly, highlighting the need for a scalable solution.</p><h4>Key Considerations for Selecting a Vector Database Solution</h4><p>Just as a baker considers the type of oven, the temperature, and the size of their kitchen, we had to evaluate several critical factors in selecting the right Vector Database solution:</p><ol><li><strong><em>Scalability</em></strong><em>:</em> The solution must handle growing data volumes and increased query loads. Vertical scaling (adding more resources to a single server) and horizontal scaling (distributing load across multiple servers) were critical features.</li><li><strong><em>Latency</em></strong><em>:</em> Quick, responsive query times are crucial, especially when dealing with real-time applications where user experience depends on fast information retrieval.</li><li><strong><em>Accuracy</em></strong><em>:</em> The ability to accurately retrieve relevant vectors is essential for delivering precise and meaningful AI-generated responses.</li><li><strong><em>Cost</em></strong><em>:</em> Both the initial setup and ongoing operational costs were evaluated to ensure the solution would be cost-effective over the long term.</li><li><strong><em>Ease of Integration</em></strong><em>: </em>Compatibility with existing data pipelines and machine learning models was a key factor, aiming for minimal disruption and seamless adoption.</li><li><strong><em>Support for Zero and few-Shot Learning</em></strong><em>:</em> We needed a database capable of handling embeddings effectively, also in scenarios requiring responses based on new or emerging information.</li><li><strong><em>Similarity Search Capabilities</em></strong><em>:</em> Efficient and accurate similarity search was a non-negotiable feature for retrieving contextually relevant data.</li><li><strong><em>Data Security and Privacy</em></strong><em>:</em> Ensuring compliance with data protection regulations was vital, given the sensitive nature of healthcare data.</li><li><strong><em>Community and Support</em></strong><em>:</em> The availability of strong documentation, active community support, and access to professional services was important for sustainable and effective use.</li></ol><h4>POC — Market Review Solutions</h4><p>In our research, we mixed together insights from academic papers, podcasts, and AI consultations, much like testing a variety of ingredients before settling on the perfect blend for a signature dish. Here’s a taste of the key solutions we considered:</p><ul><li><strong>Elasticsearch</strong>: Known for its powerful text search capabilities, Elasticsearch has expanded to support vector search, making it a versatile choice for applications requiring both text and semantic search capabilities.</li><li><strong>Azure AI Search</strong>: A cloud-based service offering AI-driven search capabilities, suitable for creating complex, AI-powered search experiences across various application types.</li><li><strong>OpenSearch</strong>: A community-driven open-source search and analytics suite derived from Elasticsearch, designed for scalable data analysis.</li><li><strong>Pinecone</strong>: A specialized, high-performance vector database service tailored for machine learning, offering scalable similarity search and easy integration with AI workflows.</li><li><strong>Milvus</strong>: An open-source vector database optimized for AI applications, providing scalable and efficient vector storage, indexing, and retrieval.</li><li><strong>Weaviate</strong>: Another open-source vector database, offering robust support for various neural search frameworks, with options for cloud and self-hosting.</li><li><strong>pgvector for PostgreSQL</strong>: An extension for PostgreSQL that adds vector search capabilities, allowing for efficient similarity search within a traditional relational database.</li></ul><p>Based on this research, I created the following table, which scores each solution on its read and write performance capabilities:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/0*_v4THoAQPgqc9hWQ" /><figcaption>Vector database performance comparison table</figcaption></figure><p>Based on this market review, and as I delved deeper into understanding the potential of these technologies, it became clear that we needed a solution that was a vector database at its core, not just an extension or add-on. We needed something robust enough to handle our growing needs and versatile enough to enable a wide range of applications.</p><h4>Deep Dive into POC with Pinecone and Milvus</h4><p>Realizing the need for a native vector database solution, we focused our POC efforts on two leading vector databases: Pinecone (managed service) and Milvus (open-source). Both offered dedicated vector storage and high performance for similarity searches.</p><p>Testing Methodology: We generated synthetic data using .npy files of embeddings, augmented with random noise to simulate various data sizes. We optimized batch insertion and tested both read and write times to evaluate performance.</p><h4>Milvus: The Open-Source Vector Database</h4><p>Milvus is an open-source vector database designed specifically for handling massive amounts of vector data, which is crucial for AI and machine learning applications. Built to support high-performance similarity search, Milvus leverages advanced indexing techniques to ensure efficient data retrieval. It is particularly well-suited for use cases that require large-scale data processing. Milvus offers robust support for scalar data types and integrates seamlessly with existing AI workflows, making it a popular choice among developers and data scientists.</p><h4>Milvus POC Results:</h4><ul><li><strong><em>Ease of Use and Integration</em></strong><em>:</em> Milvus offered an easy-to-use Python module with comprehensive documentation, making integration straightforward. Its familiar structure helped reduce the learning curve.</li><li><strong><em>Performance: </em></strong>Milvus performed well, with fast query times once collections were loaded. It also supported scalar searches and pagination, improving flexibility in complex queries.</li><li><strong><em>Infrastructure Challenges:</em> </strong>Setting up Milvus required significant DevOps support, adding complexity. We also faced issues with Helm charts, raising concerns about scalability and automation.</li><li><strong><em>Caching for Real-Time Use: </em></strong>Milvus needed collections to be loaded into cache before querying, which caused occasional delays of several seconds — potentially affecting real-time applications.</li></ul><h4><strong>Pinecone: The Managed Vector Database Solution</strong></h4><p>Pinecone is a specialized vector database designed to deliver high-performance similarity searches as a managed service. Unlike traditional databases, Pinecone is optimized for storing and querying vector data, making it a powerful tool for machine learning and AI applications. Pinecone offers both serverless and pod-based deployment options, providing flexibility in how resources are managed and scaled. Its design focuses on ease of use, speed, and scalability, making it an attractive choice for businesses looking to integrate vector search capabilities without heavy infrastructure overhead.</p><h4><strong>Pinecone POC Results</strong>:</h4><ul><li><strong><em>Ease of Use and Integration:</em> </strong>Pinecone’s user-friendly Python client and thorough documentation made integration seamless and straightforward.</li><li><strong><em>Performance:</em> </strong>With both serverless and pod-based deployment options, Pinecone delivered excellent performance. Pod-based was faster, but even serverless maintained low latency suitable for real-time use.</li><li><strong><em>Operational Efficiency:</em> </strong>As a fully managed service, Pinecone reduced DevOps needs and provided UI tools for easy performance monitoring, simplifying management.</li><li><strong><em>Limitations:</em> </strong>Pinecone had limited support for scalar searches, and costs could rise with increased usage. Cold start delays in serverless mode were minimal, usually under a second.</li></ul><h3>The Chosen Solution: Pinecone</h3><p>After evaluating both solutions, Pinecone emerged as the clear winner — much like selecting the perfect oven for a busy bakery. Its managed service model, high performance, and user-friendly interface made it an excellent fit for our needs.</p><p>The next decision was therefore whether to go with Pinecone’s Pod-Based or Serverless deployment.</p><h4>Pinecone Pod-Based vs. Serverless</h4><ul><li><strong><em>Pod-Based</em></strong><em>:</em> Offers faster response times by keeping vectors in hot storage, ensuring quick access. However, this model is more costly due to continuous resource usage and requires manual scaling operations which adding complexity.</li><li><strong><em>Serverless</em></strong><em>:</em> Provides good enough latency with vectors stored in cold storage, invoking compute resources only as needed. This model is more cost-effective, supports automatic scaling, and simplifies operational management. Pinecone prioritizes serverless for new feature rollouts, making it a future-proof choice.</li></ul><p>We ultimately chose the <strong>serverless</strong> model for its balance of performance, cost-effectiveness, and ease of management. This allows us to stay agile, scaling as demand grows while keeping operational costs low. However, much like being able to switch to a high-performance oven for a busy holiday rush, Pinecone remains flexible, giving us the option to transition to pod-based if specific use cases or higher demands arise.</p><h4>Pinecone Serverless Architecture</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wzVxnTVr13GpTof0.png" /><figcaption>Pinecone serverless high-level architecture</figcaption></figure><p>Now, let’s take a look at our new kitchen. Pinecone’s serverless model efficiently manages data requests by routing them through key components. Applications send requests through an API Gateway, where the API key is verified and requests are routed to either the <strong>control plane</strong> or <strong>data plane</strong>. The <strong>control plane</strong> manages projects, indexes, and API keys, using a dedicated database for these objects. Meanwhile, the <strong>data plane</strong> handles the actual read/write operations, with namespaces ensuring data is neatly organized. Writes and reads are processed separately, with independent auto-scaling compute resources that optimize performance and keep costs low.</p><p>For long-term data retention, Pinecone utilizes <strong>object storage</strong>, clustering related records and generating centroids for efficient retrieval. These clusters are stored in distributed object storage, providing limitless scalability and high availability. This architecture keeps operations scalable, cost-effective, and reliable — perfectly suited for our evolving needs.</p><h3>Deployment Architecture and Results:</h3><p>Our implementation of Pinecone VectorDB has elevated the performance of one of our core products, similar to how a well-equipped bakery produces consistently exceptional pastries. The architecture we’ve designed is highly scalable, meaning it can easily be replicated and applied to other products as our needs evolve, ensuring we’re always prepared to craft the ideal AI solution.</p><h4><strong>Architecture Overview</strong></h4><ul><li><strong><em>Pinecone Indexes:</em></strong> We created two separate Pinecone indexes to handle different types of notes. In vector databases, an <em>index</em> serves as a data structure that organizes vector embeddings efficiently.</li><li><strong><em>Organizational Namespaces:</em></strong> Each index is subdivided into <em>organizational namespaces</em>. In our context, <em>organizations</em> refer to the healthcare organizations that are our clients. For each organization, we created a unique namespace, effectively acting like a partition. These namespaces isolate and manage data securely, ensuring that each organization’s data remains separate and is handled according to its unique requirements. This setup maintains strict data security and privacy.</li><li><strong><em>Embedding Process</em></strong><em>:</em> Each de-identified note is converted into a single embedding that captures all relevant information. These embeddings are stored in Pinecone and include metadata such as session type, the de-identified note content, and other key details, enabling targeted and contextually accurate searches.</li></ul><h4>Ingestion Process Components</h4><p><strong>Python Code Module</strong>: A customized Python module efficiently handles the entire ingestion process, including:</p><ol><li><strong><em>Data Extraction: </em></strong>Pulls relevant data from our data lake for processing.</li><li><strong><em>Mapping</em></strong><em>:</em> Formats and organizes the extracted data into a structure suitable for embedding.</li><li><strong><em>De-Identification:</em></strong> Removes sensitive information using a dedicated de-identification model to ensure privacy and compliance.</li><li><strong><em>Embedding</em></strong><em>:</em> Transforms each note into a vector embedding using our AI models.</li><li><strong><em>Loading into Pinecone: </em></strong>Uploads the embeddings into the relevant Pinecone indexes.</li></ol><p><strong>Airflow DAG</strong>: An Airflow Directed Acyclic Graph (DAG) orchestrates this workflow, managing configurations and ensuring smooth execution from data extraction to embedding and loading into Pinecone.</p><h4>Monitoring Results and Observations</h4><p>Integrating the vector database has significantly enhanced our product’s performance. We’ve seen faster processing times, with the database reducing search and retrieval times, keeping everything efficient even as data volumes grow. Note quality has improved through advanced similarity search, prioritizing contextually relevant notes. User engagement is up — more AI-generated text is being saved and fully utilized, showing increased trust in our AI assistance. Feedback ratings have also improved, reflecting higher satisfaction with the quality and speed of the generated notes.<br>We were truly amazed by the results from our therapists. Previously, we received feedback like:</p><blockquote>“Had to make many changes to fit my glossary”</blockquote><blockquote>“Accurate but not necessarily my style”</blockquote><p>Now, the feedback has transformed into:</p><blockquote>“Great note, important information picked up. I also love how Eloes is able to ascertain the type of therapy style/intervention I use during the session because I don’t even know. Lol”</blockquote><blockquote>“It is really getting to know my notetaking style.”</blockquote><p>This shift demonstrates not only our improvement but also the growing trust and satisfaction with our AI solutions.<br>Overall, the vector database integration has boosted both product performance and user experience, ensuring our AI solutions are as reliable as a well-oiled kitchen producing top-quality results every time.</p><h3>Empowering AI with RAG and Vector DB: Redefining the Landscape</h3><p>To conclude our journey for crafting that perfect, special-touched pastry, this wasn’t just about adopting new technology — it was about transforming how we use data to elevate the user experience. By integrating vector databases and Retrieval-Augmented Generation, we’ve made our AI smarter, faster, and more intuitive. This isn’t merely a step forward; it’s a leap toward a future where AI doesn’t just assist but genuinely understands.</p><p>From improving the efficiency of our processes to ensuring that every interaction is more meaningful, these advancements have brought us closer to delivering exceptional AI experiences. With scalable architecture and flexible solutions, we’re not just meeting today’s demands; we’re setting the stage for future innovations.<br>As we continue to grow, our mission remains the same: to push the boundaries of what’s possible with AI, turning data into insights that truly make a difference. This journey is only the beginning, and with each improvement, we move closer to a future where AI plays a crucial role in delivering personalized, impactful mental healthcare. Here’s to more innovation, and like any great bakery, always rising to create something fresh and extraordinary!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a29bf741530d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/eleos-health/baking-the-future-of-ai-with-rag-and-vectordb-a29bf741530d">Baking the Future of AI with RAG and VectorDB</a> was originally published in <a href="https://medium.com/eleos-health">Eleos Health</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>