How To Use β’ Next Steps β’ Current Market β’ Roadmap β’ Quick Start β’ Benchmarks β’ API Reference
KSdb is a next-generation vector database engineered for production AI applications. Built from the ground up with performance and developer experience in mind, KSdb delivers 5-7x faster performance than alternatives while providing advanced features like hybrid search, knowledge graph extraction, and intelligent document processing.
|
π Performance
|
π§ Intelligence
|
π οΈ Developer Experience
|
Combines vector similarity with keyword matching using Reciprocal Rank Fusion (RRF) for superior accuracy.
Automatically extracts entities and relationships from your documents using state-of-the-art NLP models.
Native support for CUDA, MPS (Apple Silicon), and ROCm for 5-10x faster embedding generation.
Built-in OCR support for scanned PDFs using EasyOCR, with automatic fallback detection.
Similarity-based duplicate detection with configurable thresholds.
- RESTful API with interactive documentation
- Scalable PostgreSQL backend
- S3-compatible object storage
- Docker and Kubernetes ready
pip install ksdbOr install from source:
git clone https://github.com/Kulraj69/KSDB.git
cd KSDB
pip install -e .# Start KSdb server (runs on port 8000)
python -m ksdb.cli run
# Or with custom configuration
python -m ksdb.cli run --port 9000 --data-dir ./my_datafrom ksdb import Client
# Initialize client
client = Client("http://localhost:8000")
# Create collection
collection = client.get_or_create_collection("products")
# Add documents with automatic deduplication and graph extraction
collection.add(
ids=["p1", "p2", "p3"],
documents=[
"High-performance laptop with 32GB RAM",
"Business laptop with extended battery",
"Professional workstation for developers"
],
metadatas=[
{"category": "electronics", "price": 1299},
{"category": "electronics", "price": 899},
{"category": "electronics", "price": 1599}
],
deduplicate=True, # Remove duplicates automatically
extract_graph=True # Extract knowledge graph
)
# Hybrid search with metadata filtering
results = collection.query(
query_texts=["best laptop for programming"],
n_results=5,
where={"price": {"$lt": 1500}}
)
# Explain why each result ranked where it did
debug = collection.explain_query(
query_texts=["best laptop for programming"],
n_results=5,
where={"price": {"$lt": 1500}}
)
print(debug["profile"])Ingest recent Hacker News stories about RAG/vector databases without an API key:
python examples/ingest_hacker_news.py \
--query "RAG vector database" \
--limit 25 \
--collection live_hacker_newsSee the full guide in docs/HOW_TO_USE.md.
Tested on MacBook Pro M-series with 500 documents:
| Operation | KSdb | ChromaDB | Performance Gain |
|---|---|---|---|
| Bulk Ingestion | 3.28s | 17.33s | 5.3x faster β‘ |
| Single Query | 30ms | 216ms | 7.1x faster β‘ |
| Concurrent Queries (10) | 45ms avg | 312ms avg | 6.9x faster β‘ |
| Feature | KSdb | ChromaDB | Pinecone | Weaviate |
|---|---|---|---|---|
| Hybrid Search | β | β | β | |
| Knowledge Graph | β | β | β | |
| GPU Acceleration | β | β | β | β |
| OCR Support | β | β | β | β |
| Self-Hosted | β Free | β Free | π° Paid | β Free |
| Performance | β‘ 5-7x | 1x Baseline | β‘ 3-4x | β‘ 2-3x |
π View Detailed Benchmark Results
# Run benchmarks yourself
export HF_TOKEN="your_huggingface_token"
python benchmark_fair_comparison.pyFull results available in performance_analysis.py
graph TB
A[Client Application] -->|REST/SDK| B[KSdb API Server]
B --> C[Embedding Service]
B --> D[HNSW Vector Index]
B --> E[FTS5 Keyword Index]
B --> F[Knowledge Graph]
C -->|GPU Accelerated| G[Sentence Transformers]
D --> H[(PostgreSQL/SQLite)]
E --> H
F --> H
D --> I[S3/Local Storage]
style B fill:#4CAF50
style C fill:#2196F3
style D fill:#FF9800
style E fill:#FF9800
style F fill:#9C27B0
- Embedding Service: GPU-accelerated text-to-vector conversion using Sentence Transformers
- HNSW Index: Hierarchical Navigable Small World algorithm for fast approximate nearest neighbor search
- FTS5 Engine: Full-text search with BM25 ranking for keyword matching
- Knowledge Graph: Entity and relationship extraction using GLiNER
- Metadata Store: Flexible JSON-based metadata with advanced filtering support
Unlike pure vector databases, KSdb's hybrid search combines semantic understanding with keyword precision:
# Automatically balances vector and keyword search
results = collection.query(
query_texts=["machine learning frameworks"],
n_results=10
)
# Returns results ranked by RRF (Reciprocal Rank Fusion)# Extract knowledge graph
collection.add(
ids=["doc1"],
documents=["Apple Inc. was founded by Steve Jobs in Cupertino, California"],
extract_graph=True
)
# Query relationships
graph = collection.get_graph(subjects=["Apple Inc."])
# Returns: [
# {"subject": "Apple Inc.", "predicate": "founded_by", "object": "Steve Jobs"},
# {"subject": "Apple Inc.", "predicate": "located_in", "object": "Cupertino"}
# ]# Automatically detect and skip similar documents
collection.add(
ids=["d1", "d2"],
documents=[
"The quick brown fox jumps over the lazy dog",
"A quick brown fox jumps over a lazy dog" # 95% similar - skipped
],
deduplicate=True,
similarity_threshold=0.9 # Configurable threshold
)The Streamlit demo in app.py includes PDF/TXT upload and OCR fallback for scanned PDFs. For production ingestion, extract text into chunks first, then call collection.add(ids=[...], documents=chunks).
KSdb includes a production-ready Streamlit demo showcasing RAG (Retrieval-Augmented Generation):
# Set environment variables
export HF_TOKEN="your_huggingface_token"
# Start demo (runs on port 8501)
streamlit run app.pyFeatures:
- π PDF/TXT upload with automatic OCR
- π¬ ChatGPT-style conversational interface
- π Real-time performance metrics
- π§ Knowledge graph visualization
- π― Hybrid search demonstration
Interactive API documentation available at http://localhost:8000/docs (Swagger UI)
Core Endpoints:
POST /collections/{name}/add- Add documentsPOST /collections/{name}/query- Search documentsPOST /collections/{name}/query/explain- Search with hybrid ranking diagnosticsGET /collections/{name}/graph- Query knowledge graphDELETE /collections/{name}/delete/{doc_id}- Delete a documentDELETE /collections/{name}- Delete collection
Full SDK documentation: API Reference
from ksdb import Client
client = Client("http://localhost:8000")
# Collection operations
collection = client.create_collection("name")
collection = client.get_collection("name")
collections = client.list_collections()
# Document operations
collection.add(ids, documents, metadatas, deduplicate, extract_graph)
collection.query(query_texts, n_results, where)
collection.explain_query(query_texts, n_results, where)
collection.update(ids, documents, metadatas)
collection.delete(ids)
# Knowledge graph
collection.get_graph(subjects)# Local development with SQLite
python -m ksdb.cli run# Single container
docker run -p 8000:8000 ksdb/ksdb:latest
# Docker Compose (with PostgreSQL)
docker-compose up -d# Deploy to AWS App Runner
./deploy/push_to_ecr.sh
# Or use provided CloudFormation templates
aws cloudformation create-stack \
--stack-name ksdb-production \
--template-body file://deploy/cloudformation.ymlFull deployment guide: Production Deployment
from langchain.vectorstores import KSdb
from langchain.embeddings import HuggingFaceEmbeddings
embeddings = HuggingFaceEmbeddings()
vectorstore = KSdb(
client=client,
collection_name="docs",
embedding_function=embeddings
)from llama_index import VectorStoreIndex, ServiceContext
from llama_index.vector_stores import KSdbVectorStore
vector_store = KSdbVectorStore(client=client, collection_name="docs")
index = VectorStoreIndex.from_vector_store(vector_store)# Start MCP server
python -m ksdb.mcp_server
# Add to Cursor config
{
"mcpServers": {
"ksdb": {
"command": "python",
"args": ["-m", "ksdb.mcp_server"]
}
}
}-
Disable graph extraction for pure RAG (8.9x faster ingestion)
collection.add(..., extract_graph=False)
-
Batch operations (2-3x faster)
collection.add(ids=batch_ids, documents=batch_docs) # 100-500 docs
-
GPU acceleration (automatic, 5-10x faster embeddings)
- Auto-detects CUDA, MPS, ROCm
HNSW Parameters:
# In server config
HNSW_M = 32 # Higher M = better recall, more memory
HNSW_EF_CONSTRUCTION = 400 # Higher ef = better quality, slower buildQuery Caching:
# Enable Redis caching (10-100x faster for repeated queries)
client = Client("http://localhost:8000", cache_ttl=3600)Full optimization guide: Performance Tuning
The roadmap has been refreshed for 2026 based on what production retrieval systems now need: hybrid search quality, filter-aware retrieval, reranking, query profiling, backups, tenant isolation, and agent/MCP workflows.
Immediate next work:
- Add
where_documentfilters and optional BM25/FTS score exposure - Add MMR/reranking options for better RAG context diversity
- Add backup, restore, migration, and index rebuild commands
- Align Docker/server deployment with the package server API
- Publish reproducible benchmarks against Chroma, Qdrant, pgvector, and Weaviate
See ROADMAP.md for the full staged plan and docs/CURRENT_MARKET.md for the current market context.
|
π Documentation Wiki |
π¬ Discussions GitHub Discussions |
π Issues Bug Reports |
We welcome contributions from the community! See our Contributing Guide for details.
Areas we're looking for help:
- π Performance optimization
- π Enterprise features (auth, RBAC)
- π Advanced analytics
- π¨ Web dashboard development
- π Documentation and tutorials
KSdb is released under the MIT License.
KSdb is built on the shoulders of giants:
- FastAPI - Modern web framework
- HNSWlib - Efficient vector search
- Sentence Transformers - State-of-the-art embeddings
- GLiNER - Named entity recognition
- EasyOCR - Optical character recognition
Built with β€οΈ for the AI community
β Star us on GitHub β’ π Read the Docs β’ π Get Started
Β© 2026 KSdb. All rights reserved.