Milvus & FAISS: Decoding Their ML Synergy

CK CK 3788 
Created at  
287 0 0

What is Milvus?

Milvus is an open-source vector database designed for storing, indexing, and managing billions of embedding vectors. It specializes in high-performance similarity search over these vectors. Milvus is built to handle the unique challenges of vector data, such as:

  • High-Dimensional Data: Efficiently stores and searches vectors with hundreds or thousands of dimensions.
  • Scalability: Supports distributed architectures to scale out for massive datasets and high query throughput.
  • Real-time Performance: Provides low-latency query responses for similarity searches.
  • Diverse Indexing: Supports various indexing techniques to optimize search performance based on specific needs.
  • Data Management: Offers features like data persistence, CRUD operations (create, read, update, delete) for vectors, and data filtering capabilities.

Milvus is commonly used in applications requiring semantic search, recommendation systems, image/video recognition, drug discovery, and anomaly detection, where the core task is to find similar items based on their vector representations.

Milvus & FAISS: Decoding Their ML Synergy

 

What is FAISS?

FAISS (Facebook AI Similarity Search) is a library developed by Facebook AI Research for efficient similarity search and clustering of dense vectors. It provides a highly optimized collection of algorithms that can search through billions of vectors in sub-second time. Key characteristics of FAISS include:

  • Algorithm Variety: Offers a wide range of indexing algorithms, including exact search (brute-force) and approximate nearest neighbor (ANN) methods like IVF_FLAT, IVF_PQ, LSH, HNSW, etc., each with different trade-offs between speed, memory usage, and accuracy.
  • High Performance: Implements these algorithms with C++ for maximum speed, with Python wrappers for ease of use. It also supports GPU acceleration for further performance gains.
  • Memory Efficiency: Designed to work with large datasets that might exceed available RAM by employing techniques like compression.
  • Locality: Primarily a library for indexing and searching within a single process or machine, though its indexes can be distributed manually.

FAISS is an engine that focuses purely on the mathematical task of finding nearest neighbors given a set of vectors.

 

 

Why Milvus is Paired with FAISS for ML?

Milvus is not merely paired with FAISS; it integrates FAISS (and other libraries like HNSWlib) as its core indexing and search engine. Milvus leverages FAISS's highly optimized algorithms to perform the actual approximate nearest neighbor (ANN) search on vector data.

Milvus & FAISS: Decoding Their ML Synergy

When you insert vectors into Milvus, Milvus takes care of:

  1. Distributed Storage: Storing the vectors across its distributed cluster.
  2. Data Management: Handling metadata, filtering, and CRUD operations.
  3. Orchestration: Managing data shards and query distribution.
  4. Index Building: Internally, for each shard of data, Milvus uses an indexing library like FAISS to build an ANN index. When you specify an index type (e.g., IVF_FLAT), Milvus configures and utilizes FAISS (or a similar engine) to construct that specific index from the vector data.
  5. Query Execution: When a search query comes in, Milvus routes it to the relevant shards, performs a search on the FAISS indexes residing on those shards, aggregates the results, and returns them to the user.

In essence, FAISS provides the powerful, low-level algorithms for vector similarity search, and Milvus wraps these algorithms within a complete, scalable, and manageable vector database system.

 

Benefits of Paring Milvus and FAISS

The integration of Milvus and FAISS offers a comprehensive and robust solution for machine learning applications requiring vector similarity search:

  • Scalability and Performance: FAISS provides optimized search capabilities for individual data segments, while Milvus manages these searches across a distributed cluster. This allows querying billions of vectors with low latency and scales horizontally as data volume grows.
  • Ease of Use and Management: Milvus abstracts away the complexities of managing FAISS indexes directly. Users interact with a database system, not just a library. This includes simplified data insertion, deletion, updates, and schema management.
  • Robustness and Reliability: Milvus offers features like data persistence, high availability, and fault tolerance, which are not inherent in FAISS alone. This ensures data integrity and continuous service for production ML systems.
  • Unified Ecosystem: Milvus provides a unified API and ecosystem for vector search, allowing users to switch between different indexing algorithms (including those from FAISS) and manage their vector data efficiently without needing to implement the underlying distributed logic themselves.
  • Rich Features: In addition to basic search, Milvus offers features like scalar filtering, real-time data ingestion, and multi-tenancy, which enhance FAISS's core search functionality and help build complete ML-powered applications.
  • Developer Productivity: Developers can focus on building their ML models and applications, using Milvus as a reliable backend for vector search, instead of spending time optimizing FAISS indexes for distributed environments or managing data at a low level.

 

Data Storage in Milvus

Milvus is a vector database that leverages indexing libraries like FAISS (or HNSW, Annoy, IVF_PQ, etc.) for efficient similarity search. While FAISS provides the algorithms and structures for building and searching indexes in memory, Milvus is the system responsible for the comprehensive management, persistence, and distribution of the data.

 

Who is actually storing data?

  • Milvus Itself: Milvus is the primary system storing and managing your vector data and its associated metadata. It orchestrates the entire data lifecycle, from ingestion to indexing, querying, and persistence.
  • Decoupled Storage Layer: Milvus's architecture decouples compute and storage. It doesn't store data directly on the local disks of its query or index nodes. Instead, it utilizes a dedicated, highly scalable, and persistent storage layer.
  • Underlying Persistent Storage:
    • Object Storage: For the actual vector data and generated index files, Milvus primarily relies on cloud-native object storage solutions such as Amazon S3, MinIO, Azure Blob Storage, or Google Cloud Storage. This provides high durability, availability, and cost-effective scalability.
    • Structured Storage (Meta Store): For metadata (like collection schemas, partition information, segment details, and operational logs), Milvus typically uses a robust metadata store like etcd. This ensures consistency and coordination across its distributed components.
    • Message Queue: A message queue (e.g., Kafka, Pulsar) is used for reliable data transfer between components, ensuring data integrity during ingestion and processing, and contributing to the system's fault tolerance.
  • Data Nodes: Within the Milvus cluster, DataNodes are responsible for ingesting incoming vector data, converting it into internal segments, and persisting these segments to the underlying object storage. They ensure that all ingested data is reliably written to a durable store before being acknowledged.
  • Query Nodes and Index Nodes: These nodes operate on data that has been persisted. IndexNodes read raw vector data from object storage to build indexes (e.g., FAISS indexes) and then write these index files back to object storage. QueryNodes load these index files (or parts of them) from object storage into their memory to serve search queries.

In summary, Milvus stores data persistently on a distributed object storage system, coordinated by a metadata store and a message queue. FAISS is an indexing engine used by Milvus, not the storage engine itself.

Milvus & FAISS: Decoding Their ML Synergy

 

Tags AI Tools FAISS Kafka ML Pairing Machine Learning Message Queue Metadata Store Milvus Milvus FAISS Mulvus API Object Storage Open Source AI Pulsar Similarity Search Vector Database Vector Search 밀버스 페이스 Facebook X
Comments 0
Similar posts
  1. Getting Started with FAISS: A CentOS 7 Installation Guide
    288
  2. ChatGPT App (flowGPT) to create images with text
    1,042
  3. AI-based Image Creation based on Bing Image Creator
    991
  4. FAISS Already Does ANN... So Why Do Top Teams Still Pay for SageMaker?
    315
  5. PyTorch example to Forcast Stock Price based on 10 days Dataset
    654
  6. Predicting Buyer Preferences with PyTorch: A Deep Learning Approach
    1,234
  7. Mastering Ad Budget Throttling: Static, PID, and ML Strategies
    325
  8. Recommended Vector DB Structure for Amazon Bedrock Integration
    394
  9. Ad Impression Forecasting (aka Ad Inventory Forecasting): Architecting for Scale, Speed, and Accuracy
    335
  10. AI-Powered Ad Fraud Detection: Architectural Strategies
    337
  11. Brand Safety: AI-Driven Content Moderation on AWS
    739
  12. Your Comprehensive Guide to Flink & Kafka for Real-time Stream Processing
    423
  13. Machine Learning Models for Ad Detection from a Video Stream
    195
  14. Understanding Elasticsearch from Installation to Trouble Shooting
    915
  15. Deep Dive into Vector Databases: Understanding Collections (Not Tables) and Embeddings
    240
  16. Image Embeddings for Vector Databases
    257
  17. CentOS 7 PHP Apache Kafka: Installation, Examples, and System Diagram
    311
  18. Apache Kafka Explained: Powering Netflix, Building with PHP
    495
  19. Vector Databases: From Embeddings to Application
    323
  20. MCP vs A2A
    606
  21. The Ultimate Data Engineering Roadmap
    1,084
  22. Building a MCP server in PHP
    639
  23. Scaling Vector Search: How to Architect FAISS on AWS EKS and ECS
    196
  24. Milvus and LLM Integration - Very Smart Approach!
    305
  25. Integrating VectorDB stored in S3 with Amazon Bedrock
    429
  26. How to overcome the prompt size limit when you use Claude via Bedrock - Chunking / Splitting the Input
    502
  27. Architecting ML/LLM Ad Targeting with Kafka, Flink, FAISS, and Milvus
    285
  28. The Core of Vector Databases: Embeddings and LLM Dependency
    267
  29. Python ML Technologies used for the target Segmentation
    381
  30. Your Blueprint for an LLM & Vector DB Insurance Product Q&A
    267
  1. Python Simplified Assignment Operators
    535
  2. Trackback module used for Python Threading debugging
    847
  3. Python Flask with simple HTML files to server web pages along with API
    933
  4. Python Flask web server tutorial from the scratch
    626
  5. Simple Web Server based in Python
    383
  6. Thread Implementation in Python
    512
  7. A shell script that activates a Python virtual environment and then runs a specific Python script
    747
  8. Learning about Python Multiprocessing Technique
    594
  9. Simple Example to get the total number of records in BigQuery with Python
    668
  10. Using BigQuery in Python
    414
  11. Python Web Programming based on Django from the Scratch
    391
  12. Flink with Python: Core Concepts, Kafka Integration, and Architectural Trade-offs
    193
  13. How do I determine the client IP type in Python - IPv4 or IPv6
    767
  14. Implementing a Versatile DNS Server in Python: Handling A, AAAA, CNAME, and TXT Records
    1,078
  15. Dynamic DNS Made Easy: Building a Python-Based Solution
    796
  16. Save clustering result (aka dictionary) in JSON and Reuse loaded result
    382
  17. Forecasting with Linear Regression and KNN Regression in Python
    929
  18. Forecasting the Weather with PyTorch: A Beginner's Guide to Temperature Prediction
    1,445
  19. Uvicorn, Gunicorn: Proving Your Production Prowess
    401
  20. Mastering Model Persistence: Saving and Loading Trained Machine Learning Models in Python
    1,167
  21. Harnessing the Power of Random Forest Algorithm in Python
    660
  22. Understanding and Implementing K-Nearest Neighbors (KNN) Algorithm in Python
    636
  23. Mastering Random Forest Regression: A Comprehensive Guide with Python Examples
    1,104
  24. Simple Python Clustering Example based on the high school students' score
    345
  25. Getting Started with PyTorch: A Beginner's Guide to Building Your First Neural Network
    801
  26. Memory Problems with Python Arrays? Discover Dask Array
    329
  27. Python Implementation of Linear Regression
    843
  28. Mastering Supervised Machine Learning with Python: A Comprehensive Guide
    1,060
  29. Mastering AI: A Beginner's Guide to Python Programming and Beyond
    1,041
Recently updated
  1. Google OAuth Token Expiration: Causes and Solutions
    31
  2. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    57
  3. Why SPF and DKIM Are Essential for Linux Email Servers?
    51
  4. How do I create animated background for Google Meet?
    23,256
  5. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    273
  6. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    105
  7. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    170
  8. Array of arguments passed to script in PHP
    99
  9. Invalid Auction Storms in Ad Tech
    108
  10. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    209
  11. The Two Clocks of Ad Server Architecture
    78
  12. Frequency Cap Architecture Overview
    527
  13. Collecting Proof-of-Play from 100,000 Screens
    154
  14. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    304
  15. What is RedisVL?
    117
  16. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    247
  17. TPU & GPU Cluster Management Tools
    258
  18. The Concept of Scaffolding in AI Agents
    245
  19. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    599
  20. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    269
  21. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    355
  22. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    207
  23. Machine Learning: Training vs. Ranking
    232
  24. The Continuous Learning Machine: Designing a Loop That Actually Turns
    229
  25. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    204
  26. Designing a Data Curation System Around a Vector Database
    230
  27. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    264
  28. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    674
  29. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    201
  30. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    233