1 | © Copyright 2023 Zilliz
1
Stephen Batifol | Zilliz
Unstructured Data Meetup #1, @GetYourGuide
Vector Databases 101
2 | © Copyright 2023 Zilliz
2
Stephen Batifol
Developer Advocate, Zilliz
stephen.batifol@zilliz.com
https://www.linkedin.com/in/stephen-batifol/
https://twitter.com/stephenbtl
Speaker
3 | © Copyright 2023 Zilliz
3
Open Source
Deploy fully managed or “Bring Your
Own Cloud” (BYOC)
Commercial Offerings
Zilliz Cloud
Optimized Milvus with essential data and
security tools for a high-performing vector
search platform
VECTOR SEARCH
ENGINE
VECTORDB
BENCHMARK TOOL
VECTOR DATABASE
SEMANTIC CACHE
FOR LLM QUERIES
GPT-Cache
Product Portfolio
GUI for Milvus
4 | © Copyright 2023 Zilliz
4
Couple of Customers
5 | © Copyright 2023 Zilliz
5
Cloud
Service
Provider
Data Platform
GenAI Tooling
Chip
Manufacturer
Partner with Industry Leaders
6 | © Copyright 2023 Zilliz
6
01 What is Similarity Search?
CONTENTS
03
04 Vector Database Architecture
02 Where do You Get Vectors From?
How are Vector Databases Different?
7 | © Copyright 2023 Zilliz
7
01 Vector Databases 101 Review
8 | © Copyright 2023 Zilliz
8
- Unstructured Data is 80% of data
- Vector Databases are really good with
unstructured data
- Examples of Unstructured Data include text,
images, videos, audio, etc
Why Vector Databases?
9 | © Copyright 2023 Zilliz
9
Traditional databases were built on exact search
10 | © Copyright 2023 Zilliz
10
…which misses context, semantic meaning, and user intent
VS.
Apple
VS.
Rising dough
VS.
Change car tire
Rising Dough
Proofing Bread
✔
❌
11 | © Copyright 2023 Zilliz
11
But wait! There’s more!
12 | © Copyright 2023 Zilliz
12
Vector
Databases
Where do Vectors Come From?
13 | © Copyright 2023 Zilliz
13
Embeddings Models
14 | © Copyright 2023 Zilliz
14
02 Vector Database Use Cases
15 | © Copyright 2023 Zilliz
15
Retrieval Augmented
Generation (RAG)
Expand LLMs' knowledge by
incorporating external data sources
into LLMs and your AI applications.
Match user behavior or content
features with other similar ones to
make effective recommendations.
Recommender System
Search for semantically similar
texts across vast amounts of
natural language documents.
Text/ Semantic Search
Image Similarity Search
Identify and search for visually
similar images or objects from a
vast collection of image libraries.
Video Similarity Search
Search for similar videos, scenes,
or objects from extensive
collections of video libraries.
Audio Similarity Search
Find similar audios in large datasets
for tasks like genre classification or
speech recognition
Molecular Similarity Search
Search for similar substructures,
superstructures, and other
structures for a specific molecule.
Anomaly Detection
Detect data points, events, and
observations that deviate
significantly from the usual pattern
Multimodal Similarity Search
Search over multiple types of data
simultaneously, e.g. text and
images
Common AI Use Cases
16 | © Copyright 2023 Zilliz
16
Reverse Image Search - Paintings
17 | © Copyright 2023 Zilliz
17
Text Search on Wikipedia
18 | © Copyright 2023 Zilliz
18
03 How do Vector
Databases Work?
19 | © Copyright 2023 Zilliz
19
Example Entry
20 | © Copyright 2023 Zilliz
20
04 What is Similarity Search?
21 | © Copyright 2023 Zilliz
21
Image from Nvidia
Vector Search Overview
22 | © Copyright 2023 Zilliz
22
Vector Similarity Measures: L2 (Euclidean)
Queen = [0.3, 0.9]
King = [0.5, 0.7]
d(Queen, King) = √(0.3-0.5)2
+ (0.9-0.7)2
= √(0.2)2
+ (0.2)2
= √0.04 + 0.04
= √0.08 ≅ 0.28
23 | © Copyright 2023 Zilliz
23
Vector Similarity Measures: Inner Product (IP)
Queen = [0.3, 0.9]
King = [0.5, 0.7]
Queen · King = (0.3*0.5) + (0.9*0.7)
= 0.15 + 0.63 = 0.78
24 | © Copyright 2023 Zilliz
24
Queen = [0.3, 0.9]
King = [0.5, 0.7]
Vector Similarity Measures: Cosine
𝚹
cos(Queen, King) = (0.3*0.5)+(0.9*0.7)
√0.32
+0.92
* √0.52
+0.72
= 0.15+0.63 _
√0.9 * √0.74
= 0.78 _
√0.666
≅ 0.03
25 | © Copyright 2023 Zilliz
25
Important Notes
- Cosine, IP, and L2 are all the SAME rank order.
- They differ in use case
- L2 for when you need magnitude
- Cosine for orientation
- IP for magnitude and orientation
- OR
- Cosine = IP for normalized vectors
26 | © Copyright 2023 Zilliz
26
Inverted File Index
Source:
https://towardsdatascience.com/similarity-search-with-ivfpq-9c6348fd4db3
27 | © Copyright 2023 Zilliz
27
HNSW
Source:
https://arxiv.org/ftp/arxiv/papers/1603/1603.09320.pdf
28 | © Copyright 2023 Zilliz
28
GPU Index
29 | © Copyright 2023 Zilliz
29
Scalar Quantization
30 | © Copyright 2023 Zilliz
30
Product Quantization
Source:
https://towardsdatascience.com/product-quantization-for-similarity-search-2f1f67c5fddd
31 | © Copyright 2023 Zilliz
31
Picking an Index
● 100% Recall – Use FLAT search if you need 100% accuracy
● 10MB < index_size < 2GB – Standard IVF
● 2GB < index_size < 20GB – Consider PQ and HNSW
● 20GB < index_size < 200GB – Composite Index, IVF_PQ or
HNSW_SQ
● Disk-based indexes
32 | © Copyright 2023 Zilliz
32
05
How are Vector
Databases Different
from Other Databases?
33 | © Copyright 2023 Zilliz
33
Why Not Use a SQL/NoSQL Database?
• Inefficiency in High-dimensional spaces
• Suboptimal Indexing
• Inadequate query support
• Lack of scalability
• Limited analytics capabilities
• Data conversion issues
TL;DR: Vector operations are too computationally intensive for
traditional database infrastructures
34 | © Copyright 2023 Zilliz
34
Why Not Use a Vector Search Library?
• Have to manually implement filtering
• Not optimized to take advantage of the latest hardware
• Unable to handle large scale data
• Lack of lifecycle management
• Inefficient indexing capabilities
• No built in safety mechanisms
TL;DR: Vector search libraries lack the infrastructure to help you scale,
deploy, and manage your apps in production.
35 | © Copyright 2023 Zilliz
35
What is Milvus/Zilliz ideal for?
• Advanced filtering
• Hybrid search
• Durability and backups
• Replications/High Availability
• Sharding
• Aggregations
• Lifecycle management
• Multi-tenancy
• High query load
• High insertion/deletion
• Full precision/recall
• Accelerator support (GPU,
FPGA)
• Billion-scale storage
Purpose-built to store, index and query vector embeddings from unstructured data at scale.
36 | © Copyright 2023 Zilliz
36
06 Vector Database Architecture
37 | © Copyright 2023 Zilliz
37
Meta Storage
Root Query Data Index
Coordinator Service
Proxy
Proxy
etcd
Log Broker
SDK
Load Balancer
DDL/DCL
DML
NOTIFICATION
CONTROL SIGNAL
Object Storage
Minio / S3 / AzureBlob
Log Snapshot Delta File Index File
Worker Node QUERY DATA DATA
Message Storage
Access Layer
Query Node Data Node Index Node
High-level overview of Milvus’ Architecture
38 | © Copyright 2023 Zilliz
38
Questions?
Give Milvus a Star! Chat with me on Discord! Meetup, May 7
@Delivery Hero
39 | © Copyright 2023 Zilliz
39 | © Copyright 9/25/23 Zilliz
39
Appendix
40 | © Copyright 2023 Zilliz
40
Milvus Architecture: Differentiation
1. Cloud Native, Distributed System Architecture
2. True Separation of Concerns
3. Scalable Index Creation Strategy with 512 MB Segments
41 | © Copyright 2023 Zilliz
41
Vector Databases are purpose-built to handle
indexing, storing, and querying vector data.
Milvus & Zilliz are specifically designed for high
performance and billion+ scale use cases.
Takeaway:
42 | © Copyright 2023 Zilliz
42
Examples
Chunk Size=32, Overlap=10
43 | © Copyright 2023 Zilliz
43
Examples
Chunk Size=128, Overlap=20
44 | © Copyright 2023 Zilliz
44
Examples
Chunk Size=256, Overlap=50
45 | © Copyright 2023 Zilliz
45
Examples
SentenceSplitter
46 | © Copyright 2023 Zilliz
46
We’ve built technologies for various types of
use cases
Compute Types
Support different types of
compute powers, such as
AVX512, Neon for SIMD
execution, quantization &
cache-aware optimization,
and GPU
Leverage specific strengths
of each hardware type
efficiently, ensuring
high-speed processing and
cost-effective scalability for
diverse application needs
Search Types
Provide diverse search
types such as top-K ANN,
Range ANN, hybrid ANN
and metadata filtering
Enable unparalleled query
flexibility and accuracy,
allowing developers to
tailor their data retrieval
needs
Multi-tenancy
Enable multi-tenancy
through collection and
partition management
Allow for efficient resource
utilization and customizable
data segregation, ensuring
secure and isolated data
handling for each tenant
Index Types
Offer a diverse range of 11
index types, including
popular ones like HNSW,
IVF, PQ, and GPU index
Empower developers with
tailored search
optimizations, catering to
specific performance and
accuracy needs
47 | © Copyright 2023 Zilliz
47
Tests shows consistent query performance when
scaled from 65 million to 1 billion vectors
48 | © Copyright 2023 Zilliz
48
ANN Benchmark has recognized Milvus as the
performance leader among vector database players
49 | © Copyright 2023 Zilliz
49
The Zilliz Cloud Platform
Data Consumers
Data Applications
Data Sources
Unstructured Data
Zilliz Cloud
Managed Milvus Vector Database
Integrations
High performance
vector search
Store, Index, and
query
Low latency with
high recall
Supports real-time
responses
Vector search
index diversity
Efficient search &
scalability
Multiple similarity
metrics
Flexibility in querying
& adaptability
Built-in data
filtering
Efficient data
retrieval
On transit data
encryption
Enterprise security &
support
Images
Video
Documents
Audio
User Generated
Content
Recommendation
systems
Search (text,
image, audio)
Chatbots
Anomaly
detection
DNA sequence
classification
50 | © Copyright 2023 Zilliz
50
Data Consumers
Data Sources Zilliz Cloud
Integrations
Recommendation
systems
Search (text,
image, audio)3
Chatbots
Anomaly
detection
DNA sequence
classification
Images
User Generated
Video
Documents
Audio
Hosted Milvus Vector Database Data Applications
Unstructured Data
Zilliz Cloud Platform
✔ High performance vector search ⏤ Store, Index, and query
✔ Low latency with high recall ⏤ Supports real-time responses
✔ Vector search index diversity ⏤ Efficient search & scalability
✔ Multiple similarity metrics ⏤ Flexibility in querying & adaptability
✔ Built-in data filtering ⏤ Efficient data retrieval
✔ On transit data encryption ⏤ Enterprise security & support
51 | © Copyright 2023 Zilliz
51
52 | © Copyright 2023 Zilliz
52
Meta Storage
Root Query Data Index
Coordinator Service
Proxy
Proxy
etcd
Log Broker
SDK
Load Balancer
DDL/DCL
DML
NOTIFICATION
CONTROL SIGNAL
Object Storage
Minio / S3 / AzureBlob
Log Snapshot Delta File Index File
Worker Node QUERY DATA DATA
Message Storage
VECTOR
DATABASE
Access Layer
Query Node Data Node Index Node
Milvus Architecture

Vector Databases 101 - An introduction to the world of Vector Databases

  • 1.
    1 | ©Copyright 2023 Zilliz 1 Stephen Batifol | Zilliz Unstructured Data Meetup #1, @GetYourGuide Vector Databases 101
  • 2.
    2 | ©Copyright 2023 Zilliz 2 Stephen Batifol Developer Advocate, Zilliz stephen.batifol@zilliz.com https://www.linkedin.com/in/stephen-batifol/ https://twitter.com/stephenbtl Speaker
  • 3.
    3 | ©Copyright 2023 Zilliz 3 Open Source Deploy fully managed or “Bring Your Own Cloud” (BYOC) Commercial Offerings Zilliz Cloud Optimized Milvus with essential data and security tools for a high-performing vector search platform VECTOR SEARCH ENGINE VECTORDB BENCHMARK TOOL VECTOR DATABASE SEMANTIC CACHE FOR LLM QUERIES GPT-Cache Product Portfolio GUI for Milvus
  • 4.
    4 | ©Copyright 2023 Zilliz 4 Couple of Customers
  • 5.
    5 | ©Copyright 2023 Zilliz 5 Cloud Service Provider Data Platform GenAI Tooling Chip Manufacturer Partner with Industry Leaders
  • 6.
    6 | ©Copyright 2023 Zilliz 6 01 What is Similarity Search? CONTENTS 03 04 Vector Database Architecture 02 Where do You Get Vectors From? How are Vector Databases Different?
  • 7.
    7 | ©Copyright 2023 Zilliz 7 01 Vector Databases 101 Review
  • 8.
    8 | ©Copyright 2023 Zilliz 8 - Unstructured Data is 80% of data - Vector Databases are really good with unstructured data - Examples of Unstructured Data include text, images, videos, audio, etc Why Vector Databases?
  • 9.
    9 | ©Copyright 2023 Zilliz 9 Traditional databases were built on exact search
  • 10.
    10 | ©Copyright 2023 Zilliz 10 …which misses context, semantic meaning, and user intent VS. Apple VS. Rising dough VS. Change car tire Rising Dough Proofing Bread ✔ ❌
  • 11.
    11 | ©Copyright 2023 Zilliz 11 But wait! There’s more!
  • 12.
    12 | ©Copyright 2023 Zilliz 12 Vector Databases Where do Vectors Come From?
  • 13.
    13 | ©Copyright 2023 Zilliz 13 Embeddings Models
  • 14.
    14 | ©Copyright 2023 Zilliz 14 02 Vector Database Use Cases
  • 15.
    15 | ©Copyright 2023 Zilliz 15 Retrieval Augmented Generation (RAG) Expand LLMs' knowledge by incorporating external data sources into LLMs and your AI applications. Match user behavior or content features with other similar ones to make effective recommendations. Recommender System Search for semantically similar texts across vast amounts of natural language documents. Text/ Semantic Search Image Similarity Search Identify and search for visually similar images or objects from a vast collection of image libraries. Video Similarity Search Search for similar videos, scenes, or objects from extensive collections of video libraries. Audio Similarity Search Find similar audios in large datasets for tasks like genre classification or speech recognition Molecular Similarity Search Search for similar substructures, superstructures, and other structures for a specific molecule. Anomaly Detection Detect data points, events, and observations that deviate significantly from the usual pattern Multimodal Similarity Search Search over multiple types of data simultaneously, e.g. text and images Common AI Use Cases
  • 16.
    16 | ©Copyright 2023 Zilliz 16 Reverse Image Search - Paintings
  • 17.
    17 | ©Copyright 2023 Zilliz 17 Text Search on Wikipedia
  • 18.
    18 | ©Copyright 2023 Zilliz 18 03 How do Vector Databases Work?
  • 19.
    19 | ©Copyright 2023 Zilliz 19 Example Entry
  • 20.
    20 | ©Copyright 2023 Zilliz 20 04 What is Similarity Search?
  • 21.
    21 | ©Copyright 2023 Zilliz 21 Image from Nvidia Vector Search Overview
  • 22.
    22 | ©Copyright 2023 Zilliz 22 Vector Similarity Measures: L2 (Euclidean) Queen = [0.3, 0.9] King = [0.5, 0.7] d(Queen, King) = √(0.3-0.5)2 + (0.9-0.7)2 = √(0.2)2 + (0.2)2 = √0.04 + 0.04 = √0.08 ≅ 0.28
  • 23.
    23 | ©Copyright 2023 Zilliz 23 Vector Similarity Measures: Inner Product (IP) Queen = [0.3, 0.9] King = [0.5, 0.7] Queen · King = (0.3*0.5) + (0.9*0.7) = 0.15 + 0.63 = 0.78
  • 24.
    24 | ©Copyright 2023 Zilliz 24 Queen = [0.3, 0.9] King = [0.5, 0.7] Vector Similarity Measures: Cosine 𝚹 cos(Queen, King) = (0.3*0.5)+(0.9*0.7) √0.32 +0.92 * √0.52 +0.72 = 0.15+0.63 _ √0.9 * √0.74 = 0.78 _ √0.666 ≅ 0.03
  • 25.
    25 | ©Copyright 2023 Zilliz 25 Important Notes - Cosine, IP, and L2 are all the SAME rank order. - They differ in use case - L2 for when you need magnitude - Cosine for orientation - IP for magnitude and orientation - OR - Cosine = IP for normalized vectors
  • 26.
    26 | ©Copyright 2023 Zilliz 26 Inverted File Index Source: https://towardsdatascience.com/similarity-search-with-ivfpq-9c6348fd4db3
  • 27.
    27 | ©Copyright 2023 Zilliz 27 HNSW Source: https://arxiv.org/ftp/arxiv/papers/1603/1603.09320.pdf
  • 28.
    28 | ©Copyright 2023 Zilliz 28 GPU Index
  • 29.
    29 | ©Copyright 2023 Zilliz 29 Scalar Quantization
  • 30.
    30 | ©Copyright 2023 Zilliz 30 Product Quantization Source: https://towardsdatascience.com/product-quantization-for-similarity-search-2f1f67c5fddd
  • 31.
    31 | ©Copyright 2023 Zilliz 31 Picking an Index ● 100% Recall – Use FLAT search if you need 100% accuracy ● 10MB < index_size < 2GB – Standard IVF ● 2GB < index_size < 20GB – Consider PQ and HNSW ● 20GB < index_size < 200GB – Composite Index, IVF_PQ or HNSW_SQ ● Disk-based indexes
  • 32.
    32 | ©Copyright 2023 Zilliz 32 05 How are Vector Databases Different from Other Databases?
  • 33.
    33 | ©Copyright 2023 Zilliz 33 Why Not Use a SQL/NoSQL Database? • Inefficiency in High-dimensional spaces • Suboptimal Indexing • Inadequate query support • Lack of scalability • Limited analytics capabilities • Data conversion issues TL;DR: Vector operations are too computationally intensive for traditional database infrastructures
  • 34.
    34 | ©Copyright 2023 Zilliz 34 Why Not Use a Vector Search Library? • Have to manually implement filtering • Not optimized to take advantage of the latest hardware • Unable to handle large scale data • Lack of lifecycle management • Inefficient indexing capabilities • No built in safety mechanisms TL;DR: Vector search libraries lack the infrastructure to help you scale, deploy, and manage your apps in production.
  • 35.
    35 | ©Copyright 2023 Zilliz 35 What is Milvus/Zilliz ideal for? • Advanced filtering • Hybrid search • Durability and backups • Replications/High Availability • Sharding • Aggregations • Lifecycle management • Multi-tenancy • High query load • High insertion/deletion • Full precision/recall • Accelerator support (GPU, FPGA) • Billion-scale storage Purpose-built to store, index and query vector embeddings from unstructured data at scale.
  • 36.
    36 | ©Copyright 2023 Zilliz 36 06 Vector Database Architecture
  • 37.
    37 | ©Copyright 2023 Zilliz 37 Meta Storage Root Query Data Index Coordinator Service Proxy Proxy etcd Log Broker SDK Load Balancer DDL/DCL DML NOTIFICATION CONTROL SIGNAL Object Storage Minio / S3 / AzureBlob Log Snapshot Delta File Index File Worker Node QUERY DATA DATA Message Storage Access Layer Query Node Data Node Index Node High-level overview of Milvus’ Architecture
  • 38.
    38 | ©Copyright 2023 Zilliz 38 Questions? Give Milvus a Star! Chat with me on Discord! Meetup, May 7 @Delivery Hero
  • 39.
    39 | ©Copyright 2023 Zilliz 39 | © Copyright 9/25/23 Zilliz 39 Appendix
  • 40.
    40 | ©Copyright 2023 Zilliz 40 Milvus Architecture: Differentiation 1. Cloud Native, Distributed System Architecture 2. True Separation of Concerns 3. Scalable Index Creation Strategy with 512 MB Segments
  • 41.
    41 | ©Copyright 2023 Zilliz 41 Vector Databases are purpose-built to handle indexing, storing, and querying vector data. Milvus & Zilliz are specifically designed for high performance and billion+ scale use cases. Takeaway:
  • 42.
    42 | ©Copyright 2023 Zilliz 42 Examples Chunk Size=32, Overlap=10
  • 43.
    43 | ©Copyright 2023 Zilliz 43 Examples Chunk Size=128, Overlap=20
  • 44.
    44 | ©Copyright 2023 Zilliz 44 Examples Chunk Size=256, Overlap=50
  • 45.
    45 | ©Copyright 2023 Zilliz 45 Examples SentenceSplitter
  • 46.
    46 | ©Copyright 2023 Zilliz 46 We’ve built technologies for various types of use cases Compute Types Support different types of compute powers, such as AVX512, Neon for SIMD execution, quantization & cache-aware optimization, and GPU Leverage specific strengths of each hardware type efficiently, ensuring high-speed processing and cost-effective scalability for diverse application needs Search Types Provide diverse search types such as top-K ANN, Range ANN, hybrid ANN and metadata filtering Enable unparalleled query flexibility and accuracy, allowing developers to tailor their data retrieval needs Multi-tenancy Enable multi-tenancy through collection and partition management Allow for efficient resource utilization and customizable data segregation, ensuring secure and isolated data handling for each tenant Index Types Offer a diverse range of 11 index types, including popular ones like HNSW, IVF, PQ, and GPU index Empower developers with tailored search optimizations, catering to specific performance and accuracy needs
  • 47.
    47 | ©Copyright 2023 Zilliz 47 Tests shows consistent query performance when scaled from 65 million to 1 billion vectors
  • 48.
    48 | ©Copyright 2023 Zilliz 48 ANN Benchmark has recognized Milvus as the performance leader among vector database players
  • 49.
    49 | ©Copyright 2023 Zilliz 49 The Zilliz Cloud Platform Data Consumers Data Applications Data Sources Unstructured Data Zilliz Cloud Managed Milvus Vector Database Integrations High performance vector search Store, Index, and query Low latency with high recall Supports real-time responses Vector search index diversity Efficient search & scalability Multiple similarity metrics Flexibility in querying & adaptability Built-in data filtering Efficient data retrieval On transit data encryption Enterprise security & support Images Video Documents Audio User Generated Content Recommendation systems Search (text, image, audio) Chatbots Anomaly detection DNA sequence classification
  • 50.
    50 | ©Copyright 2023 Zilliz 50 Data Consumers Data Sources Zilliz Cloud Integrations Recommendation systems Search (text, image, audio)3 Chatbots Anomaly detection DNA sequence classification Images User Generated Video Documents Audio Hosted Milvus Vector Database Data Applications Unstructured Data Zilliz Cloud Platform ✔ High performance vector search ⏤ Store, Index, and query ✔ Low latency with high recall ⏤ Supports real-time responses ✔ Vector search index diversity ⏤ Efficient search & scalability ✔ Multiple similarity metrics ⏤ Flexibility in querying & adaptability ✔ Built-in data filtering ⏤ Efficient data retrieval ✔ On transit data encryption ⏤ Enterprise security & support
  • 51.
    51 | ©Copyright 2023 Zilliz 51
  • 52.
    52 | ©Copyright 2023 Zilliz 52 Meta Storage Root Query Data Index Coordinator Service Proxy Proxy etcd Log Broker SDK Load Balancer DDL/DCL DML NOTIFICATION CONTROL SIGNAL Object Storage Minio / S3 / AzureBlob Log Snapshot Delta File Index File Worker Node QUERY DATA DATA Message Storage VECTOR DATABASE Access Layer Query Node Data Node Index Node Milvus Architecture