VectorDB (Vector Database)
VectorDB (vector database) is a database that has recently become very important in AI, machine learning, and LLM (large language model) fields.
Simply put, it is a database specialized for efficiently storing data in numeric vector form, or embeddings, and quickly finding similar data.
What Is VectorDB?
VectorDB is a DB optimized for storing, searching, and comparing vector data.
Usually, unstructured data such as text, images, audio, and code is converted into fixed-length vectors, or numeric arrays, through an embedding model, and these vectors are stored in VectorDB.
For example:
"How is the weather today?" -> [0.12, -0.08, 0.56, ... , 0.33]
"Is it raining now?" -> [0.11, -0.07, 0.57, ... , 0.31]
These two vectors are semantically similar, so the distance between the vectors is very close.
VectorDB is a system designed to perform this kind of “similarity-based search” quickly.
Key Features of VectorDB
| Feature | Description |
|---|---|
| Embedding storage | Stores vectors generated from text, images, and other data |
| Similarity Search | Quickly finds the vectors, or data, most similar to a query vector |
| Metadata filtering | Stores additional information such as tags and categories together with vectors and enables filtering during search |
| Clustering/classification | Groups semantically similar vectors or classifies them by category |
| LLM integration | Often used to implement LLM “context” or “memory” features, such as RAG architectures |
Why VectorDB Matters
Large language models such as GPT, Claude, and Gemini have limits on the amount of input they can process at once, known as context length.
Therefore, you cannot put all information into an LLM.
In this case, VectorDB is used as follows:
User question -> converted to embedding -> related documents searched in VectorDB ->
results passed to the LLM together with the question to generate an answer. This structure is called RAG, or Retrieval-Augmented Generation.
In other words, VectorDB works like external memory for an LLM.
Representative VectorDB Products
| Product | Features |
|---|---|
| Pinecone | Fully managed, API-centric, specialized for RAG |
| Weaviate | Open source, supports GraphQL API, supports hybrid search |
| Milvus | Strong for large-scale data processing, open source |
| Qdrant | Rust-based, high performance, easy REST/gRPC API |
| FAISS | Library created by Meta, closer to a search engine than a DB |
| Chroma | Python-friendly, integrates easily with LangChain and similar tools |
| Redis Vector Search (Redis 7.2+) | Provides vector indexing inside Redis |
Core Concepts in VectorDB Search
Vector Similarity Calculation Methods
- Cosine similarity: How similar the directions of two vectors are
- Euclidean distance: The straight-line distance between two vectors
- Dot product: Mainly used with trained embeddings
Indexing
Because vectors are usually stored in the thousands to millions, ANN (Approximate Nearest Neighbor) algorithms are used to make search fast.
Representative index algorithms:
- HNSW (Hierarchical Navigable Small World)
- IVF (Inverted File Index)
- PQ (Product Quantization)
VectorDB + LLM Example (RAG Architecture)
flowchart LR A[User question] --> B[Embedding generator] B --> C[Search similar documents in VectorDB] C --> D[Return related documents] D --> E[Send question with documents to LLM] E --> F[Generate accurate and contextual answer]
With this structure, you can build a knowledge-based chatbot similar to ChatGPT yourself.
Practical Example (Python + Qdrant)
from qdrant_client import QdrantClient
from qdrant_client.models import PointStruct
client = QdrantClient(":memory:")
# Store example vectors
client.upsert(
collection_name="docs",
points=[
PointStruct(id=1, vector=[0.1, 0.3, 0.5], payload={"text": "Hello"}),
PointStruct(id=2, vector=[0.11, 0.29, 0.51], payload={"text": "Nice to meet you"})
]
)
# Search for data similar to the query vector
hits = client.search(collection_name="docs", query_vector=[0.12, 0.28, 0.49], limit=2)
print(hits)
Summary
| Item | Description |
|---|---|
| Purpose | Vector-based similarity search and AI applications |
| Data format | High-dimensional vectors (embeddings) |
| Main use cases | RAG, recommendation systems, image search, voice search |
| Core technologies | ANN indexing, cosine similarity, metadata filters |
| Representative products | Pinecone, Qdrant, Milvus, Weaviate, Chroma |