VectorBench-FAISS
A benchmarking and experimentation framework for FAISS vector search.
VectorBench-FAISS lets you build and compare vector search systems using recall@k, latency, and memory, with support for vector, BM25, hybrid retrieval, and metadata filtering.
The goal is to make the components of vector search inspectable and measurable rather than hiding everything behind a single similarity_search() call.
Features
- FAISS vector search — IVF, HNSW, and PQ indexes
- BM25 retrieval — keyword-based search without embeddings
- Hybrid retrieval — vector + BM25 with Reciprocal Rank Fusion
- Metadata filtering — filter results using document metadata
- Benchmarking — recall@k, latency, and memory measurements
- Dataset utilities — dataset downloading, chunking, and embedding preparation
- Consistent interface — experiment with different index types through the same search API
Installation
Install the latest release from PyPI:
pip install vectorbench_faiss
Then import the main search engine:
from vectorbench_faiss.engine import VectorSearchEngine
Quick Start
from vectorbench_faiss.engine import VectorSearchEngine
documents = [
"Python is a programming language.",
"FAISS is a library for efficient similarity search.",
"Vector databases are commonly used in RAG systems.",
]
metadatas = [
{"source": "python"},
{"source": "faiss"},
{"source": "rag"},
]
engine = VectorSearchEngine(index_type="hnsw")
engine.add_documents(
documents,
metadatas=metadatas
)
results = engine.search(
"What is FAISS?",
k=5,
mode="vector"
)
for result in results:
print(result["score"], result["text"])
Search Modes
Vector Search
Embedding-based nearest-neighbor retrieval using the selected FAISS index.
results = engine.search(
"What is vector search?",
k=5,
mode="vector"
)
BM25 Search
Keyword-based retrieval without embeddings.
results = engine.search(
"vector search",
k=5,
mode="bm25"
)
Hybrid Search
Combines vector and BM25 retrieval using Reciprocal Rank Fusion (RRF).
results = engine.search(
"What is vector search?",
k=5,
mode="hybrid"
)
Metadata Filtering
Attach metadata to documents and filter results during retrieval:
results = engine.search(
"search algorithms",
k=5,
mode="vector",
filter={"topic": "vector-search"}
)
Metadata filtering can be used with vector, BM25, and hybrid search.
Benchmarking
Compare multiple search engines using BenchmarkRunner:
from vectorbench_faiss.benchmark import BenchmarkRunner
engines = {
"ivf": ivf_engine,
"hnsw": hnsw_engine,
"pq": pq_engine,
}
runner = BenchmarkRunner(
engines,
ground_truth_key="ivf",
)
results = runner.run_all(
documents,
queries
)
Benchmarks measure:
- Recall@k — retrieval quality
- Latency — search performance
- Memory — index memory usage
A reference index can be used as ground truth when evaluating approximate indexes.
Dataset Utilities
VectorBench includes utilities for preparing datasets from Hugging Face for experiments:
from vectorbench_faiss.data.download import download_dataset
from vectorbench_faiss.data.chunk import chunk_dataset
download_dataset(
dataset_name="rajpurkar/squad",
split="train",
output_dir="data/raw/squad",
)
chunk_dataset(
input_path="data/raw/squad/raw_data.jsonl",
output_path="data/raw/squad/chunked_data.jsonl",
)
The resulting documents and metadata can then be passed to VectorSearchEngine.
Embeddings
VectorBench uses sentence-transformers for generating embeddings. Models are cached locally after the first download, allowing subsequent runs to load them from the local cache.
Example Workflow
Dataset
↓
Chunking
↓
Embeddings
↓
FAISS Index
↓
Vector / BM25 / Hybrid Retrieval
↓
Benchmark
↓
Recall · Latency · Memory
VectorBench is designed primarily for learning, experimentation, and benchmarking of vector retrieval systems.
Requirements
VectorBench uses libraries including:
- FAISS
- sentence-transformers
- BM25 retrieval
Dependencies are installed automatically when installing the package through PyPI.
Project Status
VectorBench-FAISS is currently focused on vector retrieval experimentation and benchmarking.
Upcoming: comparative dashboard for visualizing benchmark results across datasets, index types, and configurations.
Links
Source code: https://github.com/SitanshuA091/VectorBench
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vectorbench_faiss-0.1.1.tar.gz.
File metadata
- Download URL: vectorbench_faiss-0.1.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39621ccf1b5cd769d7a6651c91bc759d1f5bbccc2b75dc1ecf1defda22ed4fd6
|
|
| MD5 |
0771fd89e57d1ab0fb2c8dbdf550fe8a
|
|
| BLAKE2b-256 |
3135f71f63adf9c80ed2a4c74723766725a65db50363a1813f2c7f3470b8dacc
|
File details
Details for the file vectorbench_faiss-0.1.1-py3-none-any.whl.
File metadata
- Download URL: vectorbench_faiss-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c907f3d8f02f7c59ceede5295500c8e5e003937392668b097555deef1ad22b15
|
|
| MD5 |
63f01194565a8de0798c79a7bcaf12e4
|
|
| BLAKE2b-256 |
f3c3c3249889078170c00884dcf28c7aa57fc47d62fa609de2f82a9bc9b0480f
|