<?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[Vector Database for AI - Medium]]></title>
        <description><![CDATA[Scalable similarity search on unstructured data (such as image, video, and natural language) powered by https://milvus.io - Medium]]></description>
        <link>https://medium.com/vector-database?source=rss----e87dfc9fdbb6---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Vector Database for AI - Medium</title>
            <link>https://medium.com/vector-database?source=rss----e87dfc9fdbb6---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:04:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/vector-database" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Milvus 2025 Roadmap — Tell Us What You Think]]></title>
            <link>https://medium.com/vector-database/milvus-2025-roadmap-tell-us-what-you-think-524b2f77ec36?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/524b2f77ec36</guid>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 05:09:10 GMT</pubDate>
            <atom:updated>2025-04-24T02:01:26.227Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*J2M53iTUZ9aWa3zG.png" /></figure><p>Hey, Milvus users and contributors!</p><p>We’re excited to share our <a href="https://milvus.io/docs/roadmap.md"><strong>Milvus 2025 roadmap</strong></a> with you. 🚀 This technical plan highlights the key features and improvements we’re building to make Milvus even more powerful for your vector search needs.</p><p>But this is just the beginning — we want your insights! Your feedback helps shape Milvus, ensuring it evolves to meet real-world challenges. Let us know what you think and help us refine the roadmap as we move forward.</p><h4>The Current Landscape</h4><p>Over the past year, we’ve seen many of you build impressive RAG and agent applications with Milvus, leveraging many of our popular features, such as our model integration, full-text search, and hybrid search. Your implementations have provided valuable insights into real-world vector search requirements.</p><p>As AI technologies evolve, your use cases are becoming more sophisticated — from basic vector search to complex multimodal applications spanning intelligent agents, autonomous systems, and embodied AI. These technical challenges are informing our roadmap as we continue to develop Milvus to meet your needs.</p><h4>Two Major Releases in 2025: Milvus 2.6 and Milvus 3.0</h4><p>In 2025, we’re rolling out two major versions: Milvus 2.6 (Middle of CY25) and Milvus 3.0 (end of 2025).</p><p><strong>Milvus 2.6</strong> focuses on core architecture improvements you’ve been asking for:</p><ul><li>Simpler deployment with fewer dependencies (goodbye, deployment headaches!)</li><li>Faster data ingestion pipelines</li><li>Lower storage costs (we hear your production cost concerns)</li><li>Better handling of large-scale data operations (delete/modify)</li><li>More efficient scalar and full-text search</li><li>Support for the latest embedding models you’re working with</li></ul><p><strong>Milvus 3.0</strong> is our bigger architectural evolution, introducing a vector data lake system for:</p><ul><li>Seamless AI service integration</li><li>Next-level search capabilities</li><li>More robust data management</li><li>Better handling of those massive offline datasets you’re working with</li></ul><h4>Technical Features We’re Planning — We Need Your Feedback</h4><p>Below are key technical features we are planning to add to Milvus.</p><p>| <strong>Key Feature Area</strong> | <strong>Technical Features</strong> | | — — — — — — — — — — — — — — — — — — — — | — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — | | <strong>AI-Driven Unstructured Data Processing</strong> | — Data-In/Out: Native integration with major model services for raw text ingestion<br>- Original Data Handling: Text/URL reference support for raw data processing<br>- Tensor Support: Vector list implementation (for ColBERT/CoPali/Video scenarios)<br>- Extended Data Types: DateTime, Map, GIS support based on requirements<br>- Iterative Search: Query vector refinement through user‘s feedback | | <strong>Search Quality &amp; Performance Improvements</strong> | — Advanced Matching: phrase_match &amp; multi_match capabilities<br>- Analyzer Upgrade: Enhance Analyzer with expanded tokenizer support and improved observability<br>- JSON Optimization: Faster filtering through improved indexing<br>- Execution Sorting: Scalar field-based result ordering<br>- Advanced Reranker: Model-based reranking &amp; custom scoring functions<br>- Iterative Search: Query vector refinement through user‘s feedback | | <strong>Data Management Flexibility</strong> | — Schema Change: Add/delete field, modify varchar length<br>- Scalar Aggregations: count/distinct/min/max operations<br>- Support UDF: Support user-defined function<br>- Data Versioning: Snapshot-based rollback system<br>- Data Clustering: Co-location through configuration<br>- Data Sampling: Fast get results based on sampling data | | <strong>Architectural Improvements</strong> | — Stream Node: Simplified incremental data ingestion<br>- MixCoord: Unified coordinator architecture<br>- Logstore Independence: Reduced external dependencies like pulsar<br>- PK Deduplication: Global primary key deduplication | | <strong>Cost Efficiency &amp; Architecture Improvements</strong> | — Tiered Storage: Hot/cold data separation for lower storage cost<br>- Data Evict Policy: Users can define their own data evict policy<br>- Bulk Updates: Support field-specific value modifications, ETL, etc<br>- Large TopK: Returns massive datasets<br>- VTS GA: Connect to different sources of data<br>- Advanced Quantization: Optimize memory consumption and performance based on quantization techniques<br>- Resource Elasticity: Dynamically scale resources to accommodate varying write loads, read loads, and background task loads |</p><p>As we implement this roadmap, we’d appreciate your thoughts and feedback on the following:</p><ol><li><strong>Feature priorities:</strong> Which features in our roadmap would have the most impact on your work?</li><li><strong>Implementation ideas:</strong> Any specific approaches you think would work well for these features?</li><li><strong>Use case alignment:</strong> How do these planned features align with your current and future use cases?</li><li><strong>Performance considerations:</strong> Any performance aspects we should focus on for your specific needs?</li></ol><p><strong>Your insights help us make Milvus better for everyone. Feel free to share your thoughts on our</strong><a href="https://github.com/milvus-io/milvus/discussions/40263"><strong> Milvus Discussion Forum</strong></a><strong> or our </strong><a href="https://discord.com/invite/8uyFbECzPX"><strong>Discord Channel</strong></a><strong>.</strong></p><h4>Welcome to Contribute to Milvus</h4><p>As an open-source project, Milvus always welcomes your contributions:</p><ul><li><strong>Share feedback:</strong> Report issues or suggest features through our <a href="https://github.com/milvus-io/milvus/issues">GitHub issue page</a></li><li><strong>Code contributions:</strong> Submit pull requests (see our <a href="https://github.com/milvus-io/milvus/blob/82915a9630ab0ff40d7891b97c367ede5726ff7c/CONTRIBUTING.md">Contributor’s Guide</a>)</li><li><strong>Spread the word:</strong> Share your Milvus experiences and <a href="https://github.com/milvus-io/milvus">star our GitHub repository</a></li></ul><p>We’re excited to build this next chapter of Milvus with you. Your code, ideas, and feedback drive this project forward!</p><p>— The Milvus Team</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=524b2f77ec36" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/milvus-2025-roadmap-tell-us-what-you-think-524b2f77ec36">Milvus 2025 Roadmap — Tell Us What You Think</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Milvus SDK v2: Native Async Support, Unified APIs, and Superior Performance]]></title>
            <link>https://medium.com/vector-database/introducing-milvus-sdk-v2-native-async-support-unified-apis-and-superior-performance-388c3eb6fa2d?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/388c3eb6fa2d</guid>
            <category><![CDATA[async-support]]></category>
            <category><![CDATA[milvus-vector-database]]></category>
            <category><![CDATA[milvus-sdk-v2]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 05:07:27 GMT</pubDate>
            <atom:updated>2025-04-27T02:05:25.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rC_nFJ1uLs-65qG4.png" /></figure><h4>TL;DR</h4><p>You spoke, and we listened! Milvus SDK v2 is a complete reimagining of our developer experience, built directly from your feedback. With a unified API across Python, Java, Go, and Node.js, native async support that you’ve been asking for, a performance-boosting Schema Cache, and a simplified MilvusClient interface, Milvus SDK v2 makes <a href="https://zilliz.com/learn/vector-similarity-search">vector search</a> development faster and more intuitive than ever. Whether you’re building <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation">RAG</a> applications, recommendation systems, or <a href="https://zilliz.com/learn/what-is-computer-vision">computer vision</a> solutions, this community-driven update will transform how you work with Milvus.</p><h4>Why We Built It: Addressing Community Pain Points</h4><p>Over the years, Milvus has become the <a href="https://milvus.io/blog/what-is-a-vector-database.md">vector database</a> of choice for thousands of AI applications. However, as our community grew, we consistently heard about several limitations with our SDK v1:</p><p><strong>“Handling high concurrency is too complex.”</strong> The lack of native async support in some language SDKs forced developers to rely on threads or callbacks, making code harder to manage and debug, especially in scenarios like batch data loading and parallel queries.</p><p><strong>“Performance degrades with scale.”</strong> Without a Schema Cache, v1 repeatedly validated schemas during operations, creating bottlenecks for high-volume workloads. In use cases requiring massive vector processing, this problem resulted in increased latency and reduced throughput.</p><p><strong>“Inconsistent interfaces between languages create a steep learning curve.”</strong> Different language SDKs implemented interfaces in their own ways, complicating cross-language development.</p><p><strong>“The RESTful API is missing essential features.”</strong> Critical functionalities like partition management and index construction were unavailable, forcing developers to switch between different SDKs.</p><p>These weren’t just feature requests — they were real obstacles in your development workflow. SDK v2 is our promise to remove these barriers and let you focus on what matters: building amazing AI applications.</p><h4>The Solution: Milvus SDK v2</h4><p>Milvus SDK v2 is the result of a complete redesign focused on developer experience, available across multiple languages:</p><ul><li><a href="https://milvus.io/api-reference/pymilvus/v2.5.x/About.md">Python SDK v2 (pymilvus.MilvusClient)</a></li><li><a href="https://github.com/milvus-io/milvus-sdk-java">Java v2</a></li><li><a href="https://github.com/milvus-io/milvus/tree/client/v2.5.1/client">Go v2</a></li><li><a href="https://github.com/milvus-io/milvus-sdk-node">NodeJS</a></li><li><a href="https://milvus.io/api-reference/restful/v2.5.x/About.md">RESTful v2</a></li></ul><h4>1. Native Asynchronous Support: From Complex to Concurrent</h4><p>The old way of handling concurrency involved cumbersome Future objects and callback patterns. SDK v2 introduces true async/await functionality, particularly in Python with AsyncMilvusClient (since v2.5.3). With the same parameters as the synchronous MilvusClient, you can easily run operations like insert, query, and search in parallel.</p><p>This simplified approach replaces the old cumbersome Future and callback patterns, leading to cleaner and more efficient code. Complex concurrent logic, like batch vector inserts or parallel multi-queries, can now be effortlessly implemented using tools like asyncio.gather.</p><h4>2. Schema Cache: Boosting Performance Where It Counts</h4><p>SDK v2 introduces a Schema Cache that stores collection schemas locally after the initial fetch, eliminating repeated network requests and CPU overhead during operations.</p><p>For high-frequency insert and query scenarios, this update translates to:</p><ul><li>Reduced network traffic between client and server</li><li>Lower latency for operations</li><li>Decreased server-side CPU usage</li><li>Better scaling under high concurrency</li></ul><p>This is particularly valuable for applications like real-time recommendation systems or live search features where milliseconds matter.</p><h4>3. A Unified and Streamlined API Experience</h4><p>Milvus SDK v2 introduces a unified and more complete API experience across all supported programming languages. Particularly, the RESTful API has been significantly enhanced to offer near feature parity with the gRPC interface.</p><p>In earlier versions, the RESTful API lagged behind gRPC, limiting what developers could do without switching interfaces. That’s no longer the case. Now, developers can use the RESTful API to perform virtually all core operations — such as creating collections, managing partitions, building indexes, and running queries — without needing to fall back on gRPC or other methods.</p><p>This unified approach ensures a consistent developer experience across different environments and use cases. It reduces the learning curve, simplifies integration, and improves overall usability.</p><p>Note: For most users, the RESTful API offers a faster and easier way to get started with Milvus. However, if your application demands high-performance or advanced features like iterators, the gRPC client remains the go-to option for maximum flexibility and control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5DVb4AvFC5thYjCY.png" /></figure><h4>4. Aligned SDK Design Across All Languages</h4><p>With Milvus SDK v2, we’ve standardized the design of our SDKs across all supported programming languages to deliver a more consistent developer experience.</p><p>Whether you’re building with Python, Java, Go, or Node.js, each SDK now follows a unified structure centered around the MilvusClient class. This redesign brings consistent method naming, parameter formatting, and overall usage patterns to every language we support. (See: <a href="https://github.com/milvus-io/milvus/discussions/33979">MilvusClient SDK code example update · GitHub Discussion #33979</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*j-zOPgt30KNgOEkh.png" /></figure><p>Now, once you’re familiar with Milvus in one language, you can easily switch to another without having to relearn how the SDK works. This alignment not only simplifies onboarding but also makes multi-language development much smoother and more intuitive.</p><h4>5. A Simpler, Smarter PyMilvus (Python SDK) with MilvusClient</h4><p>In the previous version, PyMilvus relied on an ORM-style design that introduced a mix of object-oriented and procedural approaches. Developers had to define FieldSchema objects, build a CollectionSchema, and then instantiate a Collection class—all just to create a collection. This process was not only verbose but also introduced a steeper learning curve for new users.</p><p>With the new MilvusClient interface, things are much simpler. You can now create a collection in a single step using the create_collection() method. It allows you to quickly define the schema by passing parameters like dimension and metric_type, or you can still use a custom schema object if needed.</p><p>Even better, create_collection() supports index creation as part of the same call. If index parameters are provided, Milvus will automatically build the index and load the data into memory—no need for separate create_index() or load() calls. One method does it all: <em>create collection → build index → load collection.</em></p><p>This streamlined approach reduces setup complexity and makes it much easier to get started with Milvus, especially for developers who want a quick and efficient path to prototyping or production.</p><p>The new MilvusClient module offers clear advantages in usability, consistency, and performance. While the legacy ORM interface remains available for now, we plan to phase it out in the future (see <a href="https://docs.zilliz.com/reference/python/ORM#:~:text=About%20to%20Deprecate">reference</a>). We strongly recommend upgrading to the new SDK to take full advantage of the improvements.</p><h4>6. Clearer and More Comprehensive Documentation</h4><p>We have restructured the product documentation to provide a more complete and clearer <a href="https://milvus.io/docs">API Reference</a>. Our User Guides now include multi-language sample code, enabling you to get started quickly and understand Milvus’ features with ease. Additionally, the Ask AI assistant available on our documentation site can introduce new features, explain internal mechanisms, and even help generate or modify sample code, making your journey through the documentation smoother and more enjoyable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NeTr9ccV5PKMwG8z.png" /></figure><h4>7. Milvus MCP Server: Designed for the Future of AI Integration</h4><p>The <a href="https://github.com/zilliztech/mcp-server-milvus">MCP Server</a>, built on top of the Milvus SDK, is our answer to a growing need in the AI ecosystem: seamless integration between large language models (<a href="https://zilliz.com/glossary/large-language-models-(llms)">LLMs</a>), <a href="https://milvus.io/blog/what-is-a-vector-database.md">vector databases</a>, and external tools or data sources. It implements the Model Context Protocol (MCP), providing a unified and intelligent interface for orchestrating Milvus operations and beyond.</p><p>As <a href="https://zilliz.com/blog/top-10-ai-agents-to-watch-in-2025">AI agents</a> become more capable — not just generating code but autonomously managing backend services — the demand for smarter, API-driven infrastructure is rising. The MCP Server was designed with this future in mind. It enables intelligent and automated interactions with Milvus clusters, streamlining tasks like deployment, maintenance, and data management.</p><p>More importantly, it lays the groundwork for a new kind of machine-to-machine collaboration. With the MCP Server, AI agents can call APIs to dynamically create collections, run queries, build indexes, and more — all without human intervention.</p><p>In short, the MCP Server transforms Milvus into not just a database, but a fully programmable, AI-ready backend — paving the way for intelligent, autonomous, and scalable applications.</p><h4>Getting Started with Milvus SDK v2: Sample Code</h4><p>The examples below show how to use the new PyMilvus (Python SDK v2) interface to create a collection and perform asynchronous operations. Compared to the ORM-style approach in the previous version, this code is cleaner, more consistent, and easier to work with.</p><h4>1. Creating a Collection, Defining Schemas, Building Indexes, and Loading Data with MilvusClient</h4><p>The Python code snippet below demonstrates how to create a collection, define its schema, build indexes, and load data — all in one call:</p><pre>from pymilvus import MilvusClient, DataType<br><br># 1. Connect to Milvus (initialize the client)<br>client = MilvusClient(uri=&quot;http://localhost:19530&quot;)<br><br># 2. Define the collection schema<br>schema = MilvusClient.create_schema(auto_id=False, description=&quot;schema for example collection&quot;)<br>schema.add_field(&quot;id&quot;, DataType.INT64, is_primary=True)  # Primary key field<br>schema.add_field(&quot;embedding&quot;, DataType.FLOAT_VECTOR, dim=128)  # Vector field<br><br># 3. Prepare index parameters (optional if indexing at creation time)<br>index_params = client.prepare_index_params()<br>index_params.add_index(<br>    field_name=&quot;embedding&quot;,<br>    index_type=&quot;AUTOINDEX&quot;,<br>    metric_type=&quot;L2&quot;<br>)<br><br># 4. Create the collection with indexes and load it into memory automatically<br>client.create_collection(<br>    collection_name=&quot;example_collection&quot;,<br>    schema=schema,<br>    index_params=index_params<br>)<br><br>print(&quot;Collection created and loaded with index!&quot;)</pre><p>The create_collection method&#39;s index_params parameter eliminates the need for separate calls for create_index and load_collection—everything happens automatically.</p><p>In addition, MilvusClient supports a quick table creation mode. For example, a collection can be created in a single line of code by specifying only the required parameters:</p><pre>client.create_collection(<br>    collection_name=&quot;test_collection&quot;,<br>    dimension=128<br>)</pre><p><em>(Comparison note: In the old ORM approach, you had to create a </em><em>Collection(schema), then separately call </em><em>collection.create_index() and </em><em>collection.load(); now, MilvusClient streamlines the entire process.)</em></p><h4>2. Performing High-Concurrency Asynchronous Inserts with AsyncMilvusClient</h4><p>The following example shows how to use the AsyncMilvusClient to perform concurrent insert operations using async/await:</p><pre>import asyncio<br>from pymilvus import AsyncMilvusClient<br><br>async def insert_vectors_concurrently():<br>    client = AsyncMilvusClient(uri=&quot;http://localhost:19530&quot;)<br>    <br>    vectors_to_insert = [[...], [...], ...]  # Assume 100,000 vectors<br>    batch_size = 1000  # Recommended batch size<br>    tasks = []<br><br>    for i in range(0, len(vectors_to_insert), batch_size):<br>        batch_vectors = vectors_to_insert[i:i+batch_size]<br><br>        # Construct batch data<br>        data = [<br>            list(range(i, i + len(batch_vectors))),  # Batch IDs<br>            batch_vectors  # Batch vectors<br>        ]<br><br>        # Add an asynchronous task for inserting each batch<br>        tasks.append(client.insert(&quot;example_collection&quot;, data=data))<br><br>    # Concurrently execute batch inserts<br>    insert_results = await asyncio.gather(*tasks)<br>    await client.close()<br><br># Execute asynchronous tasks<br>asyncio.run(insert_vectors_concurrently())</pre><p>In this example, AsyncMilvusClient is used to concurrently insert data by scheduling multiple insertion tasks with asyncio.gather. This approach takes full advantage of Milvus&#39; backend concurrent processing capabilities. Unlike the synchronous, line-by-line insertions in v1, this native asynchronous support dramatically increases throughput.</p><p>Similarly, you can modify the code to perform concurrent queries or searches — for example, by replacing the insert call with client.search(&quot;example_collection&quot;, data=[query_vec], limit=5). Milvus SDK v2&#39;s asynchronous interface ensures that each request is executed in a non-blocking manner, fully leveraging both client and server resources.</p><h4>Migration Made Easy</h4><p>We know you’ve invested time in SDK v1, so we’ve designed SDK v2 with your existing applications in mind. SDK v2 includes backward compatibility, so existing v1/ORM-style interfaces will continue to work for a while. But we strongly recommend upgrading to SDK v2 as soon as possible — support for v1 will end with the release of Milvus 3.0 (end of 2025).</p><p>Moving to SDK v2 unlocks a more consistent, modern developer experience with simplified syntax, better async support, and improved performance. It’s also where all new features and community support are focused going forward. Upgrading now ensures you’re ready for what’s next and gives you access to the best Milvus has to offer.</p><h4>Conclusion</h4><p>Milvus SDK v2 brings significant improvements over v1: enhanced performance, a unified and consistent interface across multiple programming languages, and native asynchronous support that simplifies high-concurrency operations. With clearer documentation and more intuitive code examples, Milvus SDK v2 is designed to streamline your development process, making it easier and faster to build and deploy AI applications.</p><p>For more detailed information, please refer to our latest official <a href="https://milvus.io/docs/install-pymilvus.md#Install-Milvus-Python-SDK">API Reference and User Guides</a>. If you have any questions or suggestions regarding the new SDK, feel free to provide feedback on <a href="https://github.com/milvus-io/milvus/discussions">GitHub</a> and <a href="https://discord.com/invite/8uyFbECzPX">Discord</a>. We look forward to your input as we continue to enhance Milvus.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=388c3eb6fa2d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/introducing-milvus-sdk-v2-native-async-support-unified-apis-and-superior-performance-388c3eb6fa2d">Introducing Milvus SDK v2: Native Async Support, Unified APIs, and Superior Performance</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parsing is Hard: Solving Semantic Understanding with Mistral OCR and Milvus]]></title>
            <link>https://medium.com/vector-database/parsing-is-hard-solving-semantic-understanding-with-mistral-ocr-and-milvus-ff1866ae51e6?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/ff1866ae51e6</guid>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Mon, 28 Apr 2025 05:05:27 GMT</pubDate>
            <atom:updated>2025-04-28T02:50:22.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*fJS6f7VtIN3-LMXd.png" /></figure><p>Let’s face it: parsing documents is hard — really hard. PDFs, images, reports, tables, messy handwriting; they’re packed with valuable information that your users want to search for, but extracting that information and express that accurately in your search index is like solving a puzzle where the pieces keep changing shape: you thought you’ve solved it with an extra line of code but tomorrow a new doc gets ingested and you find another corner case to deal with.</p><p>In this post, we’ll tackle this challenge head-on using the powerful combo of Mistral OCR and Milvus Vector DB, turning your doc parsing nightmares into a calm dream with searchable, semantically meaningful vector embeddings.</p><h4>Why Rule-based Parsing Just Won’t Cut It</h4><p>If you’ve ever struggled with standard OCR tools, you probably know that they have all sorts of issues:</p><ul><li><strong>Complex layouts</strong>: Tables, lists, multi-column formats — they can break or pose issues to most parsers.</li><li><strong>Semantic ambiguity</strong>: Keywords alone don’t tell you if “apple” means fruit or company.</li><li>The chanllege of scale and cost: Processing thousands of documents becomes painfully slow.</li></ul><p>We need a smarter, more systematic approach that doesn’t just extract text — it <em>understands</em> the content. And that’s exactly where Mistral OCR and Milvus come in.</p><h4>Meet Your Dream Team</h4><h4>Mistral OCR: More than just text extraction</h4><p>Mistral OCR isn’t your average OCR tool. It’s designed to tackle a wide range of documents.</p><ul><li><strong>Deep Understanding of Complex Documents</strong>: Whether it’s embedded images, mathematical equations, or tables, it can understand it all with a very high accuracy.</li><li><strong>Keeps original layouts:</strong> Not only does it understand the different layouts in the documents, it also keeps the original layouts and structure intact. On top of that, it’s also capable of parsing multi-page documents.</li><li><strong>Multilingual and Multimodal Mastery</strong>: From English to Hindi to Arabic, Mistral OCR can comprehend documents across thousands of languages and scripts, making it invaluable for applications targeting a global user base.</li></ul><h4>Milvus: Your Vector Database Built for Scale</h4><ul><li><strong>Billion+ Scale</strong>: <a href="https://milvus.io/">Milvus</a> can scale to billions of vectors, making it perfect for storing large-scale documents.</li><li><strong>Full-Text Search: In addition to supporting dense vector embeddings</strong>, Milvus also supports Full Text Search. Making it easy to run queries using text and get better results for your RAG system.</li></ul><h4>Examples:</h4><p>Let’s take this handwritten note in English, for example. Using a regular OCR tool to extract this text would be a very hard task.</p><figure><img alt="A handwritten note in English " src="https://cdn-images-1.medium.com/max/640/0*on983TtW-16OMXas.png" /></figure><p>We process it with Mistral OCR</p><pre>api_key = os.getenv(&quot;MISTRAL_API_KEY&quot;)<br>client = Mistral(api_key=api_key)<br><br>url = &quot;https://preview.redd.it/ocr-for-handwritten-documents-v0-os036yiv9xod1.png?width=640&amp;format=png&amp;auto=webp&amp;s=29461b68383534a3c1bf76cc9e36a2ba4de13c86&quot;<br>result = client.ocr.process(<br>                model=ocr_model, document={&quot;type&quot;: &quot;image_url&quot;, &quot;image_url&quot;: url}<br>            )<br>print(f&quot;Result: {result.pages[0].markdown}&quot;)</pre><p>And we get the following output. It can recognize handwritten text well. We can see that it even keeps the capitalized format of the words “FORCED AND UNNATURAL”!</p><pre>Today is Thursday, October 20th - But it definitely feels like a Friday. I&#39;m already considering making a second cup of coffee - and I haven&#39;t even finished my first. Do I have a problem?<br>Sometimes I&#39;ll fly through older notes I&#39;ve taken, and my handwriting is unrecamptable. Perhaps it depends on the type of pen I use. I&#39;ve tried writing in all cups but it looks so FORCED AND UNNATURAL.<br>Often times, I&#39;ll just take notes on my lapten, but I still seem to ermittelt forward pen and paper. Any advice on what to<br>improve? I already feel stressed at looking back at what I&#39;ve just written - it looks like I different people wrote this!</pre><p>Now we can then insert the text into Milvus for semantic search.</p><pre>from pymilvus import MilvusClient <br><br>COLLECTION_NAME = &quot;document_ocr&quot;<br><br>milvus_client = MilvusClient(uri=&#39;http://localhost:19530&#39;)<br>&quot;&quot;&quot;<br>This is where you would define the index, create a collection etc. For the sake of this example. I am skipping it. <br><br>schema = CollectionSchema(...)<br><br>milvus_client.create_collection(<br>    collection_name=COLLECTION_NAME,<br>    schema=schema,<br>    )<br><br>&quot;&quot;&quot;<br><br>milvus_client.insert(collection_name=COLLECTION_NAME, data=[result.pages[0].markdown])</pre><p>But Mistral can also understand documents in different languages or in more complex format, for example let’s try this invoice in German that combines some item names in English.</p><figure><img alt="An Invoice in German" src="https://cdn-images-1.medium.com/max/1024/0*tC_SzfmHBiuEzqZP.png" /></figure><p>Mistral OCR is still capable of extracting all the information you have and it even creates the table structure in Markdown that represents the table from the scanned image.</p><pre>Rechnungsadresse:<br><br>Jähn Jessel GmbH a. Co. KG Marianne Scheibe Karla-Löffler-Weg 2 66522 Wismar<br><br>Lieferadresse:<br><br>Jähn Jessel GmbH a. Co. KG Marianne Scheibe Karla-Löffler-Weg 2 66522 Wismar<br><br>Rechnungsinformationen:<br><br>Bestelldatum: 2004-10-20<br>Bezahit: Ja<br>Expressversand: Nein<br>Rechnungsnummer: 4652<br><br>Rechnungsübersicht<br><br>| Pos. | Produkt | Preis &lt;br&gt; (Netto) | Menge | Steuersatz | Summe &lt;br&gt; Brutto |<br>| :--: | :--: | :--: | :--: | :--: | :--: |<br>| 1 | Grundig CH 7280w Multi-Zerkleinerer (Gourmet, 400 Watt, 11 Glasbehälter), weiß | 183.49 C | 2 | $0 \%$ | 366.98 C |<br>| 2 | Planet K | 349.9 C | 2 | $19.0 \%$ | 832.76 C |<br>| 3 | The Cabin in the Woods (Blu-ray) | 159.1 C | 2 | $7.0 \%$ | 340.47 C |<br>| 4 | Schenkung auf Italienisch Taschenbuch - 30. | 274.33 C | 4 | $19.0 \%$ | 1305.81 C |<br>| 5 | Xbox 360 - Razer 0N2A Controller Tournament Edition | 227.6 C | 2 | $7.0 \%$ | 487.06 C |<br>| 6 | Philips LED-Lampe ersetzt 25Watt E27 2700 Kelvin - warm-weiß, 2.7 Watt, 250 Lumen IEnergieklasse A++I | 347.57 C | 3 | $7.0 \%$ | 1115.7 C |<br>| 7 | Spannende Abenteuer Die verschollene Grabkammer | 242.8 C | 6 | $0 \%$ | 1456.8 C |<br>| Zw. summe |  | 1784.79 C |  |  |  |<br>| Zzgl. Mwst. 7\% |  | 51.4 C |  |  |  |<br>| Zzgl. Mwst. 19\% |  | 118.6 C |  |  |  |<br>| Gesamtbetrag C inkl. MwSt. |  | 1954.79 C |  |  |  |</pre><h4>Real-World Usage: A Case Study</h4><p>Now that we’ve seen that Mistral OCR can work on different documents, we could imagine how a legal firm that is drowning in case files and contracts leverage this tool. By implementing a RAG system with Mistral OCR and Milvus, what once took a paralegal countless hours, like manually scanning for specific clauses or comparing past cases, now is done by AI in only a couple of minutes.</p><h4>Next Steps</h4><p>Ready to extract all your content? Head over to the <a href="https://github.com/milvus-io/bootcamp/blob/master/bootcamp/tutorials/integration/mistral_ocr_with_milvus.ipynb">notebook on GitHub</a> for the full example, join our <a href="http://zilliz.com/discord">Discord</a> to chat with the community, and start building today! You can also check out <a href="https://docs.mistral.ai/capabilities/document/">Mistral documentation</a> about their OCR model</p><p>Say goodbye to parsing chaos, and hello to intelligent, scalable document understanding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff1866ae51e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/parsing-is-hard-solving-semantic-understanding-with-mistral-ocr-and-milvus-ff1866ae51e6">Parsing is Hard: Solving Semantic Understanding with Mistral OCR and Milvus</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing DeepSearcher: A Local Open Source Deep Research]]></title>
            <link>https://medium.com/vector-database/introducing-deepsearcher-a-local-open-source-deep-research-2fa6c454b303?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/2fa6c454b303</guid>
            <category><![CDATA[deepsearcher]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 04:01:53 GMT</pubDate>
            <atom:updated>2025-04-18T08:16:35.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="deep researcher.gif" src="https://cdn-images-1.medium.com/max/786/0*06E7bsHOhp9Bjdfg.gif" /></figure><p>In the previous post, <a href="https://milvus.io/blog/i-built-a-deep-research-with-open-source-so-can-you.md"><em>“I Built a Deep Research with Open Source — and So Can You!”</em></a>, we explained some of the principles underlying research agents and constructed a simple prototype that generates detailed reports on a given topic or question. The article and corresponding notebook demonstrated the fundamental concepts of <em>tool use</em>, <em>query decomposition</em>, <em>reasoning</em>, and <em>reflection</em>. The example in our previous post, in contrast to OpenAI’s Deep Research, ran locally, using only open-source models and tools like <a href="https://milvus.io/docs">Milvus</a> and LangChain. (I encourage you to read the <a href="https://milvus.io/blog/i-built-a-deep-research-with-open-source-so-can-you.md">above article</a> before continuing.)</p><p>In the following weeks, there was an explosion of interest in understanding and reproducing OpenAI’s Deep Research. See, for example, <a href="https://www.perplexity.ai/hub/blog/introducing-perplexity-deep-research">Perplexity Deep Research</a> and <a href="https://huggingface.co/blog/open-deep-research">Hugging Face’s Open DeepResearch</a>. These tools differ in architecture and methodology although sharing an objective: iteratively research a topic or question by surfing the web or internal documents and output a detailed, informed, and well-structured report. Importantly, the underlying agent automates reasoning about what action to take at each intermediate step.</p><p>In this post, we build upon our previous post and present Zilliz’s <a href="https://github.com/zilliztech/deep-searcher">DeepSearcher</a> open-source project. Our agent demonstrates additional concepts: <em>query routing, conditional execution flow</em>, and <em>web crawling as a tool</em>. It is presented as a Python library and command-line tool rather than a Jupyter notebook and is more fully-featured than our previous post. For example, it can input multiple source documents and can set the embedding model and vector database used via a configuration file. While still relatively simple, DeepSearcher is a great showcase of agentic RAG and is a further step towards a state-of-the-art AI applications.</p><p>Additionally, we explore the need for faster and more efficient inference services. Reasoning models make use of “inference scaling”, that is, extra computation, to improve their output, and that combined with the fact that a single report may require hundreds or thousands of LLM calls results in inference bandwidth being the primary bottleneck. We use the <a href="https://sambanova.ai/press/fastest-deepseek-r1-671b-with-highest-efficiency">DeepSeek-R1 reasoning model on SambaNova’s custom-built hardware</a>, which is twice as fast in output tokens-per-second as the nearest competitor (see figure below).</p><p>SambaNova Cloud also provides inference-as-a-service for other open-source models including Llama 3.x, Qwen2.5, and QwQ. The inference service runs on SambaNova’s custom chip called the reconfigurable dataflow unit (RDU), which is specially designed for efficient inference on Generative AI models, lowering cost and increasing inference speed. <a href="https://sambanova.ai/technology/sn40l-rdu-ai-chip">Find out more on their website.</a></p><figure><img alt="Output speed- deepseek r1.png" src="https://cdn-images-1.medium.com/max/1024/0*1LtQ6aVtPDGva0Od.png" /></figure><h4>DeepSearcher Architecture</h4><p>The architecture of <a href="https://github.com/zilliztech/deep-searcher">DeepSearcher</a> follows our previous post by breaking the problem up into four steps — <em>define/refine the question</em>, <em>research</em>, <em>analyze</em>, <em>synthesize</em> — although this time with some overlap. We go through each step, highlighting <a href="https://github.com/zilliztech/deep-searcher">DeepSearcher</a>’s improvements.</p><figure><img alt="deepsearcher architecture.png" src="https://cdn-images-1.medium.com/max/1024/0*g3nc41SNMs0Ji4cy.png" /></figure><h4>Define and Refine the Question</h4><pre>Break down the original query into new sub queries: [<br>  &#39;How has the cultural impact and societal relevance of The Simpsons evolved from its debut to the present?&#39;,<br>  &#39;What changes in character development, humor, and storytelling styles have occurred across different seasons of The Simpsons?&#39;, <br>  &#39;How has the animation style and production technology of The Simpsons changed over time?&#39;,<br>  &#39;How have audience demographics, reception, and ratings of The Simpsons shifted throughout its run?&#39;]</pre><p>In the design of DeepSearcher, the boundaries between researching and refining the question are blurred. The initial user query is decomposed into sub-queries, much like the previous post. See above for initial subqueries produced from the query “How has The Simpsons changed over time?”. However, the following research step will continue to refine the question as needed.</p><h4>Research and Analyze</h4><p>Having broken down the query into sub-queries, the research portion of the agent begins. It has, roughly speaking, four steps: <em>routing</em>, <em>search</em>, <em>reflection, and conditional repeat</em>.</p><h4>Routing</h4><p>Our database contains multiple tables or collections from different sources. It would be more efficient if we could restrict our semantic search to only those sources that are relevant to the query at hand. A query router prompts an LLM to decide from which collections information should be retrieved.</p><p>Here is the method to form the query routing prompt:</p><pre>def get_vector_db_search_prompt(<br>    question: str,<br>    collection_names: List[str],<br>    collection_descriptions: List[str],<br>    context: List[str] = None,<br>):<br>    sections = []<br>    # common prompt<br>    common_prompt = f&quot;&quot;&quot;You are an advanced AI problem analyst. Use your reasoning ability and historical conversation information, based on all the existing data sets, to get absolutely accurate answers to the following questions, and generate a suitable question for each data set according to the data set description that may be related to the question.<br><br>Question: {question}<br>&quot;&quot;&quot;<br>    sections.append(common_prompt)<br>    <br>    # data set prompt<br>    data_set = []<br>    for i, collection_name in enumerate(collection_names):<br>        data_set.append(f&quot;{collection_name}: {collection_descriptions[i]}&quot;)<br>    data_set_prompt = f&quot;&quot;&quot;The following is all the data set information. The format of data set information is data set name: data set description.<br><br>Data Sets And Descriptions:<br>&quot;&quot;&quot;<br>    sections.append(data_set_prompt + &quot;\n&quot;.join(data_set))<br>    <br>    # context prompt<br>    if context:<br>        context_prompt = f&quot;&quot;&quot;The following is a condensed version of the historical conversation. This information needs to be combined in this analysis to generate questions that are closer to the answer. You must not generate the same or similar questions for the same data set, nor can you regenerate questions for data sets that have been determined to be unrelated.<br><br>Historical Conversation:<br>&quot;&quot;&quot;<br>        sections.append(context_prompt + &quot;\n&quot;.join(context))<br>    <br>    # response prompt<br>    response_prompt = f&quot;&quot;&quot;Based on the above, you can only select a few datasets from the following dataset list to generate appropriate related questions for the selected datasets in order to solve the above problems. The output format is json, where the key is the name of the dataset and the value is the corresponding generated question.<br><br>Data Sets:<br>&quot;&quot;&quot;<br>    sections.append(response_prompt + &quot;\n&quot;.join(collection_names))<br>    <br>    footer = &quot;&quot;&quot;Respond exclusively in valid JSON format matching exact JSON schema.<br><br>Critical Requirements:<br>- Include ONLY ONE action type<br>- Never add unsupported keys<br>- Exclude all non-JSON text, markdown, or explanations<br>- Maintain strict JSON syntax&quot;&quot;&quot;<br>    sections.append(footer)<br>    return &quot;\n\n&quot;.join(sections)</pre><p>We make the LLM return structured output as JSON in order to easily convert its output to a decision on what to do next.</p><h4>Search</h4><p>Having selected various database collections via the previous step, the search step performs a similarity search with <a href="https://milvus.io/docs">Milvus</a>. Much like the previous post, the source data has been specified in advance, chunked, embedded, and stored in the vector database. For DeepSearcher, the data sources, both local and online, must be manually specified. We leave online search for future work.</p><h4>Reflection</h4><p>Unlike the previous post, DeepSearcher illustrates a true form of agentic reflection, inputting the prior outputs as context into a prompt that “reflects” on whether the questions asked so far and the relevant retrieved chunks contain any informational gaps. This can be seen as an analysis step.</p><p>Here is the method to create the prompt:</p><pre>def get_reflect_prompt(<br>   question: str,<br>   mini_questions: List[str],<br>   mini_chuncks: List[str],<br>):<br>    mini_chunk_str = &quot;&quot;<br>    for i, chunk in enumerate(mini_chuncks):<br>        mini_chunk_str += f&quot;&quot;&quot;&lt;chunk_{i}&gt;\n{chunk}\n&lt;/chunk_{i}&gt;\n&quot;&quot;&quot;<br>    reflect_prompt = f&quot;&quot;&quot;Determine whether additional search queries are needed based on the original query, previous sub queries, and all retrieved document chunks. If further research is required, provide a Python list of up to 3 search queries. If no further research is required, return an empty list.<br><br>If the original query is to write a report, then you prefer to generate some further queries, instead return an empty list.<br><br>    Original Query: {question}<br>    Previous Sub Queries: {mini_questions}<br>    Related Chunks: <br>    {mini_chunk_str}<br>    &quot;&quot;&quot;<br>   <br>    <br>    footer = &quot;&quot;&quot;Respond exclusively in valid List of str format without any other text.&quot;&quot;&quot;<br>    return reflect_prompt + footer</pre><p>Once more, we make the LLM return structured output, this time as Python-interpretable data.</p><p>Here is an example of new sub-queries “discovered” by reflection after answering the initial sub-queries above:</p><pre>New search queries for next iteration: [<br>  &quot;How have changes in The Simpsons&#39; voice cast and production team influenced the show&#39;s evolution over different seasons?&quot;,<br>  &quot;What role has The Simpsons&#39; satire and social commentary played in its adaptation to contemporary issues across decades?&quot;,<br>  &#39;How has The Simpsons addressed and incorporated shifts in media consumption, such as streaming services, into its distribution and content strategies?&#39;]</pre><h4>Conditional Repeat</h4><p>Unlike our previous post, DeepSearcher illustrates conditional execution flow. After reflecting on whether the questions and answers so far are complete, if there are additional questions to be asked the agent repeats the above steps. Importantly, the execution flow (a while loop) is a function of the LLM output rather than being hard-coded. In this case there is only a binary choice: <em>repeat research</em> or <em>generate a report</em>. In more complex agents there may be several such as: <em>follow hyperlink</em>, <em>retrieve chunks, store in memory, reflect</em> etc. In this way, the question continues to be refined as the agent sees fit until it decides to exit the loop and generate the report. In our Simpsons example, DeepSearcher performs two more rounds of filling the gaps with extra sub-queries.</p><h4>Synthesize</h4><p>Finally, the fully decomposed question and retrieved chunks are synthesized into a report with a single prompt. Here is the code to create the prompt:</p><pre>def get_final_answer_prompt(<br>   question: str, <br>   mini_questions: List[str],<br>   mini_chuncks: List[str],<br>):<br>    mini_chunk_str = &quot;&quot;<br>    for i, chunk in enumerate(mini_chuncks):<br>        mini_chunk_str += f&quot;&quot;&quot;&lt;chunk_{i}&gt;\n{chunk}\n&lt;/chunk_{i}&gt;\n&quot;&quot;&quot;<br>    summary_prompt = f&quot;&quot;&quot;You are an AI content analysis expert, good at summarizing content. Please summarize a specific and detailed answer or report based on the previous queries and the retrieved document chunks.<br><br>    Original Query: {question}<br>    Previous Sub Queries: {mini_questions}<br>    Related Chunks: <br>    {mini_chunk_str}<br>    &quot;&quot;&quot;<br>    return summary_prompt</pre><p>This approach has the advantage over our prototype, which analyzed each question separately and simply concatenated the output, of producing a report where all sections are consistent with each other, i.e., containing no repeated or contradictory information. A more complex system could combine aspects of both, using a conditional execution flow to structure the report, summarize, rewrite, reflect and pivot, and so on, which we leave for future work.</p><h4>Results</h4><p>Here is a sample from the report generated by the query “How has The Simpsons changed over time?” with DeepSeek-R1 passing the Wikipedia page on The Simpsons as source material:</p><pre>Report: The Evolution of The Simpsons (1989–Present)<br>1. Cultural Impact and Societal Relevance<br>The Simpsons debuted as a subversive critique of American middle-class life, gaining notoriety for its bold satire in the 1990s. Initially a countercultural phenomenon, it challenged norms with episodes tackling religion, politics, and consumerism. Over time, its cultural dominance waned as competitors like South Park and Family Guy pushed boundaries further. By the 2010s, the show transitioned from trendsetter to nostalgic institution, balancing legacy appeal with attempts to address modern issues like climate change and LGBTQ+ rights, albeit with less societal resonance.<br>…<br>Conclusion<br>The Simpsons evolved from a radical satire to a television institution, navigating shifts in technology, politics, and audience expectations. While its golden-age brilliance remains unmatched, its adaptability—through streaming, updated humor, and global outreach—secures its place as a cultural touchstone. The show’s longevity reflects both nostalgia and a pragmatic embrace of change, even as it grapples with the challenges of relevance in a fragmented media landscape.</pre><p>Find <a href="https://drive.google.com/file/d/1GE3rvxFFTKqro67ctTkknryUf-ojhduN/view?usp=sharing">the full report here</a>, and <a href="https://drive.google.com/file/d/1EGd16sJDNFnssk9yTd5o9jzbizrY_NS_/view?usp=sharing">a report produced by DeepSearcher with GPT-4o mini</a> for comparison.</p><h4>Discussion</h4><p>We presented <a href="https://github.com/zilliztech/deep-searcher">DeepSearcher</a>, an agent for performing research and writing reports. Our system is built upon the idea in our previous article, adding features like conditional execution flow, query routing, and an improved interface. We switched from local inference with a small 4-bit quantized reasoning model to an online inference service for the massive DeepSeek-R1 model, qualitatively improving our output report. DeepSearcher works with most inference services like OpenAI, Gemini, DeepSeek and Grok 3 (coming soon!).</p><p>Reasoning models, especially as used in research agents, are inference-heavy, and we were fortunate to be able to use the fastest offering of DeepSeek-R1 from SambaNova running on their custom hardware. For our demonstration query, we made sixty-five calls to SambaNova’s DeepSeek-R1 inference service, inputting around 25k tokens, outputting 22k tokens, and costing $0.30. We were impressed with the speed of inference given that the model contains 671-billion parameters and is 3/4 of a terabyte large. <a href="https://sambanova.ai/press/fastest-deepseek-r1-671b-with-highest-efficiency">Find out more details here!</a></p><p>We will continue to iterate on this work in future posts, examining additional agentic concepts and the design space of research agents. In the meanwhile, we invite everyone to try out <a href="https://github.com/zilliztech/deep-searcher">DeepSearcher</a>, <a href="https://github.com/zilliztech/deep-searcher">star us on GitHub</a>, and share your feedback!</p><h4>Resources</h4><ul><li><a href="https://github.com/zilliztech/deep-searcher"><strong>Zilliz’s DeepSearcher</strong></a></li><li>Background reading: <a href="https://milvus.io/blog/i-built-a-deep-research-with-open-source-so-can-you.md"><strong><em>“I Built a Deep Research with Open Source — and So Can You!”</em></strong></a></li><li><em>“</em><a href="https://sambanova.ai/press/fastest-deepseek-r1-671b-with-highest-efficiency"><strong>SambaNova Launches the Fastest DeepSeek-R1 671B with the Highest Efficiency</strong></a><em>”</em></li><li>DeepSearcher: <a href="https://drive.google.com/file/d/1GE3rvxFFTKqro67ctTkknryUf-ojhduN/view?usp=sharing">DeepSeek-R1 report on The Simpsons</a></li><li>DeepSearcher: <a href="https://drive.google.com/file/d/1EGd16sJDNFnssk9yTd5o9jzbizrY_NS_/view?usp=sharing">GPT-4o mini report on The Simpsons</a></li><li><a href="https://milvus.io/docs">Milvus Open-Source Vector Database</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fa6c454b303" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/introducing-deepsearcher-a-local-open-source-deep-research-2fa6c454b303">Introducing DeepSearcher: A Local Open Source Deep Research</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Milvus Users Taught Us in 2024]]></title>
            <link>https://medium.com/vector-database/what-milvus-users-taught-us-in-2024-7e082d0e1759?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/7e082d0e1759</guid>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Tue, 18 Feb 2025 13:44:33 GMT</pubDate>
            <atom:updated>2025-02-18T13:44:33.686Z</atom:updated>
            <content:encoded><![CDATA[<h4>Overview</h4><p>As Milvus flourished in 2024 with major releases and a thriving open-source ecosystem, a hidden treasure trove of user insights was quietly forming in our community on <a href="https://discord.gg/xwqmFDURcz">Discord</a>. This compilation of community discussions presented a unique opportunity to understand our users’ challenges firsthand. Intrigued by this untapped resource, I embarked on a comprehensive analysis of every discussion thread from the year, searching for patterns that could help us compile a frequently asked questions resource for Milvus users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XRPW7SE2icbtuOHG.png" /></figure><p>My analysis revealed three primary areas where users consistently sought guidance: <strong>Performance Optimization</strong>, <strong>Deployment Strategies</strong>, and <strong>Data Management</strong>. Users frequently discussed how to fine-tune Milvus for production environments and track performance metrics effectively. When it came to deployment, the community grappled with selecting appropriate deployments, choosing optimal search indices, and resolving issues in distributed setups. The data management conversations centered around service-to-service data migration strategies and the selection of embedding models.</p><p>Let’s examine each of these areas in more detail.</p><h4>Deployment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uuMyvwlSxRVa0dHt.png" /></figure><p>Milvus provides flexible deployment modes to fit various use cases. However, some users do find it challenging to find the right choice, and want to feel comfortable that they are doing so “correctly.”</p><h4>Which deployment type should I choose?</h4><p>A very frequent question is which deployment to choose out of Milvus <a href="https://milvus.io/docs/milvus_lite.md">Lite</a>, <a href="https://milvus.io/docs/prerequisite-docker.md">Standalone</a>, and <a href="https://milvus.io/docs/prerequisite-helm.md">Distributed</a>. The answer primarily depends on how large your vector database needs to be and how much traffic it will serve:</p><h4>Milvus Lite</h4><p>When prototyping on your local system with up to a few million vectors, or looking for an embedded vector db for unit testing and CI/CD, you can use Milvus Lite. Note that some more advanced features like full-text search are not yet available within Milvus Lite but coming soon.</p><h4>Milvus Standalone</h4><p>If your system needs to serve production traffic and / or you need to store between a few million and a hundred-million vectors, you should use Milvus Standalone, which packs all components of Milvus into a single Docker image. There is a variation which just takes its persistent storage (minio) and metadata store (etcd) dependencies out as separate images.</p><h4>Milvus Distributed</h4><p>For any larger scale deployments serving production traffic, like serving billions of vectors at thousands of QPS, you should use Milvus Distributed. Some users may want to perform offline batch processing at scale, for example, for data deduplication or record linkage, and the future version of Milvus 3.0 will provide a more efficient way of doing this by what we term a vector lake.</p><h4>Fully Managed Service</h4><p>For developers who want to focus on the application development without worrying about DevOps, <a href="https://cloud.zilliz.com/signup">Zilliz Cloud</a> is the fully managed Milvus that offers a free tier.</p><p>See <a href="https://milvus.io/docs/install-overview.md#Choose-the-Right-Deployment-for-Your-Use-Case">“Overview of Milvus Deployments”</a> for more information.</p><h4>How much memory, storage, and compute will I require?</h4><p>This question comes up a lot, not only for existing Milvus users but also those who are considering whether Milvus is appropriate for their application. The exact combination of how much memory, storage, and compute a deployment will require depends on complex interaction of factors.</p><p>Vector embeddings differ in dimensionality due to the model that is used. And some vector search indexes are stored entirely in memory, whereas others store data to disk. Also, many search indexes are able to store a compressed (quantized) copy of the embeddings and require additional memory for graph data structures. These are just a few factors that affect the memory and storage.</p><h4>Milvus Resource Sizing Tool</h4><p>Luckily, Zilliz (the team that maintains Milvus) has built <a href="https://milvus.io/tools/sizing">a resource sizing tool</a> that does a fantastic job of answering this question. Input your vector dimensionality, index type, deployment options, and so on and the tool estimates CPU, memory, and storage needed across the various types of Milvus nodes and its dependencies. Your mileage may vary so a real load testing with your data and sample traffic is always a good idea.</p><h4>Which vector index or distance metric should I choose?</h4><p>Many users are uncertain which index they should choose and how to set the hyperparameters. First, it is always possible to defer the choice of index type to Milvus by selecting AUTOINDEX. If you wish to select a specific index type, however, a few rules of thumb provide a starting point.</p><h4>In-Memory Indexes</h4><p>Would you like to pay the cost to fit your index entirely into memory? An in-memory index is typically the fastest but also expensive. See <a href="https://milvus.io/docs/index.md?tab=floating">“In-memory indexes”</a> for a list of the ones supported by Milvus and the tradeoffs they make in terms of latency, memory, and recall.</p><p>Keep in mind that your index size is not simply the number of vectors times their dimensionality and floating point size. Most indexes quantize the vectors to reduce memory usage, but require memory for additional data structures. Other non-vector data (scalar) and their index also takes up memory space.</p><h4>On-Disk Indexes</h4><p>When your index does not fit in memory, you can use one of the <a href="https://milvus.io/docs/disk_index.md">“On-disk indexes”</a> provided by Milvus. Two choices with very different latency/resource tradeoffs are <a href="https://milvus.io/docs/disk_index.md">DiskANN</a> and <a href="https://milvus.io/docs/mmap.md#MMap-enabled-Data-Storage">MMap</a>.</p><p>DiskANN stores a highly compressed copy of the vectors in memory, and the uncompressed vectors and graph search structures on disk. It uses some clever ideas to search the vector space while minimizing disk reads and takes advantage of the fast random access speed of SSDs. For minimum latency, the SSD must be connected via NVMe rather than SATA for best I/O performance.</p><p>Technically speaking, MMap is not an index type, but refers to the use of virtual memory with an in-memory index. With virtual memory, pages can be swapped between disk and RAM as required, which allows a much larger index to be used efficiently if the access patterns are such that only a small portion of the data is used at a time.</p><p>DiskANN has excellent and consistent latency. MMap has even better latency when it is accessing a page in-memory, but frequent page-swapping will cause latency spikes. Thus MMap can have a higher variability in latency, depending on the memory access patterns.</p><h4>GPU Indexes</h4><p>A third option is to construct <a href="https://milvus.io/docs/gpu_index.md">an index using GPU memory and compute</a>. Milvus’ GPU support is contributed by the Nvidia <a href="https://rapids.ai/">RAPIDS</a> team. GPU vector search may have lower latency than a corresponding CPU search, although it usually takes hundreds or thousands of search QPS to fully exploit the parallelism of GPU. Also, GPUs typically have less memory than the CPU RAM and are more costly to run.</p><h4>Distance Metrics</h4><p>An easier question to answer is which distance metric should you choose to measure similarity between vectors. It is recommended to choose the same distance metric that your embedding model was trained with, which is typically COSINE (or IP when inputs are normalized). The source of your model (e.g. the model page on HuggingFace) will provide clarification on which distance metric was used. Zilliz also put together a convenient <a href="https://zilliz.com/ai-models">table</a> to look that up.</p><p>To summarize, I think a lot of the uncertainty around index choice revolves around uncertainty about how these choices affect the latency/resource usage/recall tradeoff of your deployment. I recommend using the rules of thumb above to decide between in-memory, on-disk, or GPU indexes, and then using the tradeoff guidelines given in the Milvus documentation to pick a particular one.</p><h4>Can you fix my broken Milvus Distributed deployment?</h4><p>Many questions revolve around issues getting a Milvus Distributed deployment up and running, with questions relating to configuration, tooling, and debugging logs. It’s hard to give a single fix as each question seems different from the last, although luckily Milvus has <a href="https://milvus.io/discord">a vibrant Discord</a> where you can seek help, and we also offer <a href="https://milvus.io/blog/join-milvus-office-hours-to-get-support-from-vectordb-experts.md">1-on-1 office hours with an expert</a>.</p><h4>How do I deploy Milvus on Windows?</h4><p>A question that has come up several times is how to deploy Milvus on Windows machines. Based on your feedback, we have rewritten the documentation for this: see <a href="https://milvus.io/docs/install_standalone-windows.md">Run Milvus in Docker (Windows)</a> for how to do this, using <a href="https://learn.microsoft.com/en-us/windows/wsl/about#what-is-wsl-2">Windows Subsystem for Linux 2 (WSL2)</a>.</p><h4>Performance and Profiling</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jl16cpcyFl5v_5SK.png" /></figure><p>Having chosen a deployment type and got it running, users want to feel comfortable that they have made optimal decisions and would like to profile their deployment’s performance and state. Many questions related to how to profile performance, observe state, and get an insight into what and why.</p><h4>How do I measure performance?</h4><p>Users want to check metrics related to the performance of their deployment so they can understand and remedy bottlenecks. Metrics mentioned include average query latency, distribution of latencies, query volume, memory usage, disk storage, and so on. While obtaining these metrics with <a href="https://milvus.io/docs/monitor_overview.md">the legacy monitoring system</a> has been challenging, Milvus 2.5 introduces a new system called <a href="https://milvus.io/docs/milvus-webui.md#Milvus-WebUI">WebUI</a> (feedback welcome!), which allows you to access all this information from a user-friendly web interface.</p><h4>What’s happening inside Milvus right now (i.e. observe state)?</h4><p>Relatedly, users want to observe the internal state of their deployment. Issues raised include understanding why a search index is taking so long to build, how to determine if the cluster is healthy, and understanding how a query is executed across nodes. Many of these questions can be answered with the new <a href="https://milvus.io/docs/milvus-webui.md#Milvus-WebUI">WebUI</a> that gives transparency to what the system is doing internally.</p><h4>How does some (complex) aspect of the internals work?</h4><p>Advanced users often want some understanding of Milvus internals, for example, having an understanding of the sealing of segments or memory management. The underlying goal is typically to improve performance and sometimes to debug issues. The documentation, particularly under the sections “Concepts” and “Administration Guide” is helpful here, for instance see the pages <a href="https://milvus.io/docs/architecture_overview.md">“Milvus Architecture Overview”</a> and <a href="https://milvus.io/docs/clustering-compaction.md">“Clustering Compaction”</a>. We will continue to improve the documentation on Milvus internals, make it easier to understand, and welcome any feedback or requests via <a href="https://milvus.io/discord">Discord</a>.</p><h4>Which embedding model should I choose?</h4><p>A question related to performance that has come up multiple times in meetups, office hours, and on Discord is how to choose an embedding model. This is a difficult question to give a definitive answer although we recommend starting with default models like <a href="https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2">all-MiniLM-L6-v2</a>.</p><p>Similar to the choice of search index, there are tradeoffs between compute, storage, and recall. An embedding model with larger output dimension will require more storage, all else held equal, although probably result in higher recall of relevant items. Larger embedding models, for a fixed dimension, typically outperform smaller ones in terms of recall, although at the cost of increased compute and time. Leaderboards that rank embedding model performance such as <a href="https://huggingface.co/spaces/mteb/leaderboard">MTEB</a> are based on benchmarks that may not align with your specific data and task.</p><p>So, it does not make sense to think of a “best” embedding model. Start with one that has acceptable recall and meets your compute and time budget for calculating embeddings. Further optimizations like fine-tuning on your data or exploring the compute/recall tradeoff empirically can be deferred to after you have a working system in production.</p><h4>Data Management</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rFL9-Xrf5IyGNQwx.png" /></figure><p>How to move data into and out of a Milvus deployment is another main theme in the Discord discussions, which is no surprise given how central this task is to putting an application into production.</p><h4>How do I migrate data from X to Milvus? How do I migrate data from Standalone to Distributed? How do I migrate from 2.4.x to 2.5.x?</h4><p>A new user commonly wants to get existing data into Milvus from another platform, including traditional search engines like <a href="https://docs.zilliz.com/docs/migrate-from-elasticsearch">Elasticsearch</a> and other vector databases like <a href="https://docs.zilliz.com/docs/migrate-from-pinecone">Pinecone</a> or <a href="https://docs.zilliz.com/docs/migrate-from-qdrant">Qdrant</a>. Existing users may also want to migrate their data from one Milvus deployment to another, or <a href="https://docs.zilliz.com/docs/migrate-from-milvus">from self-hosted Milvus to fully managed Zilliz Cloud</a>.</p><p>The <a href="https://github.com/zilliztech/vts">Vector Transport Service (VTS)</a> and the managed <a href="https://docs.zilliz.com/docs/migrations">Migration</a> service on Zilliz Cloud are designed for this purpose.</p><h4>How do I save and load data backups? How do I export data from Milvus?</h4><p>Milvus has a dedicated tool, <a href="https://github.com/zilliztech/milvus-backup">milvus-backup</a>, to take snapshots on permanent storage and restore them.</p><h4>Next Steps</h4><p>I hope this has given you some pointers on how to tackle common challenges faced when building with a vector database. This definitely helped us to take another look at our documentation and feature roadmap to keep working on things that can help our community best succeed with Milvus. A key takeaway that I would like to emphasize, is that your choices put you within different points of a tradeoff space between compute, storage, latency, and recall. <em>You cannot maximize all of these performance criteria simultaneously — there is no “optimal” deployment. Yet, by understanding more about how vector search and distributed database systems work you can make an informed decision.</em></p><p>After trawling through the large number of posts from 2024, it got me thinking: why should a human do this? Has not Generative AI promised to solve such a task of crunching large amounts of text and extracting insight? Join me in the second part of this blog post (coming soon), where I investigate the design and implementation of <em>a multi-agent system for extracting insight from discussion forums.</em></p><p>Thanks again and hope to see you in the community <a href="https://milvus.io/discord">Discord</a> and our next <a href="https://lu.ma/unstructured-data-meetup">Unstructured Data</a> meetups. For more hands-on assistance, we welcome you to book a <a href="https://milvus.io/blog/join-milvus-office-hours-to-get-support-from-vectordb-experts.md">1-on-1 office hour</a>. <em>Your feedback is essential to improving Milvus!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e082d0e1759" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/what-milvus-users-taught-us-in-2024-7e082d0e1759">What Milvus Users Taught Us in 2024</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started with Hybrid Semantic / Full-Text Search with Milvus 2.5]]></title>
            <link>https://medium.com/vector-database/getting-started-with-hybrid-semantic-full-text-search-with-milvus-2-5-b8645a20e3ad?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/b8645a20e3ad</guid>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 11:02:24 GMT</pubDate>
            <atom:updated>2024-12-17T11:02:24.078Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will show you how to quickly get up and running with the new full-text search feature and combine it with the conventional semantic search based on vector embeddings.</p><h4>Requirement</h4><p>First, ensure you have installed Milvus 2.5:</p><pre>pip install -U pymilvus[model]</pre><p>and have a running instance of Milvus Standalone (e.g. on your local machine) using the <a href="https://milvus.io/docs/prerequisite-docker.md">installation instructions in the Milvus docs</a>.</p><h4>Building the Data Schema and Search Indices</h4><p>We import the required classes and functions:</p><pre>from pymilvus import MilvusClient, DataType, Function, FunctionType, model</pre><p>You may have noticed two new entries for Milvus 2.5, Function and FunctionType, which we will explain shortly.</p><p>Next we open the database with Milvus Standalone, that is, locally, and create the data schema. The schema comprises an integer primary key, a text string, a dense vector of dimension 384, and a sparse vector (of unlimited dimensionality). Note that Milvus Lite does not currently support full-text search, only Milvus Standalone and Milvus Distributed.</p><pre>client = MilvusClient(uri=&quot;http://localhost:19530&quot;)<br><br>schema = client.create_schema()<br><br>schema.add_field(field_name=&quot;id&quot;, datatype=DataType.INT64, is_primary=True, auto_id=True)<br>schema.add_field(field_name=&quot;text&quot;, datatype=DataType.VARCHAR, max_length=1000, enable_analyzer=True)<br>schema.add_field(field_name=&quot;dense&quot;, datatype=DataType.FLOAT_VECTOR, dim=768),<br>schema.add_field(field_name=&quot;sparse&quot;, datatype=DataType.SPARSE_FLOAT_VECTOR)</pre><pre>{&#39;auto_id&#39;: False, &#39;description&#39;: &#39;&#39;, &#39;fields&#39;: [{&#39;name&#39;: &#39;id&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.INT64: 5&gt;, &#39;is_primary&#39;: True, &#39;auto_id&#39;: True}, {&#39;name&#39;: &#39;text&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.VARCHAR: 21&gt;, &#39;params&#39;: {&#39;max_length&#39;: 1000, &#39;enable_analyzer&#39;: True}}, {&#39;name&#39;: &#39;dense&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.FLOAT_VECTOR: 101&gt;, &#39;params&#39;: {&#39;dim&#39;: 768}}, {&#39;name&#39;: &#39;sparse&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.SPARSE_FLOAT_VECTOR: 104&gt;}], &#39;enable_dynamic_field&#39;: False}</pre><p>You may have noticed the enable_analyzer=True parameter. This tells Milvus 2.5 to enable the lexical parser on this field and build a list of tokens and token frequencies, which are required for full-text search. The sparse field will hold a vector representation of the documentation as a bag-of-words produced from the parsing text.</p><p>But how do we connect the text and sparse fields, and tell Milvus how sparse should be calculated from text? This is where we need to invoke the Function object and add it to the schema:</p><pre>bm25_function = Function(<br>    name=&quot;text_bm25_emb&quot;, # Function name<br>    input_field_names=[&quot;text&quot;], # Name of the VARCHAR field containing raw text data<br>    output_field_names=[&quot;sparse&quot;], # Name of the SPARSE_FLOAT_VECTOR field reserved to store generated embeddings<br>    function_type=FunctionType.BM25,<br>)<br><br>schema.add_function(bm25_function)</pre><pre>{&#39;auto_id&#39;: False, &#39;description&#39;: &#39;&#39;, &#39;fields&#39;: [{&#39;name&#39;: &#39;id&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.INT64: 5&gt;, &#39;is_primary&#39;: True, &#39;auto_id&#39;: True}, {&#39;name&#39;: &#39;text&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.VARCHAR: 21&gt;, &#39;params&#39;: {&#39;max_length&#39;: 1000, &#39;enable_analyzer&#39;: True}}, {&#39;name&#39;: &#39;dense&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.FLOAT_VECTOR: 101&gt;, &#39;params&#39;: {&#39;dim&#39;: 768}}, {&#39;name&#39;: &#39;sparse&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;DataType.SPARSE_FLOAT_VECTOR: 104&gt;, &#39;is_function_output&#39;: True}], &#39;enable_dynamic_field&#39;: False, &#39;functions&#39;: [{&#39;name&#39;: &#39;text_bm25_emb&#39;, &#39;description&#39;: &#39;&#39;, &#39;type&#39;: &lt;FunctionType.BM25: 1&gt;, &#39;input_field_names&#39;: [&#39;text&#39;], &#39;output_field_names&#39;: [&#39;sparse&#39;], &#39;params&#39;: {}}]}</pre><p>The abstraction of the Function object is more general than that of applying full-text search. In the future, it may be used for other cases where one field needs to be a function of another field. In our case, we specify that sparse is a function of text via the function FunctionType.BM25. BM25 refers to a common metric in information retrieval used for calculating a query&#39;s similarity to a document (relative to a collection of documents).</p><p>We use the default embedding model in Milvus, which is <a href="https://huggingface.co/GPTCache/paraphrase-albert-small-v2">paraphrase-albert-small-v2</a>:</p><pre>embedding_fn = model.DefaultEmbeddingFunction()</pre><p>The next step is to add our search indices. We have one for the dense vector and a separate one for the sparse vector. The index type is SPARSE_INVERTED_INDEX with BM25 since full-text search requires a different search method than those for standard dense vectors.</p><pre>index_params = client.prepare_index_params()<br><br>index_params.add_index(<br>    field_name=&quot;dense&quot;,<br>    index_type=&quot;AUTOINDEX&quot;, <br>    metric_type=&quot;COSINE&quot;<br>)<br><br>index_params.add_index(<br>    field_name=&quot;sparse&quot;,<br>    index_type=&quot;SPARSE_INVERTED_INDEX&quot;, <br>    metric_type=&quot;BM25&quot;<br>)</pre><p>Finally, we create our collection:</p><pre>client.drop_collection(&#39;demo&#39;)<br>client.list_collections()</pre><pre>[]</pre><pre>client.create_collection(<br>    collection_name=&#39;demo&#39;, <br>    schema=schema, <br>    index_params=index_params<br>)<br><br>client.list_collections()</pre><pre>[&#39;demo&#39;]</pre><p>And with that, we have an empty database set up to accept text documents and perform semantic and full-text searches!</p><h4>Inserting Data and Performing Full-Text Search</h4><p>Inserting data is no different than previous versions of Milvus:</p><pre>docs = [<br>    &#39;information retrieval is a field of study.&#39;,<br>    &#39;information retrieval focuses on finding relevant information in large datasets.&#39;,<br>    &#39;data mining and information retrieval overlap in research.&#39;<br>]<br><br>embeddings = embedding_fn(docs)<br><br>client.insert(&#39;demo&#39;, [<br>    {&#39;text&#39;: doc, &#39;dense&#39;: vec} for doc, vec in zip(docs, embeddings)<br>])</pre><pre>{&#39;insert_count&#39;: 3, &#39;ids&#39;: [454387371651630485, 454387371651630486, 454387371651630487], &#39;cost&#39;: 0}</pre><p>Let’s first illustrate a full-text search before we move on to hybrid search:</p><pre>search_params = {<br>    &#39;params&#39;: {&#39;drop_ratio_search&#39;: 0.2},<br>}<br><br>results = client.search(<br>    collection_name=&#39;demo&#39;, <br>    data=[&#39;whats the focus of information retrieval?&#39;],<br>    output_fields=[&#39;text&#39;],<br>    anns_field=&#39;sparse&#39;,<br>    limit=3,<br>    search_params=search_params<br>)</pre><p>The search parameter drop_ratio_search refers to the proportion of lower-scoring documents to drop during the search algorithm.</p><p>Let’s view the results:</p><pre>for hit in results[0]:<br>    print(hit)</pre><pre>{&#39;id&#39;: 454387371651630485, &#39;distance&#39;: 1.3352930545806885, &#39;entity&#39;: {&#39;text&#39;: &#39;information retrieval is a field of study.&#39;}}<br>{&#39;id&#39;: 454387371651630486, &#39;distance&#39;: 0.29726022481918335, &#39;entity&#39;: {&#39;text&#39;: &#39;information retrieval focuses on finding relevant information in large datasets.&#39;}}<br>{&#39;id&#39;: 454387371651630487, &#39;distance&#39;: 0.2715056240558624, &#39;entity&#39;: {&#39;text&#39;: &#39;data mining and information retrieval overlap in research.&#39;}}</pre><h4>Performing Hybrid Semantic and Full-Text Search</h4><p>Let’s now combine what we’ve learned to perform a hybrid search that combines separate semantic and full-text searches with a reranker:</p><pre>from pymilvus import AnnSearchRequest, RRFRanker<br>query = &#39;whats the focus of information retrieval?&#39;<br>query_dense_vector = embedding_fn([query])<br><br>search_param_1 = {<br>    &quot;data&quot;: query_dense_vector,<br>    &quot;anns_field&quot;: &quot;dense&quot;,<br>    &quot;param&quot;: {<br>        &quot;metric_type&quot;: &quot;COSINE&quot;,<br>    },<br>    &quot;limit&quot;: 3<br>}<br>request_1 = AnnSearchRequest(**search_param_1)<br><br>search_param_2 = {<br>    &quot;data&quot;: [query],<br>    &quot;anns_field&quot;: &quot;sparse&quot;,<br>    &quot;param&quot;: {<br>        &quot;metric_type&quot;: &quot;BM25&quot;,<br>        &quot;params&quot;: {&quot;drop_ratio_build&quot;: 0.0}<br>    },<br>    &quot;limit&quot;: 3<br>}<br>request_2 = AnnSearchRequest(**search_param_2)<br><br>reqs = [request_1, request_2]</pre><pre>ranker = RRFRanker()<br><br>res = client.hybrid_search(<br>    collection_name=&quot;demo&quot;,<br>    output_fields=[&#39;text&#39;],<br>    reqs=reqs,<br>    ranker=ranker,<br>    limit=3<br>)<br>for hit in res[0]:<br>    print(hit)</pre><pre>{&#39;id&#39;: 454387371651630485, &#39;distance&#39;: 0.032786883413791656, &#39;entity&#39;: {&#39;text&#39;: &#39;information retrieval is a field of study.&#39;}}<br>{&#39;id&#39;: 454387371651630486, &#39;distance&#39;: 0.032258063554763794, &#39;entity&#39;: {&#39;text&#39;: &#39;information retrieval focuses on finding relevant information in large datasets.&#39;}}<br>{&#39;id&#39;: 454387371651630487, &#39;distance&#39;: 0.0317460335791111, &#39;entity&#39;: {&#39;text&#39;: &#39;data mining and information retrieval overlap in research.&#39;}}</pre><p>As you may have noticed, this is no different than a hybrid search with two separate semantic fields (available since Milvus 2.4). The results are identical to full-text search in this simple example, but for larger databases and keyword specific searches hybrid search typically has higher recall.</p><h4>Summary</h4><p>You’re now equipped with all the knowledge needed to perform full-text and hybrid semantic/full-text search with Milvus 2.5. See the following articles for more discussion on how full-text search works and why it is complementary to semantic search:</p><ul><li><a href="https://milvus.io/blog/introduce-milvus-2-5-full-text-search-powerful-metadata-filtering-and-more.md">Introducing Milvus 2.5: Full-Text Search, More Powerful Metadata Filtering, and Usability Improvements!</a></li><li><a href="https://milvus.io/blog/semantic-search-vs-full-text-search-which-one-should-i-choose-with-milvus-2-5.md">Semantic Search v.s. Full-Text Search: Which Do I Choose in Milvus 2.5?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8645a20e3ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/getting-started-with-hybrid-semantic-full-text-search-with-milvus-2-5-b8645a20e3ad">Getting Started with Hybrid Semantic / Full-Text Search with Milvus 2.5</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Semantic Search v.s. Full-Text Search: Which Do I Choose in Milvus 2.5?]]></title>
            <link>https://medium.com/vector-database/semantic-search-v-s-full-text-search-which-do-i-choose-in-milvus-2-5-64f48800adaf?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/64f48800adaf</guid>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 10:57:33 GMT</pubDate>
            <atom:updated>2024-12-17T10:57:32.985Z</atom:updated>
            <content:encoded><![CDATA[<p>Milvus, a leading high-performance vector database, has long specialized in semantic search using vector embeddings from deep learning models. This technology powers AI applications like Retrieval-Augmented Generation (RAG), search engines, and recommender systems. With the rising popularity of RAG and other text search applications, the community has recognized the advantages of combining traditional text-matching methods with semantic search, known as hybrid search. This approach is particularly beneficial in scenarios that heavily rely on keyword matching. To address this need, Milvus 2.5 introduces full-text search (FTS) functionality and integrates it with the sparse vector search and hybrid search capabilities already available since version 2.4, creating a powerful synergy.</p><p>Hybrid search is a method that combines results from multiple search paths. Users can search different data fields in various ways, then merge and rank the results to obtain a comprehensive outcome. In popular RAG scenarios today, a typical hybrid approach combines semantic search with lexical search (also known as full-text search). Specifically, this involves merging results from dense embedding-based semantic search and BM25-based lexical matching using RRF (Reciprocal Rank Fusion) to enhance result ranking.</p><p>In this article, we will demonstrate this using a dataset provided by Anthropic, which consists of code snippets from nine code repositories. This resembles a popular use case of RAG: an AI-assisted coding bot. Because code data contains a lot of definitions, keywords, and other information, text-based search can be particularly effective in this context. Meanwhile, dense embedding models trained on large code datasets can capture higher-level semantic information. Our goal is to observe the effects of combining these two approaches through experimentation.</p><p>We will analyze specific cases to develop a clearer understanding of hybrid search. As the baseline, we will use an advanced dense embedding model (voyage-2) trained on a large volume of code data. We will then select examples where hybrid search outperforms both semantic and full-text search results (top 5) to analyze the characteristics behind these cases.</p><p>| Method | Pass@5 | | : — — — — — — — — — — — — — : | : — — -: | | Full-text Search | 0.7318 | | Semantic Search | 0.8096 | | Hybrid Search | 0.8176 | | Hybrid Search (add stopword) | 0.8418 |</p><p>In addition to analyzing the quality on a case-by-case basis, we broadened our evaluation by calculating the Pass@5 metric across the entire dataset. This metric measures the proportion of relevant results found in the top 5 results of each query. Our findings show that while advanced embedding models establish a solid baseline, integrating them with full-text search yields even better results. Further improvements are possible by examining BM25 results and fine-tuning parameters for specific scenarios, which can lead to significant performance gains.</p><h3>Discussion</h3><p>We examine the specific results retrieved for three different search queries, comparing semantic and full-text search to hybrid search.</p><h4>Case 1: <strong>Hybrid Search Outperforms Semantic Search</strong></h4><p><strong>Question:</strong> How is the log file created? This question aims to inquire about creating a log file, and the correct answer should be a snippet of Rust code that creates a log file. In the semantic search results, we saw some code introducing the log header file and the C++ code for obtaining the logger. However, the key here is the “logfile” variable. In the hybrid search result #hybrid 0, we found this relevant result, which is naturally from the full-text search since hybrid search merges semantic and full-text search results.</p><p>In addition to this result, we can find unrelated test mock code in #hybrid 2, especially the repeated phrase, “long string to test how those are handled.” This requires understanding the principles behind the BM25 algorithm used in full-text search. Full-text search aims to match more infrequent words (since common words reduce the distinctiveness of the text and hinder object discrimination). Suppose we perform a statistical analysis on a large corpus of natural text. In that case, it is easy to conclude that “how” is a very common word and contributes very little to the relevance score. However, in this case, the dataset consists of code, and there aren’t many occurrences of the word “how” in the code, making it a key search term in this context.</p><p><strong>Ground Truth:</strong> The correct answer is the Rust code that creates a log file.</p><pre>use {<br>    crate::args::LogArgs,<br>    anyhow::{anyhow, Result},<br>    simplelog::{Config, LevelFilter, WriteLogger},<br>    std::fs::File,<br>};<br><br>pub struct Logger;<br><br>impl Logger {<br>    pub fn init(args: &amp;impl LogArgs) -&gt; Result&lt;()&gt; {<br>        let filter: LevelFilter = args.log_level().into();<br>        if filter != LevelFilter::Off {<br>            let logfile = File::create(args.log_file())<br>                .map_err(|e| anyhow!(&quot;Failed to open log file: {e:}&quot;))?;<br>            WriteLogger::init(filter, Config::default(), logfile)<br>                .map_err(|e| anyhow!(&quot;Failed to initalize logger: {e:}&quot;))?;<br>        }<br>        Ok(())<br>    }<br>}</pre><h4>Semantic Search Results</h4><pre>##dense 0 0.7745316028594971 <br>/*<br> * Licensed to the Apache Software Foundation (ASF) under one or more<br> * contributor license agreements.  See the NOTICE file distributed with<br> * this work for additional information regarding copyright ownership.<br> * The ASF licenses this file to You under the Apache License, Version 2.0<br> * (the &quot;License&quot;); you may not use this file except in compliance with<br> * the License.  You may obtain a copy of the License at<br> *<br> *      http://www.apache.org/licenses/LICENSE-2.0<br> *<br> * Unless required by applicable law or agreed to in writing, software<br> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,<br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> * See the License for the specific language governing permissions and<br> * limitations under the License.<br> */<br>#include &quot;logunit.h&quot;<br>#include &lt;log4cxx/logger.h&gt;<br>#include &lt;log4cxx/simplelayout.h&gt;<br>#include &lt;log4cxx/fileappender.h&gt;<br>#include &lt;log4cxx/helpers/absolutetimedateformat.h&gt;<br><br><br><br> ##dense 1 0.769859254360199 <br>        void simple()<br>        {<br>                LayoutPtr layout = LayoutPtr(new SimpleLayout());<br>                AppenderPtr appender = FileAppenderPtr(new FileAppender(layout, LOG4CXX_STR(&quot;output/simple&quot;), false));<br>                root-&gt;addAppender(appender);<br>                common();<br><br>                LOGUNIT_ASSERT(Compare::compare(LOG4CXX_FILE(&quot;output/simple&quot;), LOG4CXX_FILE(&quot;witness/simple&quot;)));<br>        }<br><br>        std::string createMessage(int i, Pool &amp; pool)<br>        {<br>                std::string msg(&quot;Message &quot;);<br>                msg.append(pool.itoa(i));<br>                return msg;<br>        }<br><br>        void common()<br>        {<br>                int i = 0;<br><br>                // In the lines below, the logger names are chosen as an aid in<br>                // remembering their level values. In general, the logger names<br>                // have no bearing to level values.<br>                LoggerPtr ERRlogger = Logger::getLogger(LOG4CXX_TEST_STR(&quot;ERR&quot;));<br>                ERRlogger-&gt;setLevel(Level::getError());<br><br><br><br> ##dense 2 0.7591114044189453 <br>                log4cxx::spi::LoggingEventPtr logEvt = std::make_shared&lt;log4cxx::spi::LoggingEvent&gt;(LOG4CXX_STR(&quot;foo&quot;),<br>                                                                                                                                                                                         Level::getInfo(),<br>                                                                                                                                                                                         LOG4CXX_STR(&quot;A Message&quot;),<br>                                                                                                                                                                                         log4cxx::spi::LocationInfo::getLocationUnavailable());<br>                FMTLayout layout(LOG4CXX_STR(&quot;{d:%Y-%m-%d %H:%M:%S} {message}&quot;));<br>                LogString output;<br>                log4cxx::helpers::Pool pool;<br>                layout.format( output, logEvt, pool);<br><br><br><br> ##dense 3 0.7562235593795776 <br>#include &quot;util/compare.h&quot;<br>#include &quot;util/transformer.h&quot;<br>#include &quot;util/absolutedateandtimefilter.h&quot;<br>#include &quot;util/iso8601filter.h&quot;<br>#include &quot;util/absolutetimefilter.h&quot;<br>#include &quot;util/relativetimefilter.h&quot;<br>#include &quot;util/controlfilter.h&quot;<br>#include &quot;util/threadfilter.h&quot;<br>#include &quot;util/linenumberfilter.h&quot;<br>#include &quot;util/filenamefilter.h&quot;<br>#include &quot;vectorappender.h&quot;<br>#include &lt;log4cxx/fmtlayout.h&gt;<br>#include &lt;log4cxx/propertyconfigurator.h&gt;<br>#include &lt;log4cxx/helpers/date.h&gt;<br>#include &lt;log4cxx/spi/loggingevent.h&gt;<br>#include &lt;iostream&gt;<br>#include &lt;iomanip&gt;<br><br>#define REGEX_STR(x) x<br>#define PAT0 REGEX_STR(&quot;\\[[0-9A-FXx]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* - Message [0-9]\\{1,2\\}&quot;)<br>#define PAT1 ISO8601_PAT REGEX_STR(&quot; &quot;) PAT0<br>#define PAT2 ABSOLUTE_DATE_AND_TIME_PAT REGEX_STR(&quot; &quot;) PAT0<br>#define PAT3 ABSOLUTE_TIME_PAT REGEX_STR(&quot; &quot;) PAT0<br>#define PAT4 RELATIVE_TIME_PAT REGEX_STR(&quot; &quot;) PAT0<br>#define PAT5 REGEX_STR(&quot;\\[[0-9A-FXx]*]\\ (DEBUG|INFO|WARN|ERROR|FATAL) .* : Message [0-9]\\{1,2\\}&quot;)<br><br><br> ##dense 4 0.7557586431503296 <br>                std::string msg(&quot;Message &quot;);<br><br>                Pool pool;<br><br>                // These should all log.----------------------------<br>                LOG4CXX_FATAL(ERRlogger, createMessage(i, pool));<br>                i++; //0<br>                LOG4CXX_ERROR(ERRlogger, createMessage(i, pool));<br>                i++;<br><br>                LOG4CXX_FATAL(INF, createMessage(i, pool));<br>                i++; // 2<br>                LOG4CXX_ERROR(INF, createMessage(i, pool));<br>                i++;<br>                LOG4CXX_WARN(INF, createMessage(i, pool));<br>                i++;<br>                LOG4CXX_INFO(INF, createMessage(i, pool));<br>                i++;<br><br>                LOG4CXX_FATAL(INF_UNDEF, createMessage(i, pool));<br>                i++; //6<br>                LOG4CXX_ERROR(INF_UNDEF, createMessage(i, pool));<br>                i++;<br>                LOG4CXX_WARN(INF_UNDEF, createMessage(i, pool));<br>                i++;<br>                LOG4CXX_INFO(INF_UNDEF, createMessage(i, pool));<br>                i++;<br><br>                LOG4CXX_FATAL(INF_ERR, createMessage(i, pool));<br>                i++; // 10<br>                LOG4CXX_ERROR(INF_ERR, createMessage(i, pool));<br>                i++;<br><br>                LOG4CXX_FATAL(INF_ERR_UNDEF, createMessage(i, pool));<br>                i++;<br>                LOG4CXX_ERROR(INF_ERR_UNDEF, createMessage(i, pool));<br>                i++;</pre><h4>Hybrid Search Results</h4><pre>##hybrid 0 0.016393441706895828 <br>use {<br>    crate::args::LogArgs,<br>    anyhow::{anyhow, Result},<br>    simplelog::{Config, LevelFilter, WriteLogger},<br>    std::fs::File,<br>};<br><br>pub struct Logger;<br><br>impl Logger {<br>    pub fn init(args: &amp;impl LogArgs) -&gt; Result&lt;()&gt; {<br>        let filter: LevelFilter = args.log_level().into();<br>        if filter != LevelFilter::Off {<br>            let logfile = File::create(args.log_file())<br>                .map_err(|e| anyhow!(&quot;Failed to open log file: {e:}&quot;))?;<br>            WriteLogger::init(filter, Config::default(), logfile)<br>                .map_err(|e| anyhow!(&quot;Failed to initalize logger: {e:}&quot;))?;<br>        }<br>        Ok(())<br>    }<br>}<br><br> <br>##hybrid 1 0.016393441706895828 <br>/*<br> * Licensed to the Apache Software Foundation (ASF) under one or more<br> * contributor license agreements.  See the NOTICE file distributed with<br> * this work for additional information regarding copyright ownership.<br> * The ASF licenses this file to You under the Apache License, Version 2.0<br> * (the &quot;License&quot;); you may not use this file except in compliance with<br> * the License.  You may obtain a copy of the License at<br> *<br> *      http://www.apache.org/licenses/LICENSE-2.0<br> *<br> * Unless required by applicable law or agreed to in writing, software<br> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,<br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> * See the License for the specific language governing permissions and<br> * limitations under the License.<br> */<br>#include &quot;logunit.h&quot;<br>#include &lt;log4cxx/logger.h&gt;<br>#include &lt;log4cxx/simplelayout.h&gt;<br>#include &lt;log4cxx/fileappender.h&gt;<br>#include &lt;log4cxx/helpers/absolutetimedateformat.h&gt;<br><br><br> <br>##hybrid 2 0.016129031777381897 <br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>    };<br>}<br><br><br> <br>##hybrid 3 0.016129031777381897 <br>        void simple()<br>        {<br>                LayoutPtr layout = LayoutPtr(new SimpleLayout());<br>                AppenderPtr appender = FileAppenderPtr(new FileAppender(layout, LOG4CXX_STR(&quot;output/simple&quot;), false));<br>                root-&gt;addAppender(appender);<br>                common();<br><br>                LOGUNIT_ASSERT(Compare::compare(LOG4CXX_FILE(&quot;output/simple&quot;), LOG4CXX_FILE(&quot;witness/simple&quot;)));<br>        }<br><br>        std::string createMessage(int i, Pool &amp; pool)<br>        {<br>                std::string msg(&quot;Message &quot;);<br>                msg.append(pool.itoa(i));<br>                return msg;<br>        }<br><br>        void common()<br>        {<br>                int i = 0;<br><br>                // In the lines below, the logger names are chosen as an aid in<br>                // remembering their level values. In general, the logger names<br>                // have no bearing to level values.<br>                LoggerPtr ERRlogger = Logger::getLogger(LOG4CXX_TEST_STR(&quot;ERR&quot;));<br>                ERRlogger-&gt;setLevel(Level::getError());<br><br><br> <br>##hybrid 4 0.01587301678955555 <br>std::vector&lt;std::string&gt; MakeStrings() {<br>    return {<br>        &quot;a&quot;, &quot;ab&quot;, &quot;abc&quot;, &quot;abcd&quot;,<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;</pre><h4>Case 2: Hybrid Search Outperforms Full-Text Search</h4><p><strong>Question:</strong> How do you initialize the logger? This question is quite similar to the previous one, and the correct answer is also the same code snippet, but in this case, hybrid search found the answer (via semantic search), while full-text search did not. The reason for this discrepancy lies in the statistical weightings of words in the corpus, which do not align with our intuitive understanding of the question. The model failed to recognize that the match for the word “how” was not as important here. The word “logger” appeared more frequently in the code than “how,” which led to “how” becoming more significant in the full-text search ranking.</p><p><strong>GroundTruth</strong></p><pre>use {<br>    crate::args::LogArgs,<br>    anyhow::{anyhow, Result},<br>    simplelog::{Config, LevelFilter, WriteLogger},<br>    std::fs::File,<br>};<br><br>pub struct Logger;<br><br>impl Logger {<br>    pub fn init(args: &amp;impl LogArgs) -&gt; Result&lt;()&gt; {<br>        let filter: LevelFilter = args.log_level().into();<br>        if filter != LevelFilter::Off {<br>            let logfile = File::create(args.log_file())<br>                .map_err(|e| anyhow!(&quot;Failed to open log file: {e:}&quot;))?;<br>            WriteLogger::init(filter, Config::default(), logfile)<br>                .map_err(|e| anyhow!(&quot;Failed to initalize logger: {e:}&quot;))?;<br>        }<br>        Ok(())<br>    }<br>}</pre><h4><strong>Full Text Search Results</strong></h4><pre>##sparse 0 10.17311954498291 <br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>    };<br>}<br><br><br><br> ##sparse 1 9.775702476501465 <br>std::vector&lt;std::string&gt; MakeStrings() {<br>    return {<br>        &quot;a&quot;, &quot;ab&quot;, &quot;abc&quot;, &quot;abcd&quot;,<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br><br><br> ##sparse 2 7.638711452484131 <br>//   union (&quot;x|y&quot;), grouping (&quot;(xy)&quot;), brackets (&quot;[xy]&quot;), and<br>//   repetition count (&quot;x{5,7}&quot;), among others.<br>//<br>//   Below is the syntax that we do support.  We chose it to be a<br>//   subset of both PCRE and POSIX extended regex, so it&#39;s easy to<br>//   learn wherever you come from.  In the following: &#39;A&#39; denotes a<br>//   literal character, period (.), or a single \\ escape sequence;<br>//   &#39;x&#39; and &#39;y&#39; denote regular expressions; &#39;m&#39; and &#39;n&#39; are for<br><br><br> ##sparse 3 7.1208391189575195 <br>/*<br> * Licensed to the Apache Software Foundation (ASF) under one or more<br> * contributor license agreements.  See the NOTICE file distributed with<br> * this work for additional information regarding copyright ownership.<br> * The ASF licenses this file to You under the Apache License, Version 2.0<br> * (the &quot;License&quot;); you may not use this file except in compliance with<br> * the License.  You may obtain a copy of the License at<br> *<br> *      http://www.apache.org/licenses/LICENSE-2.0<br> *<br> * Unless required by applicable law or agreed to in writing, software<br> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,<br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> * See the License for the specific language governing permissions and<br> * limitations under the License.<br> */<br>#include &quot;logunit.h&quot;<br>#include &lt;log4cxx/logger.h&gt;<br>#include &lt;log4cxx/simplelayout.h&gt;<br>#include &lt;log4cxx/fileappender.h&gt;<br>#include &lt;log4cxx/helpers/absolutetimedateformat.h&gt;<br><br><br><br> ##sparse 4 7.066349029541016 <br>/*<br> * Licensed to the Apache Software Foundation (ASF) under one or more<br> * contributor license agreements.  See the NOTICE file distributed with<br> * this work for additional information regarding copyright ownership.<br> * The ASF licenses this file to You under the Apache License, Version 2.0<br> * (the &quot;License&quot;); you may not use this file except in compliance with<br> * the License.  You may obtain a copy of the License at<br> *<br> *      http://www.apache.org/licenses/LICENSE-2.0<br> *<br> * Unless required by applicable law or agreed to in writing, software<br> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,<br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> * See the License for the specific language governing permissions and<br> * limitations under the License.<br> */<br>#include &lt;log4cxx/filter/denyallfilter.h&gt;<br>#include &lt;log4cxx/logger.h&gt;<br>#include &lt;log4cxx/spi/filter.h&gt;<br>#include &lt;log4cxx/spi/loggingevent.h&gt;<br>#include &quot;../logunit.h&quot;</pre><h4><strong>Hybrid Search Results</strong></h4><pre>##hybrid 0 0.016393441706895828 <br>use {<br>    crate::args::LogArgs,<br>    anyhow::{anyhow, Result},<br>    simplelog::{Config, LevelFilter, WriteLogger},<br>    std::fs::File,<br>};<br><br>pub struct Logger;<br><br>impl Logger {<br>    pub fn init(args: &amp;impl LogArgs) -&gt; Result&lt;()&gt; {<br>        let filter: LevelFilter = args.log_level().into();<br>        if filter != LevelFilter::Off {<br>            let logfile = File::create(args.log_file())<br>                .map_err(|e| anyhow!(&quot;Failed to open log file: {e:}&quot;))?;<br>            WriteLogger::init(filter, Config::default(), logfile)<br>                .map_err(|e| anyhow!(&quot;Failed to initalize logger: {e:}&quot;))?;<br>        }<br>        Ok(())<br>    }<br>}<br><br> <br>##hybrid 1 0.016393441706895828 <br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>    };<br>}<br><br><br> <br>##hybrid 2 0.016129031777381897 <br>std::vector&lt;std::string&gt; MakeStrings() {<br>    return {<br>        &quot;a&quot;, &quot;ab&quot;, &quot;abc&quot;, &quot;abcd&quot;,<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br>        &quot;long string to test how those are handled. Here goes more text. &quot;<br><br> <br>##hybrid 3 0.016129031777381897 <br>                LoggerPtr INF = Logger::getLogger(LOG4CXX_TEST_STR(&quot;INF&quot;));<br>                INF-&gt;setLevel(Level::getInfo());<br><br>                LoggerPtr INF_ERR = Logger::getLogger(LOG4CXX_TEST_STR(&quot;INF.ERR&quot;));<br>                INF_ERR-&gt;setLevel(Level::getError());<br><br>                LoggerPtr DEB = Logger::getLogger(LOG4CXX_TEST_STR(&quot;DEB&quot;));<br>                DEB-&gt;setLevel(Level::getDebug());<br><br>                // Note: categories with undefined level<br>                LoggerPtr INF_UNDEF = Logger::getLogger(LOG4CXX_TEST_STR(&quot;INF.UNDEF&quot;));<br>                LoggerPtr INF_ERR_UNDEF = Logger::getLogger(LOG4CXX_TEST_STR(&quot;INF.ERR.UNDEF&quot;));<br>                LoggerPtr UNDEF = Logger::getLogger(LOG4CXX_TEST_STR(&quot;UNDEF&quot;));<br><br><br> <br>##hybrid 4 0.01587301678955555 <br>//   union (&quot;x|y&quot;), grouping (&quot;(xy)&quot;), brackets (&quot;[xy]&quot;), and<br>//   repetition count (&quot;x{5,7}&quot;), among others.<br>//<br>//   Below is the syntax that we do support.  We chose it to be a<br>//   subset of both PCRE and POSIX extended regex, so it&#39;s easy to<br>//   learn wherever you come from.  In the following: &#39;A&#39; denotes a<br>//   literal character, period (.), or a single \\ escape sequence;<br>//   &#39;x&#39; and &#39;y&#39; denote regular expressions; &#39;m&#39; and &#39;n&#39; are for</pre><p>In our observations, we found that in the sparse vector search, many low-quality results were caused by matching low-information words like “How” and “What.” By examining the data, we realized that these words caused interference in the results. One approach to mitigate this issue is to add these words to a stopword list and ignore them during the matching process. This would help eliminate the negative impact of these common words and improve the quality of the search results.</p><h4>Case 3: <strong>Hybrid Search (with Stopword Addition) Outperforms Semantic Search</strong></h4><p>After adding the stopwords to filter out low-information words like “How” and “What,” we analyzed a case where a fine-tuned hybrid search performed better than a semantic search. The improvement in this case was due to matching the term “RegistryClient” in the query, which allowed us to find results not recalled by the semantic search model alone.</p><p>Furthermore, we noticed that hybrid search reduced the number of low-quality matches in the results. In this case, the hybrid search method successfully integrated the semantic search with the full-text search, leading to more relevant results with improved accuracy.</p><p><strong>Question:</strong> How is the RegistryClient instance created in the test methods?</p><p>The hybrid search effectively retrieved the answer related to creating the “RegistryClient” instance, which semantic search alone failed to find. Adding stopwords helped avoid irrelevant results from terms like “How,” leading to better-quality matches and fewer low-quality results.</p><pre>/** Integration tests for {@link BlobPuller}. */<br>public class BlobPullerIntegrationTest {<br><br>  private final FailoverHttpClient httpClient = new FailoverHttpClient(true, false, ignored -&gt; {});<br><br>  @Test<br>  public void testPull() throws IOException, RegistryException {<br>    RegistryClient registryClient =<br>        RegistryClient.factory(EventHandlers.NONE, &quot;gcr.io&quot;, &quot;distroless/base&quot;, httpClient)<br>            .newRegistryClient();<br>    V22ManifestTemplate manifestTemplate =<br>        registryClient<br>            .pullManifest(<br>                ManifestPullerIntegrationTest.KNOWN_MANIFEST_V22_SHA, V22ManifestTemplate.class)<br>            .getManifest();<br><br>    DescriptorDigest realDigest = manifestTemplate.getLayers().get(0).getDigest();</pre><h4>Semantic Search Results</h4><pre>##dense 0 0.7411458492279053 <br>    Mockito.doThrow(mockRegistryUnauthorizedException)<br>        .when(mockJibContainerBuilder)<br>        .containerize(mockContainerizer);<br><br>    try {<br>      testJibBuildRunner.runBuild();<br>      Assert.fail();<br><br>    } catch (BuildStepsExecutionException ex) {<br>      Assert.assertEquals(<br>          TEST_HELPFUL_SUGGESTIONS.forHttpStatusCodeForbidden(&quot;someregistry/somerepository&quot;),<br>          ex.getMessage());<br>    }<br>  }<br><br><br><br> ##dense 1 0.7346029877662659 <br>    verify(mockCredentialRetrieverFactory).known(knownCredential, &quot;credentialSource&quot;);<br>    verify(mockCredentialRetrieverFactory).known(inferredCredential, &quot;inferredCredentialSource&quot;);<br>    verify(mockCredentialRetrieverFactory)<br>        .dockerCredentialHelper(&quot;docker-credential-credentialHelperSuffix&quot;);<br>  }<br><br><br><br> ##dense 2 0.7285804748535156 <br>    when(mockCredentialRetrieverFactory.dockerCredentialHelper(anyString()))<br>        .thenReturn(mockDockerCredentialHelperCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.known(knownCredential, &quot;credentialSource&quot;))<br>        .thenReturn(mockKnownCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.known(inferredCredential, &quot;inferredCredentialSource&quot;))<br>        .thenReturn(mockInferredCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.wellKnownCredentialHelpers())<br>        .thenReturn(mockWellKnownCredentialHelpersCredentialRetriever);<br><br><br><br> ##dense 3 0.7279614210128784 <br>  @Test<br>  public void testBuildImage_insecureRegistryException()<br>      throws InterruptedException, IOException, CacheDirectoryCreationException, RegistryException,<br>          ExecutionException {<br>    InsecureRegistryException mockInsecureRegistryException =<br>        Mockito.mock(InsecureRegistryException.class);<br>    Mockito.doThrow(mockInsecureRegistryException)<br>        .when(mockJibContainerBuilder)<br>        .containerize(mockContainerizer);<br><br>    try {<br>      testJibBuildRunner.runBuild();<br>      Assert.fail();<br><br>    } catch (BuildStepsExecutionException ex) {<br>      Assert.assertEquals(TEST_HELPFUL_SUGGESTIONS.forInsecureRegistry(), ex.getMessage());<br>    }<br>  }<br><br><br><br> ##dense 4 0.724872350692749 <br>  @Test<br>  public void testBuildImage_registryCredentialsNotSentException()<br>      throws InterruptedException, IOException, CacheDirectoryCreationException, RegistryException,<br>          ExecutionException {<br>    Mockito.doThrow(mockRegistryCredentialsNotSentException)<br>        .when(mockJibContainerBuilder)<br>        .containerize(mockContainerizer);<br><br>    try {<br>      testJibBuildRunner.runBuild();<br>      Assert.fail();<br><br>    } catch (BuildStepsExecutionException ex) {<br>      Assert.assertEquals(TEST_HELPFUL_SUGGESTIONS.forCredentialsNotSent(), ex.getMessage());<br>    }<br>  }</pre><h4>Hybrid Search Results</h4><pre>##hybrid 0 0.016393441706895828 <br>/** Integration tests for {@link BlobPuller}. */<br>public class BlobPullerIntegrationTest {<br><br>  private final FailoverHttpClient httpClient = new FailoverHttpClient(true, false, ignored -&gt; {});<br><br>  @Test<br>  public void testPull() throws IOException, RegistryException {<br>    RegistryClient registryClient =<br>        RegistryClient.factory(EventHandlers.NONE, &quot;gcr.io&quot;, &quot;distroless/base&quot;, httpClient)<br>            .newRegistryClient();<br>    V22ManifestTemplate manifestTemplate =<br>        registryClient<br>            .pullManifest(<br>                ManifestPullerIntegrationTest.KNOWN_MANIFEST_V22_SHA, V22ManifestTemplate.class)<br>            .getManifest();<br><br>    DescriptorDigest realDigest = manifestTemplate.getLayers().get(0).getDigest();<br><br><br> <br>##hybrid 1 0.016393441706895828 <br>    Mockito.doThrow(mockRegistryUnauthorizedException)<br>        .when(mockJibContainerBuilder)<br>        .containerize(mockContainerizer);<br><br>    try {<br>      testJibBuildRunner.runBuild();<br>      Assert.fail();<br><br>    } catch (BuildStepsExecutionException ex) {<br>      Assert.assertEquals(<br>          TEST_HELPFUL_SUGGESTIONS.forHttpStatusCodeForbidden(&quot;someregistry/somerepository&quot;),<br>          ex.getMessage());<br>    }<br>  }<br><br><br> <br>##hybrid 2 0.016129031777381897 <br>    verify(mockCredentialRetrieverFactory).known(knownCredential, &quot;credentialSource&quot;);<br>    verify(mockCredentialRetrieverFactory).known(inferredCredential, &quot;inferredCredentialSource&quot;);<br>    verify(mockCredentialRetrieverFactory)<br>        .dockerCredentialHelper(&quot;docker-credential-credentialHelperSuffix&quot;);<br>  }<br><br><br> <br>##hybrid 3 0.016129031777381897 <br>  @Test<br>  public void testPull_unknownBlob() throws IOException, DigestException {<br>    DescriptorDigest nonexistentDigest =<br>        DescriptorDigest.fromHash(<br>            &quot;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&quot;);<br><br>    RegistryClient registryClient =<br>        RegistryClient.factory(EventHandlers.NONE, &quot;gcr.io&quot;, &quot;distroless/base&quot;, httpClient)<br>            .newRegistryClient();<br><br>    try {<br>      registryClient<br>          .pullBlob(nonexistentDigest, ignored -&gt; {}, ignored -&gt; {})<br>          .writeTo(ByteStreams.nullOutputStream());<br>      Assert.fail(&quot;Trying to pull nonexistent blob should have errored&quot;);<br><br>    } catch (IOException ex) {<br>      if (!(ex.getCause() instanceof RegistryErrorException)) {<br>        throw ex;<br>      }<br>      MatcherAssert.assertThat(<br>          ex.getMessage(),<br>          CoreMatchers.containsString(<br>              &quot;pull BLOB for gcr.io/distroless/base with digest &quot; + nonexistentDigest));<br>    }<br>  }<br>}<br><br> <br>##hybrid 4 0.01587301678955555 <br>    when(mockCredentialRetrieverFactory.dockerCredentialHelper(anyString()))<br>        .thenReturn(mockDockerCredentialHelperCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.known(knownCredential, &quot;credentialSource&quot;))<br>        .thenReturn(mockKnownCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.known(inferredCredential, &quot;inferredCredentialSource&quot;))<br>        .thenReturn(mockInferredCredentialRetriever);<br>    when(mockCredentialRetrieverFactory.wellKnownCredentialHelpers())<br>        .thenReturn(mockWellKnownCredentialHelpersCredentialRetriever);</pre><h4>Conclusions</h4><p>From our analysis, we can draw several conclusions about the performance of different retrieval methods. For most of the cases, the semantic search model helps us obtain good results by grasping the overall intention of the query, but it falls short when the query contains specific keywords we want to match.</p><p>In these cases, the embedding model doesn’t explicitly represent this intent. On the other hand, Full-text search can address this issue directly. However, it also brings the problem of irrelevant results despite matching words, which can degrade the overall result quality. Therefore, it’s crucial to identify and handle these negative cases by analyzing specific results and applying targeted strategies to improve search quality. A hybrid search with ranking strategies such as RRF or weighted reranker is usually a good baseline option.</p><p>With the release of the full-text search functionality in Milvus 2.5, we aim to provide the community with flexible and diverse information retrieval solutions. This will allow users to explore various combinations of search methods and address the increasingly complex and varied search demands in the GenAI era. Check out the code example on <a href="https://milvus.io/docs/full_text_search_with_milvus.md">how to implement full-text search and hybrid search with Milvus 2.5</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64f48800adaf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/semantic-search-v-s-full-text-search-which-do-i-choose-in-milvus-2-5-64f48800adaf">Semantic Search v.s. Full-Text Search: Which Do I Choose in Milvus 2.5?</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview]]></title>
            <link>https://medium.com/vector-database/overview-e79fa5a6076b?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/e79fa5a6076b</guid>
            <category><![CDATA[contribute-to-milvus]]></category>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 09:43:38 GMT</pubDate>
            <atom:updated>2024-12-17T09:43:38.346Z</atom:updated>
            <content:encoded><![CDATA[<p>We are thrilled to present the latest version of Milvus, 2.5, which introduces a powerful new capability: <a href="https://milvus.io/docs/full-text-search.md#Full-Text-Search">full-text search</a>, also known as lexical or keyword search. If you are new to search, full-text search allows you to find documents by searching for specific words or phrases within them, similar to how you search in Google. This complements our existing semantic search capabilities, which understand the meaning behind your search rather than just matching exact words.</p><p>We use the industry-standard BM25 metric for document similarity, and our implemention is based on sparse vectors, allowing for more efficient storage and retrieval. For those unfamiliar with the term, sparse vectors are a way to represent text where most values are zero, making them very efficient to store and process — imagine a huge spreadsheet where only a few cells contain numbers, and the rest are empty. This approach fits well into Milvus’s product philosophy where the vector is the core search entity.</p><p>An additional noteworthy aspect of our implementation is the capability to insert and query text <em>directly</em> rather than having users first manually convert text into sparse vectors. This takes Milvus one step closer towards fully processing unstructured data.</p><p>But this is just the beginning. With the release of 2.5, we updated the <a href="https://milvus.io/docs/roadmap.md">Milvus product roadmap</a>. In future product iterations of Milvus, our focus will be on evolving Milvus’s capabilities in four key directions:</p><ul><li>Streamlined unstructured data processing;</li><li>Better search quality and efficiency;</li><li>Easier data management;</li><li>Lowering costs through algorithmic and design advances</li></ul><p>Our aim is to build data infrastructure that can both efficiently store and effectively retrieve information in the AI era.</p><h4>Full-text Search via Sparse-BM25</h4><p>Although semantic search typically has better contexual awareness and intent understanding, when a user needs to search for specific proper nouns, serial numbers, or a completely-matching phrase, full-text retrieval with keyword matching often produces more accurate results.</p><p>To illustrate this with an example:</p><ul><li>Semantic search excels when you ask: “Find documents about renewable energy solutions”</li><li>Full-text search is better when you need: “Find documents mentioning <em>Tesla Model 3 2024</em>”</li></ul><p>In our previous version (Milvus 2.4), users had to pre-process their text using a separate tool (the BM25EmbeddingFunction module to the PyMilvus) on their own machines before they could search it This approach had several limitations: it couldn’t handle growing datasets well, required extra setup steps, and made the whole process more complicated than necessary. For the technically minded, the key limitations were that it could only work on a single machine; the vocabulary and other corpus statistics used for BM25 scoring couldn’t be updated as the corpus changed; and converting text to vectors on the client side is less intuitive working withtext directly.</p><p>Milvus 2.5 simplifies everything. Now you can work with your text directly:</p><ul><li>Store your original text documents as they are</li><li>Search using natural language queries</li><li>Get results back in readable form</li></ul><p>Behind the scenes, Milvus handles all the complex vector conversions automatically making it easier to work with text data. This is what we call our “Doc in, Doc out” approach — you work with readable text, and we handle the rest.</p><h4>Techical Implementation</h4><p>For those interested in the technical details, Milvus 2.5 adds the full-text search capability through its built-in Sparse-BM25 implementation, including:</p><ul><li><strong>A Tokenizer built on tantivy</strong>: Milvus now integrates with the thriving tantivy ecosystem</li><li><strong>Capability to ingest and retrieve raw documents</strong>: Support for direct ingestion and query of text data</li><li><strong>BM25 relevance scoring</strong>: Internalize BM25 scoring, implemented based on sparse vector</li></ul><p>We chose to work with the well-developed tantivy ecosystem and build the Milvus text tokenizer on tantivy. In the future, Milvus will support more tokenizers and expose the tokenization process to help users better understand the retrieval quality. We will also explore deep learning-based tokenizers and stemmer strategies to further optimize the performance of full-text search. Below is sample code for using and configuring the tokenizer:</p><pre># Tokenizer configuration<br>schema.add_field(<br>    field_name=&#39;text&#39;,<br>    datatype=DataType.VARCHAR,<br>    max_length=65535,<br>    enable_analyzer=True, # Enable tokenizer on this column<br>    analyzer_params={&quot;type&quot;: &quot;english&quot;},  # Configure tokenizer parameters, here we choose the english template, fine-grained configuration is also supported<br>    enable_match=True, # Build an inverted index for Text_Match<br>)</pre><p>After configuring the tokenizer in the collection schema, users can register the text to bm25 function via add_function method. This will run internally in the Milvus server. All subsequent data flows such as additions, deletions, modifications, and queries can be completed by operating on the raw text string, as opposed to the vector representation. See below code example for how to ingest text and conduct full-text search with the new API:</p><pre># Define the mapping relationship between raw text data and vectors on the schema<br>bm25_function = Function(<br>    name=&quot;text_bm25_emb&quot;,<br>    input_field_names=[&quot;text&quot;], # Input text field<br>    output_field_names=[&quot;sparse&quot;], # Internal mapping sparse vector field<br>    function_type=FunctionType.BM25, # Model for processing mapping relationship<br>)<br><br>schema.add_function(bm25_function)<br>...<br># Support for raw text in/out<br>MilvusClient.insert(&#39;demo&#39;, [<br>    {&#39;text&#39;: &#39;Artificial intelligence was founded as an academic discipline in 1956.&#39;},<br>    {&#39;text&#39;: &#39;Alan Turing was the first person to conduct substantial research in AI.&#39;},<br>    {&#39;text&#39;: &#39;Born in Maida Vale, London, Turing was raised in southern England.&#39;},<br>])<br><br>MilvusClient.search(<br>    collection_name=&#39;demo&#39;,<br>    data=[&#39;Who started AI research?&#39;],<br>    anns_field=&#39;sparse&#39;,<br>    limit=3<br>)</pre><p>We have adopted an implementation of BM25 relevance scoring that represents queries and documents as sparse vectors, called <strong>Sparse-BM25</strong>. This unlocks many optimizations based on sparse vector, such as:</p><p>Milvus achieves hybrid search capabilities through its cutting-edge <strong>Sparse-BM25 implementation</strong>, which integrates full-text search into the vector database architecture. By representing term frequencies as sparse vectors instead of traditional inverted indexes, Sparse-BM25 enables advanced optimizations, such as <strong>graph indexing</strong>, <strong>product quantization (PQ)</strong>, and <strong>scalar quantization (SQ)</strong>. These optimizations minimize memory usage and accelerate search performance. Similar to inverted index approach, Milvus supports taking raw text as input and generating sparse vectors internally. This make it able to work with any tokenizer and grasp any word shown in the dynamicly changing corpus.</p><p>Additionally, heuristic-based pruning discards low-value sparse vectors, further enhancing efficiency without compromising accuracy. Unlike previous approach using sparse vector, it can adapt to a growing corpus, not the accuracy of BM25 scoring.</p><ol><li>Building graph indexes on the sparse vector, which performs better than inverted index on queries with long text as inverted index needs more steps to finish matching the tokens in the query;</li><li>Leveraging approximation techniques to speed up search with only minor impact on retrieval quality, such as vector quantization and heuristic based pruning;</li><li>Unifying the interface and data model for performing semantic search and full-text search, thus enhancing the user experience.</li></ol><pre># Creating an index on the sparse column<br>index_params.add_index(<br>    field_name=&quot;sparse&quot;,<br>    index_type=&quot;AUTOINDEX&quot;,  # Default WAND index<br>    metric_type=&quot;BM25&quot; # Configure relevance scoring through metric_type<br>)<br><br># Configurable parameters at search time to speed up search<br>search_params = {<br>    &#39;params&#39;: {&#39;drop_ratio_search&#39;: 0.6}, # WAND search parameter configuration can speed up search<br>}</pre><p>In summary, Milvus 2.5 has expanded its search capability beyond semantic search by introducing full-text retrieval, making it easier for users to build high quality AI applications. These are just initial steps in the space of Sparse-BM25 search and we anticipate that there will be further optimization measures to try in the future.</p><h4>Text Matching Search Filters</h4><p>A second text search feature released with Milvus 2.5 is <strong>Text Match</strong>, which allows the user to filter the search to entries containing a specific text string. This feature is also built on the basis of tokenization and is activated with enable_match=True.</p><p>It is worth noting that with Text Match, the processing of the query text is based on the logic of OR after tokenization. For example, in the example below, the result will return all documents (using the ‘text’ field) that contain either ‘vector’ or ‘database’.</p><pre>filter = &quot;TEXT_MATCH(text, &#39;vector database&#39;)&quot;</pre><p>If your scenario requires matching both ‘vector’ and ‘database’, then you need to write two separate Text Matches and overlay them with AND to achieve your goal.</p><pre>filter = &quot;TEXT_MATCH(text, &#39;vector&#39;) and TEXT_MATCH(text, &#39;database&#39;)&quot;</pre><h4>Significant Enhancement in Scalar Filtering Performance</h4><p>Our emphasis on scalar filtering performance originates from our discovery that the combination of vector retrieval and metadata filtering can greatly improve query performance and accuracy in various scenarios. These scenarios range from image search applications such as corner case identification in autonomous driving to complex RAG scenarios in enterprise knowledge bases. Thus, it is highly suitable for enterprise users to implement in large-scale data application scenarios.</p><p>In practice, many factors like how much data you’re filtering, how your data is organized, and how you’re searching can affect performance. To address this, Milvus 2.5 introduces three new types of indexes — BitMap Index, Array Inverted Index, and the Inverted Index after tokenizing the Varchar text field. These new indexes can significantly improve performance in real-world use cases.</p><p>Specifically:</p><ol><li><strong>BitMap Index</strong> can be used to accelerate tag filtering (common operators include in, array_contains, etc.), and is suitable for scenarios with fewer field category data (data cardinality). The principle is to determine whether a row of data has a certain value on a column, with 1 for yes and 0 for no, and then maintain a BitMap list. The following chart shows the performance test comparison we conducted based on a customer’s business scenario. In this scenario, the data volume is 500 million, the data category is 20, different values have different distribution proportions (1%, 5%, 10%, 50%), and the performance under different filtering amounts also varies. With 50% filtering, we can achieve a 6.8-fold performance gain through BitMap Index. It’s worth noting that as cardinality increases, compared to BitMap Index, Inverted Index will show more balanced performance.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nqfIQ3C39T-lln_-.png" /></figure><ol><li><strong>Text Match</strong> is based on the Inverted Index after the text field is tokenized. Its performance far exceeds the Wildcard Match (i.e., like + %) function we provided in 2.4. According to our internal test results, the advantages of Text Match are very clear, especially in concurrent query scenarios, where it can achieve up to a 400-fold QPS increase.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wksUuKf_ndPwHGAU.png" /></figure><p>In terms of JSON data processing, we plan to introduce in subsequent versions of 2.5.x the building of inverted indices for user-specified keys and default location information recording for all keys to speed up parsing. We expect both of these areas to significantly enhance the query performance of JSON and Dynamic Field. We plan to showcase more information in future release notes and technical blogs, so stay tuned!</p><h4>New Management Interface</h4><p>Managing a database shouldn’t require a computer science degree, but we know database administrators need powerful tools. That’s why we’ve introduced the <strong>Cluster Management WebUI</strong>, a new web-based interface accessible at your cluster’s address on port 9091/webui. This observability tool provides:</p><ul><li>Real-time monitoring dashboards showing cluster-wide metrics</li><li>Detailed memory and performance analytics per node</li><li>Segment information and slow query tracking</li><li>System health indicators and node status</li><li>Easy-to-use troubleshooting tools for complex system issues</li></ul><p>While this interface is still in beta, we’re actively developing it based on user feedback from database administrators. Future updates will include AI-assisted diagnostics, more interactive management features, and enhanced cluster observability capabilities.</p><h4>Documentation and Developer Experience</h4><p>We’ve completely revamped our <strong>documentation</strong> and <strong>SDK/API</strong> experience to make Milvus more accessible while maintaining depth for experienced users. The improvements include:</p><ul><li>A restructured documentation system with clearer progression from basic to advanced concepts</li><li>Interactive tutorials and real-world examples that showcase practical implementations</li><li>Comprehensive API references with practical code samples</li><li>A more user-friendly SDK design that simplifies common operations</li><li>Illustrated guides that make complex concepts easier to understand</li><li>An AI-powered documentation assistant (ASK AI) for quick answers</li></ul><p>The updated SDK/API focuses on improving developer experience through more intuitive interfaces and better integration with the documentation. We believe you’ll notice these improvements when working with the 2.5.x series.</p><p>However, we know documentation and SDK development is an ongoing process. We’ll continue optimizing both the content structure and SDK design based on community feedback. Join our Discord channel to share your suggestions and help us improve further.</p><h4><strong>Summary</strong></h4><p>Milvus 2.5 contains 13 new features and several system-level optimizations, contributed not just by Zilliz but the open-source community. We have only touched on a few of them in this post and encourage you to visit our <a href="https://milvus.io/docs/release_notes.md">release note</a> and <a href="https://milvus.io/docs">official documents</a> for more information!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e79fa5a6076b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/overview-e79fa5a6076b">Overview</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing Multi-Tenancy RAG with Milvus: Best Practices for Scalable Enterprise Knowledge Bases]]></title>
            <link>https://medium.com/vector-database/designing-multi-tenancy-rag-with-milvus-best-practices-for-scalable-enterprise-knowledge-bases-c02bc4464c62?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/c02bc4464c62</guid>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[contribute-to-milvus]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Mon, 09 Dec 2024 07:08:26 GMT</pubDate>
            <atom:updated>2024-12-09T07:16:01.045Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Over the past couple of years, <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation">Retrieval-Augmented Generation (RAG)</a> has emerged as a trusted solution for large organizations to enhance their <a href="https://zilliz.com/glossary/large-language-models-(llms)">LLM</a>-powered applications, especially those with diverse users. As such applications grow, implementing a multi-tenancy framework becomes essential. <strong>Multi-tenancy</strong> provides secure, isolated access to data for different user groups, ensuring user trust, meeting regulatory standards, and improving operational efficiency.</p><p><a href="https://zilliz.com/what-is-milvus">Milvus</a> is an open-source <a href="https://zilliz.com/learn/what-is-vector-database">vector database</a> built to handle high-dimensional <a href="https://zilliz.com/glossary/vector-embeddings">vector data</a>. It is an indispensable infrastructure component of RAG, storing and retrieving contextual information for LLMs from external sources. Milvus offers <a href="https://milvus.io/docs/multi_tenancy.md">flexible multi-tenancy strategies</a> for various needs, including <strong>database-level, collection-level, and partition-level multi-tenancy</strong>.</p><p>In this post, we’ll cover:</p><ul><li>What is Multi-Tenancy and Why It Matters</li><li>Multi-Tenancy Strategies in Milvus</li><li>Example: Multi-Tenancy Strategy for a RAG-Powered Enterprise Knowledge Base</li></ul><h4>What is Multi-Tenancy and Why It Matters</h4><p><a href="https://milvus.io/docs/multi_tenancy.md"><strong>Multi-tenancy</strong></a> is an architecture where multiple customers or teams, known as “<strong>tenants,</strong>” share a single instance of an application or system. Each tenant’s data and configurations are logically isolated, ensuring privacy and security, while all tenants share the same underlying infrastructure.</p><p>Imagine a SaaS platform that provides knowledge-based solutions to multiple companies. Each company is a tenant.</p><ul><li>Tenant A is a healthcare organization storing patient-facing FAQs and compliance documents.</li><li>Tenant B is a tech company managing internal IT troubleshooting workflows.</li><li>Tenant C is a retail business with customer service FAQs for product returns.</li></ul><p>Each tenant operates in a completely isolated environment, ensuring that no data from Tenant A leaks into Tenant B’s system or vice versa. Furthermore, resource allocation, query performance, and scaling decisions are tenant-specific, ensuring high performance regardless of workload spikes in one tenant.</p><p>Multi-tenancy also works for systems serving different teams within the same organization. Imagine a large company using a RAG-powered knowledge base to serve its internal departments, such as HR, Legal, and Marketing. Each <strong>department is a tenant</strong> with isolated data and resources in this setup.</p><p>Multi-tenancy offers significant benefits, including <strong>cost efficiency, scalability, and robust data security</strong>. By sharing a single infrastructure, service providers can reduce overhead costs and ensure more effective resource consumption. This approach also scales effortlessly — onboarding new tenants requires far fewer resources than creating separate instances for each one, as with single-tenancy models. Importantly, multi-tenancy maintains robust data security by ensuring strict data isolation for each tenant, with access controls and encryption protecting sensitive information from unauthorized access. Additionally, updates, patches, and new features can be deployed across all tenants simultaneously, simplifying system maintenance and reducing the burden on administrators while ensuring that security and compliance standards are consistently upheld.</p><h4>Multi-Tenancy Strategies in Milvus</h4><p>To understand how Milvus supports multi-tenancy, it’s important to first look at how it organizes user data.</p><h4>How Milvus Organizes User Data</h4><p>Milvus structures data across three layers, moving from broad to granular: <a href="https://milvus.io/docs/manage_databases.md"><strong>Database</strong></a>, <a href="https://milvus.io/docs/manage-collections.md"><strong>Collection</strong></a>, and <a href="https://milvus.io/docs/manage-partitions.md"><strong>Partition/Partition Key</strong></a>.</p><figure><img alt="Figure- How Milvus organizes user data .png" src="https://cdn-images-1.medium.com/max/1024/0*FzpVloktOx2ZqJzd.png" /></figure><p><em>Figure: How Milvus organizes user data</em></p><ul><li><strong>Database</strong>: This acts as a logical container, similar to a database in traditional relational systems.</li><li><strong>Collection</strong>: Comparable to a table within a database, a collection organizes data into manageable groups.</li><li><strong>Partition/Partition Key</strong>: Within a collection, data can be further segmented by <strong>Partitions</strong>. Using a <strong>Partition Key</strong>, data with the same key is grouped together. For example, if you use a <strong>user ID</strong> as the <strong>Partition Key</strong>, all data for a specific user will be stored in the same logical segment. This makes it straightforward to retrieve data tied to individual users.</li></ul><p>As you move from <strong>Database</strong> to <strong>Collection</strong> to <strong>Partition Key</strong>, the granularity of data organization becomes progressively finer.</p><p>To ensure stronger data security and proper access control, Milvus also provides robust <a href="https://zilliz.com/blog/enabling-fine-grained-access-control-with-milvus-row-level-rbac"><strong>Role-Based Access Control (RBAC)</strong></a>, allowing administrators to define specific permissions for each user. Only authorized users can access certain data.</p><p>Milvus supports <a href="https://milvus.io/docs/multi_tenancy.md">multiple strategies</a> for implementing multi-tenancy, offering flexibility based on the needs of your application: <strong>database-level, collection-level, and partition-level multi-tenancy</strong>.</p><h4>Database-Level Multi-Tenancy</h4><p>With the database-level multi-tenancy approach, each tenant is assigned their own database within the same Milvus cluster. This strategy provides strong data isolation and ensures optimal search performance. However, it can lead to inefficient resource utilization if certain tenants remain inactive.</p><h4>Collection-Level Multi-Tenancy</h4><p>Here, in collection-level multi-tenancy, we can organize data for tenants in two ways.</p><ul><li><strong>One Collection for All Tenants</strong>: All tenants share a single collection, with tenant-specific fields used for filtering. While simple to implement, this approach can encounter performance bottlenecks as the number of tenants increases.</li><li><strong>One Collection per Tenant</strong>: Each tenant can have a dedicated collection, improving isolation and performance but requiring more resources. This setup may face scalability limitations if the number of tenants exceeds Milvus’s collection capacity.</li></ul><h4>Partition-Level Multi-Tenancy</h4><p>Partition-Level Multi-Tenancy focuses on organizing tenants within a single collection. Here, we also have two ways to organize tenant data.</p><ul><li><strong>One Partition per Tenant</strong>: Tenants share a collection, but their data is stored in separate partitions. We can isolate data by assigning each tenant a dedicated partition, balancing isolation and search performance. However, this approach is constrained by Milvus’s maximum partition limit.</li><li><strong>Partition-Key-Based Multi-Tenancy</strong>: This is a more scalable option in which a single collection uses partition keys to distinguish tenants. This method simplifies resource management and supports higher scalability but does not support bulk data inserts.</li></ul><p>The table below summarizes the key differences between key multi-tenancy approaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cl2TkxguSWsAdk9GBRMshg.png" /></figure><h4>Example: Multi-Tenancy Strategy for a RAG-Powered Enterprise Knowledge Base</h4><p>When designing the multi-tenancy strategy for a RAG system, it’s essential to align your approach with the specific needs of your business and your tenants. Milvus offers various multi-tenancy strategies, and choosing the right one depends on the number of tenants, their requirements, and the level of data isolation needed. Here’s a practical guide for making these decisions, taking a RAG-powered enterprise knowledge base as an example.</p><h4>Understanding Tenant Structure Before Choosing a Multi-Tenancy Strategy</h4><p>A RAG-powered enterprise knowledge base often serves a small number of tenants. These tenants are usually independent business units like IT, Sales, Legal, and Marketing, each requiring distinct knowledge base services. For example, the HR Department manages sensitive employee information like onboarding guides and benefits policies, which should be confidential and accessible only to HR personnel.</p><p>In this case, each business unit should be treated as a separate tenant and a <strong>Database-level multi-tenancy strategy</strong> is often the most suitable. By assigning dedicated databases to each tenant, organizations can achieve strong logical isolation, simplifying management and enhancing security. This setup provides tenants with significant flexibility — they can define custom data models within collections, create as many collections as needed, and independently manage access control for their collections.</p><h4>Enhancing Security with Physical Resource Isolation</h4><p>In situations where data security is highly prioritized, logical isolation at the database level may not be enough. For example, some business units might handle critical or highly sensitive data, requiring stronger guarantees against interference from other tenants. In such cases, we can implement a <a href="https://milvus.io/docs/resource_group.md">physical isolation approach</a> on top of a database-level multi-tenancy structure.</p><p>Milvus enables us to map logical components, such as databases and collections, to physical resources. This method ensures that the activities of other tenants do not impact critical operations. Let’s explore how this approach works in practice.</p><figure><img alt="Figure- How Milvus manages physical resources.png" src="https://cdn-images-1.medium.com/max/1024/0*n-de8o70n_MlrFYC.png" /></figure><p>Figure: How Milvus manages physical resources</p><p>As shown in the diagram above, there are three layers of resource management in Milvus: <strong>Query Node</strong>, <strong>Resource Group</strong>, and <strong>Database</strong>.</p><ul><li><strong>Query Node</strong>: The component that processes query tasks. It runs on a physical machine or container (e.g., a pod in Kubernetes).</li><li><strong>Resource Group</strong>: A collection of Query Nodes that acts as a bridge between logical components (databases and collections) and physical resources. You can allocate one or more databases or collections to a single Resource Group.</li></ul><p>In the example shown in the diagram above, there are three logical <strong>Databases</strong>: X, Y, and Z.</p><ul><li><strong>Database X</strong>: Contains <strong>Collection A</strong>.</li><li><strong>Database Y</strong>: Contains <strong>Collections B</strong> and <strong>C</strong>.</li><li><strong>Database Z</strong>: Contains <strong>Collections D</strong> and <strong>E</strong>.</li></ul><p>Let’s say <strong>Database X</strong> holds a critical knowledge base that we don’t want to be affected by the load from <strong>Database Y</strong> or <strong>Database Z</strong>. To ensure data isolation:</p><ul><li><strong>Database X</strong> is assigned its own <strong>Resource Group</strong> to guarantee that its critical knowledge base is unaffected by workloads from other databases.</li><li><strong>Collection E</strong> is also allocated to a separate <strong>Resource Group</strong> within its parent database (<strong>Z</strong>). This provides isolation at the collection level for specific critical data within a shared database.</li></ul><p>Meanwhile, the remaining collections in <strong>Databases Y</strong> and <strong>Z</strong> share the physical resources of <strong>Resource Group 2</strong>.</p><p>By carefully mapping logical components to physical resources, organizations can achieve a flexible, scalable, and secure multi-tenancy architecture tailored to their specific business needs.</p><h4>Designing End User-Level Access</h4><p>Now that we’ve learned the best practices for choosing a multi-tenancy strategy for an enterprise RAG, let’s explore how to design user-level access in such systems.</p><p>In these systems, end users usually interact with the knowledge base in a read-only mode through LLMs. However, organizations still need to track such Q&amp;A data generated by users and link it to specific users for various purposes, such as improving the knowledge base’s accuracy or offering personalized services.</p><p>Take a hospital’s smart consultation service desk as an example. Patients might ask questions like, “Are there any available appointments with the specialist today?” or “Is there any specific preparation needed for my upcoming surgery?” While these questions don’t directly impact the knowledge base, it’s important for the hospital to track such interactions to improve services. These Q&amp;A pairs are usually stored in a separate database (it doesn’t necessarily have to be a vector database) dedicated to logging interactions.</p><figure><img alt="Figure- The multi-tenancy architecture for an enterprise RAG knowledge base .png" src="https://cdn-images-1.medium.com/max/1024/0*ekUVRIqJK9_EC7ug.png" /></figure><p><em>Figure: The multi-tenancy architecture for an enterprise RAG knowledge base</em></p><p>The diagram above shows the multi-tenancy architecture of an enterprise RAG system.</p><ul><li><strong>System Administrators</strong> oversee the RAG system, manage resource allocation, assign databases, map them to resource groups, and ensure scalability. They handle the physical infrastructure, as shown in the diagram, where each resource group (e.g., Resource Group 1, 2, and 3) is mapped to physical servers (query nodes).</li><li><strong>Tenants (Database owners and developers)</strong> manage the knowledge base, iterating on it based on the user-generated Q&amp;A data, as shown in the diagram. Different databases (Database X, Y, Z) contain collections with different knowledge base content (Collection A, B, etc.).</li><li><strong>End Users</strong> interact with the system in a read-only manner through the LLM. As they query the system, their questions are logged in the separate Q&amp;A record table (a separate database), continuously feeding valuable data back into the system.</li></ul><p>This design ensures that each process layer — from user interaction to system administration — works seamlessly, helping the organization build a robust and continuously improving knowledge base.</p><h4>Summary</h4><p>In this blog, we’ve explored how <a href="https://milvus.io/docs/multi_tenancy.md"><strong>multi-tenancy</strong></a> frameworks play a critical role in the scalability, security, and performance of RAG-powered knowledge bases. By isolating data and resources for different tenants, businesses can ensure privacy, regulatory compliance, and optimized resource allocation across a shared infrastructure. <a href="https://milvus.io/docs/overview.md">Milvus</a>, with its flexible multi-tenancy strategies, allows businesses to choose the right level of data isolation — from database level to partition level — depending on their specific needs. Choosing the right multi-tenancy approach ensures companies can provide tailored services to tenants, even when dealing with diverse data and workloads.</p><p>By following the best practices outlined here, organizations can effectively design and manage multi-tenancy RAG systems that not only deliver superior user experiences but also scale effortlessly as business needs grow. Milvus’ architecture ensures that enterprises can maintain high levels of isolation, security, and performance, making it a crucial component in building enterprise-grade, RAG-powered knowledge bases.</p><h4>Stay Tuned for More Insights into Multi-Tenancy RAG</h4><p>In this blog, we’ve discussed how Milvus’ multi-tenancy strategies are designed to manage tenants, but not end users within those tenants. End-user interactions usually happen at the application layer, while the vector database itself remains unaware of those users.</p><p>You might be wondering: <em>If I want to provide more precise answers based on each end user’s query history, doesn’t Milvus need to maintain a personalized Q&amp;A context for each user?</em></p><p>That’s a great question, and the answer really depends on the use case. For example, in an on-demand consultation service, queries are random, and the main focus is on the quality of the knowledge base rather than on keeping track of a user’s historical context.</p><p>However, in other cases, RAG systems must be context-aware. When this is required, Milvus needs to collaborate with the application layer to maintain a personalized memory of each user’s context. This design is especially important for applications with massive end users, which we’ll explore in greater detail in my next post. Stay tuned for more insights!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c02bc4464c62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/designing-multi-tenancy-rag-with-milvus-best-practices-for-scalable-enterprise-knowledge-bases-c02bc4464c62">Designing Multi-Tenancy RAG with Milvus: Best Practices for Scalable Enterprise Knowledge Bases</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Contribute to Milvus: A Quick Start for Developers]]></title>
            <link>https://medium.com/vector-database/how-to-contribute-to-milvus-a-quick-start-for-developers-800205b37662?source=rss----e87dfc9fdbb6---4</link>
            <guid isPermaLink="false">https://medium.com/p/800205b37662</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[contribute-to-milvus]]></category>
            <dc:creator><![CDATA[Milvus]]></dc:creator>
            <pubDate>Mon, 02 Dec 2024 02:34:25 GMT</pubDate>
            <atom:updated>2025-04-18T08:20:35.861Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/milvus-io/milvus"><strong>Milvus</strong></a> is an open-source <a href="https://zilliz.com/learn/what-is-vector-database">vector database</a> designed to manage high-dimensional vector data. Whether you’re building intelligent search engines, recommendation systems, or next-gen AI solutions such as retrieval augmented generation (<a href="https://zilliz.com/learn/Retrieval-Augmented-Generation">RAG</a>), Milvus is a powerful tool at your fingertips.</p><p>But what truly drives Milvus forward isn’t just its advanced technology — it’s the vibrant, passionate <a href="https://zilliz.com/community">developer community</a> behind it. As an open-source project, Milvus thrives and evolves thanks to the contributions of developers like you. Every bug fix, feature addition, and performance enhancement from the community makes Milvus faster, more scalable, and more reliable.</p><p>Whether you’re passionate about open-source, eager to learn, or want to make a lasting impact in AI, Milvus is the perfect place to contribute. This guide will walk you through the process — from setting up your development environment to submitting your first pull request. We’ll also highlight common challenges you might face and provide solutions to overcome them.</p><p>Ready to dive in? Let’s make Milvus even better together!</p><h4>Setting Up Your Milvus Development Environment</h4><p>First thing first: setting up your development environment. You can either install Milvus on your local machine or use Docker — both methods are straightforward, but you’ll also need to install a few third-party dependencies to get everything running.</p><h4>Building Milvus Locally</h4><p>If you like building things from scratch, building Milvus on your local machine is a breeze. Milvus makes it easy by bundling all the dependencies in the install_deps.sh script. Here’s the quick setup:</p><pre># Install third-party dependencies.<br>$ cd milvus/<br>$ ./scripts/install_deps.sh<br><br># Compile Milvus.<br>$ make</pre><h4>Building Milvus with Docker</h4><p>If you prefer Docker, there are two ways to go about it: you can either run commands in a pre-built container or spin up a dev container for a more hands-on approach.</p><pre># Option 1: Run commands in a pre-built Docker container  <br>build/builder.sh make  <br><br># Option 2: Spin up a dev container  <br>./scripts/devcontainer.sh up  <br>docker-compose -f docker-compose-devcontainer.yml ps  <br>docker exec -ti milvus-builder-1 bash  <br>make milvus</pre><p><strong>Platform Notes:</strong> If you’re on Linux, you’re good to go — compilation issues are pretty rare. However, Mac users, especially with M1 chips, might run into some bumps along the way. Don’t sweat it, though — we have a guide to help you work through the most common issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xhGfISvXlwF0Sd2f.png" /></figure><p><em>Figure: OS configuration</em></p><p>For the full setup guide, check out the official <a href="https://github.com/milvus-io/milvus/blob/master/DEVELOPMENT.md">Milvus Development Guide</a>.</p><h4>Common Issues and How to Fix Them</h4><p>Sometimes, setting up your Milvus development environment doesn’t go as smoothly as planned. Don’t worry — here’s a quick rundown of common issues you might hit and how to fix them fast.</p><h4>Homebrew: Unexpected Disconnect While Reading Sideband Packet</h4><p>If you’re using Homebrew and see an error like this:</p><pre>==&gt; Tapping homebrew/core<br>remote: Enumerating objects: 1107077, done.<br>remote: Counting objects: 100% (228/228), done.<br>remote: Compressing objects: 100% (157/157), done.<br>error: 545 bytes of body are still expected.44 MiB | 341.00 KiB/s<br>fetch-pack: unexpected disconnect while reading sideband packet<br>fatal: early EOF<br>fatal: index-pack failed<br>Failed during: git fetch --force origin refs/heads/master:refs/remotes/origin/master<br>myuser~ %</pre><p><strong>Fix:</strong> Increase the http.postBuffer size:</p><pre>git config --global http.postBuffer 1M</pre><p>If you also run into Brew: command not found after installing Homebrew, you might need to set up your Git user configuration:</p><pre>git config --global user.email xxxgit config --global user.name xxx</pre><h4>Docker: Error Getting Credentials</h4><p>When working with Docker, you might see this:</p><pre>error getting credentials - err: exit status 1, out: ``</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iDdoBDwfuKrvwyGU.png" /></figure><p><strong>Fix:</strong> Open~/.docker/config.json and remove the credsStore field.</p><h4>Python: No Module Named ‘imp’</h4><p>If Python throws this error, it’s because Python 3.12 removed the imp module, which some older dependencies still use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CJqfKV3gylB6BXFl.png" /></figure><p><strong>Fix:</strong> Downgrade to Python 3.11:</p><pre>brew install python@3.11</pre><h4>Conan: Unrecognized Arguments or Command Not Found</h4><p><strong>Issue:</strong> If you see Unrecognized arguments: --install-folder conan, you’re likely using an incompatible Conan version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*acFJDc1uBX0KnR0k.png" /></figure><p><strong>Fix:</strong> Downgrade to Conan 1.61:</p><pre>pip install conan==1.61</pre><p><strong>Issue:</strong> If you see Conan command not found, it means your Python environment isn’t properly set up.</p><p><strong>Fix:</strong> Add Python’s bin directory to your PATH:</p><pre>export PATH=&quot;/path/to/python/bin:$PATH&quot;</pre><h4>LLVM: Use of Undeclared Identifier ‘kSecFormatOpenSSL’</h4><p>This error usually means your LLVM dependencies are outdated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cfx1LtJVHenfkOdf.png" /></figure><p><strong>Fix:</strong> Reinstall LLVM 15 and update your environment variables:</p><pre>brew reinstall llvm@15<br>export LDFLAGS=&quot;-L/opt/homebrew/opt/llvm@15/lib&quot;<br>export CPPFLAGS=&quot;-I/opt/homebrew/opt/llvm@15/include&quot;</pre><p><strong>Pro Tips</strong></p><ul><li>Always double-check your tool versions and dependencies.</li><li>If something still doesn’t work, the<a href="https://github.com/milvus-io/milvus/issues"> Milvus GitHub Issues page</a> is a great place to find answers or ask for help.</li></ul><h4>Configuring VS Code for C++ and Go Integration</h4><p>Getting C++ and Go to work together in VS Code is easier than it sounds. With the right setup, you can streamline your development process for Milvus. Just tweak your user.settings file with the configuration below:</p><pre>{<br>   &quot;go.toolsEnvVars&quot;: {<br>       &quot;PKG_CONFIG_PATH&quot;: &quot;/Users/zilliz/milvus/internal/core/output/lib/pkgconfig:/Users/zilliz/workspace/milvus/internal/core/output/lib64/pkgconfig&quot;,<br>       &quot;LD_LIBRARY_PATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;,<br>       &quot;RPATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;<br>   },<br>   &quot;go.testEnvVars&quot;: {<br>       &quot;PKG_CONFIG_PATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib/pkgconfig:/Users/zilliz/workspace/milvus/internal/core/output/lib64/pkgconfig&quot;,<br>       &quot;LD_LIBRARY_PATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;,<br>       &quot;RPATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;<br>   },<br>   &quot;go.buildFlags&quot;: [<br>       &quot;-ldflags=-r /Users/zilliz/workspace/milvus/internal/core/output/lib&quot;<br>   ],<br>   &quot;terminal.integrated.env.linux&quot;: {<br>       &quot;PKG_CONFIG_PATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib/pkgconfig:/Users/zilliz/workspace/milvus/internal/core/output/lib64/pkgconfig&quot;,<br>       &quot;LD_LIBRARY_PATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;,<br>       &quot;RPATH&quot;: &quot;/Users/zilliz/workspace/milvus/internal/core/output/lib:/Users/zilliz/workspace/milvus/internal/core/output/lib64&quot;<br>   },<br>   &quot;go.useLanguageServer&quot;: true,<br>   &quot;gopls&quot;: {<br>       &quot;formatting.gofumpt&quot;: true<br>   },<br>   &quot;go.formatTool&quot;: &quot;gofumpt&quot;,<br>   &quot;go.lintTool&quot;: &quot;golangci-lint&quot;,<br>   &quot;go.testTags&quot;: &quot;dynamic&quot;,<br>   &quot;go.testTimeout&quot;: &quot;10m&quot;<br>}</pre><p>Here’s what this configuration does:</p><ul><li><strong>Environment Variables:</strong> Sets up paths for PKG_CONFIG_PATH, LD_LIBRARY_PATH, and RPATH, which are critical for locating libraries during builds and tests.</li><li><strong>Go Tools Integration:</strong> Enables Go’s language server (gopls) and configures tools like gofumpt for formatting and golangci-lint for linting.</li><li><strong>Testing Setup:</strong> Adds testTags and increases the timeout for running tests to 10 minutes.</li></ul><p>Once added, this setup ensures a seamless integration between C++ and Go workflows. It’s perfect for building and testing Milvus without constant environment tweaking.</p><p><strong>Pro Tip</strong></p><p>After setting this up, run a quick test build to confirm everything works. If something feels off, double-check the paths and VS Code’s Go extension version.</p><h4>Deploying Milvus</h4><p>Milvus supports <a href="https://milvus.io/docs/install-overview.md">three deployment modes</a> — <strong>Lite, Standalone,</strong> and <strong>Distributed.</strong></p><ul><li><a href="https://milvus.io/blog/introducing-milvus-lite.md"><strong>Milvus Lite</strong></a> is a Python library and an ultra-lightweight version of Milvus. It’s perfect for rapid prototyping in Python or notebook environments and for small-scale local experiments.</li><li><strong>Milvus Standalone</strong> is the single-node deployment option for Milvus, using a client-server model. It is the Milvus equivalent of MySQL, while Milvus Lite is like SQLite.</li><li><strong>Milvus Distributed</strong> is the distributed mode of Milvus, which is ideal for enterprise users building large-scale vector database systems or vector data platforms.</li></ul><p>All these deployments rely on three core components:</p><ul><li><strong>Milvus:</strong> The vector database engine that drives all operations.</li><li><strong>Etcd:</strong> The metadata engine that manages Milvus’s internal metadata.</li><li><strong>MinIO:</strong> The storage engine that ensures data persistence.</li></ul><p>When running in <strong>Distributed</strong> mode, Milvus also incorporates <strong>Pulsar</strong> for distributed message processing using a Pub/Sub mechanism, making it scalable for high-throughput environments.</p><h4>Milvus Standalone</h4><p>The Standalone mode is tailored for single-instance setups, making it perfect for testing and small-scale applications. Here’s how to get started:</p><pre># Deploy Milvus Standalone  <br>sudo docker-compose -f deployments/docker/dev/docker-compose.yml up -d<br># Start the standalone service  <br>bash ./scripts/start_standalone.sh</pre><h4>Milvus Distributed (previously known as Milvus Cluster)</h4><p>For larger datasets and higher traffic, the Distributed mode offers horizontal scalability. It combines multiple Milvus instances into a single cohesive system. Deployment is made easy with the <strong>Milvus Operator</strong>, which runs on Kubernetes and manages the entire Milvus stack for you.</p><p>Want step-by-step guidance? Check out the <a href="https://milvus.io/docs/install_cluster-milvusoperator.md">Milvus Installation Guide</a>.</p><h4>Running End-to-End (E2E) Tests</h4><p>Once your Milvus deployment is up and running, testing its functionality is a breeze with E2E tests. These tests cover every part of your setup to ensure everything works as expected. Here’s how to run them:</p><pre># Navigate to the test directory  <br>cd tests/python_client  <br><br># Install dependencies  <br>pip install -r requirements.txt  <br><br># Run E2E tests  <br>pytest --tags=L0 -n auto</pre><p>For in-depth instructions and troubleshooting tips, refer to the <a href="https://github.com/milvus-io/milvus/blob/master/DEVELOPMENT.md#e2e-tests">Milvus Development Guide</a>.</p><p><strong>Pro Tip</strong></p><p>If you’re new to Milvus, start with Milvus Lite or Standalone mode to get a feel for its capabilities before scaling up to Distributed mode for production-level workloads.</p><h4>Submitting Your Code</h4><p>Congrats! You’ve cleared all unit and E2E tests (or debugged and recompiled as needed). While the first build can take some time, future ones will be much faster — so no need to worry. With everything passing, you’re ready to submit your changes and contribute to Milvus!</p><h4>Link Your Pull Request (PR) to an Issue</h4><p>Every PR to Milvus needs to be tied to a relevant issue. Here’s how to handle this:</p><ul><li><strong>Check for Existing Issues:</strong> Look through the<a href="https://github.com/milvus-io/milvus/issues"> Milvus issue tracker</a> to see if there’s already an issue related to your changes.</li><li><strong>Create a New Issue:</strong> If no relevant issue exists, open a new one and explain the problem you’re solving or the feature you’re adding.</li></ul><h4>Submitting Your Code</h4><ol><li><strong>Fork the Repository:</strong> Start by forking the<a href="https://github.com/milvus-io/milvus"> Milvus repo</a> to your GitHub account.</li><li><strong>Create a Branch:</strong> Clone your fork locally and make a new branch for your changes.</li><li><strong>Commit with Signed-off-by Signature:</strong> Ensure your commits include a Signed-off-by signature to comply with open-source licensing:</li></ol><pre>git commit -m &quot;Commit of your change&quot; -s</pre><p>This step certifies your contribution is in line with the Developer Certificate of Origin (DCO).</p><h4><strong>Helpful Resources</strong></h4><p>For detailed steps and best practices, check out the<a href="https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md"> Milvus Contribution Guide</a>.</p><h4>Opportunities to Contribute</h4><p>Congrats — you’ve got Milvus up and running! You’ve explored its deployment modes, run your tests, and maybe even dug into the code. Now it’s time to level up: contribute to <a href="https://github.com/milvus-io/milvus">Milvus</a> and help shape the future of AI and <a href="https://zilliz.com/learn/introduction-to-unstructured-data">unstructured data</a>.</p><p>No matter your skillset, there’s a place for you in the Milvus community! Whether you’re a developer who loves solving complex challenges, a tech writer who loves writing clean documentation or engineering blogs, or a Kubernetes enthusiast looking to improve deployments, there’s a way for you to make an impact.</p><p>Take a look at the opportunities below and find your perfect match. Every contribution helps move Milvus forward — and who knows? Your next pull request might just power the next wave of innovation. So, what are you waiting for? Let’s get started! 🚀</p><p>| Projects | Suitable for | Guidelines | | — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — | — — — — — — — — — — — — — — — — — — — — | — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — | | <a href="https://github.com/milvus-io/milvus">milvus</a>, <a href="https://github.com/milvus-io/milvus-sdk-go">milvus-sdk-go</a> | Go developers | / | | <a href="https://github.com/milvus-io/milvus">milvus</a>, <a href="https://github.com/milvus-io/knowhere">knowhere</a> | CPP developers | / | | <a href="https://github.com/milvus-io/pymilvus">pymilvus</a>, <a href="https://github.com/milvus-io/milvus-sdk-node">milvus-sdk-node</a>, <a href="https://github.com/milvus-io/milvus-sdk-java">milvus-sdk-java</a> | Developers interested in other languages | <a href="https://github.com/milvus-io/pymilvus/blob/master/CONTRIBUTING.md">Contributing to PyMilvus</a> | | <a href="https://github.com/milvus-io/milvus-helm">milvus-helm</a> | Kubernetes enthusiasts | / | | <a href="https://github.com/milvus-io/milvus-docs">Milvus-docs</a>, <a href="https://github.com/milvus-io/community">milvus-io/community/blog</a> | Tech writers | <a href="https://github.com/milvus-io/milvus-docs/blob/v2.0.0/CONTRIBUTING.md">Contributing to milvus docs</a> | | <a href="https://github.com/zilliztech/milvus-insight">milvus-insight</a> | Web developers | / |</p><h4>A Final Word</h4><p>Milvus offers various SDKs — <a href="https://milvus.io/docs/install-pymilvus.md">Python</a> (PyMilvus), <a href="https://milvus.io/docs/install-java.md">Java</a>, <a href="https://milvus.io/docs/install-go.md">Go</a>, and <a href="https://milvus.io/docs/install-node.md">Node.js</a> — that make it simple to start building. Contributing to Milvus isn’t just about code — it’s about joining a vibrant and innovative community.</p><p>🚀Welcome to the Milvus developer community, and happy coding! We can’t wait to see what you’ll create.</p><h4>Further Reading</h4><ul><li><a href="https://zilliz.com/community">Join the Milvus Community of AI Developers</a></li><li><a href="https://zilliz.com/learn/what-is-vector-database">What are Vector Databases and How Do They Work?</a></li><li><a href="https://zilliz.com/blog/choose-the-right-milvus-deployment-mode-ai-applications">Milvus Lite vs. Standalone vs. Distributed: Which Mode is Right for You?</a></li><li><a href="https://zilliz.com/learn/milvus-notebooks">Build AI Apps with Milvus: Tutorials &amp; Notebooks</a></li><li><a href="https://zilliz.com/ai-models">Top Performing AI Models for Your GenAI Apps | Zilliz</a></li><li><a href="https://zilliz.com/learn/Retrieval-Augmented-Generation">What is RAG?</a></li><li><a href="https://zilliz.com/learn/generative-ai">Generative AI Resource Hub | Zilliz</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=800205b37662" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vector-database/how-to-contribute-to-milvus-a-quick-start-for-developers-800205b37662">How to Contribute to Milvus: A Quick Start for Developers</a> was originally published in <a href="https://medium.com/vector-database">Vector Database for AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>