sqliteai/sqlite-vector
Embedded vector search for local RAG with a C extension for SQLite.
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
SQLite-Vector is a C extension loaded into the application's SQLite runtime, not a separate database process. Embeddings are fixed-dimension BLOBs in ordinary tables, so the application can keep vectors beside document chunks and metadata. vector_init configures the type, dimensions, and distance metric. vector_full_scan searches the original vectors without any index build; vector_quantize builds a separate compact representation for vector_quantize_scan to search.
The quantized path can stream from the database or read an in-process buffer populated by vector_quantize_preload. Top-k scan results carry rowids for joining back to application data. Omitting k exposes a streaming form so SQL can filter and limit the returned rows; filtering after a fixed top-k scan is not equivalent to finding the top k within that filter. TurboQuant scores packed codes with SIMD lookup tables rather than reconstructing full vectors.
Key Capabilities & Differentiators
Stored formats include Float32, Float16, BFloat16, Int8, UInt8, and 1-bit vectors. The extension supports L2, squared L2, L1, cosine, and dot product, plus Hamming for 1-bit vectors only. For unit-length Float32 vectors, normalized=1 reduces cosine distance to 1 - dot; it asserts that the inputs are normalized rather than normalizing them. Quantization is a separate choice: INT8, UINT8, 1BIT, or 2-, 3-, and 4-bit TurboQuant.
On Apple M5 Pro with NEON, the file-backed benchmark scans one million 768-dimensional vectors with cosine and k=20. Exact Float32 takes 484.4 ms/query. INT8 reports 37.6 ms/query preloaded at 740 MB and 114.4 ms/query streamed at 30 MB, both at 99.5% recall@20 relative to exact search. Preloaded TURBO4 uses a 378 MB index and returns 81.8% recall@20 at 151.5 ms/query. These are best-of-20 timings on synthetic vectors, not production tail-latency or recall estimates.
Trade-offs & Limitations
Compared with a managed service such as Pinecone, SQLite-Vector keeps retrieval in the application and can operate offline without a network call to a separate vector service. The trade-off is that the application owns database placement, backups, and capacity planning. The documented execution paths scan vectors rather than pruning most of the corpus with an ANN index, so CPU and bytes scanned grow with corpus size. The streamed benchmark benefits from a warm OS page cache, which is outside its reported memory figure; storage bandwidth can dominate on devices that cannot cache the index.
For cosine, set qtype=INT8 explicitly: the automatic default can choose UINT8 for non-negative data, and the translation used by UINT8 changes angles. On the synthetic benchmark, UINT8 delivers 33.8% recall@20 versus 99.5% for INT8 at the same index size. TurboQuant saves space relative to INT8 but is slower and less accurate in that test. Use 1BIT for candidate filtering with full-precision reranking rather than final ranking, and treat INT8/UINT8 scan scores as ranking values, not original-space distances.
Hardware & Deployment Guide
Use a compatible SQLite runtime with extension loading enabled, then load the matching native binary with .load ./vector in the SQLite CLI or load_extension from SQL. Direct embedding is also supported. Prebuilt native targets include x86 and ARM on Linux and macOS, x86 on Windows, and Android and iOS. For browsers, @sqliteai/sqlite-wasm bundles SQLite with the vector extension enabled rather than loading a desktop library at runtime.
Release 1.2.0 lists sqlite_vector for Flutter/Dart, @sqliteai/sqlite-vector for Node, and @sqliteai/sqlite-wasm for WASM; the same package channels appear in 1.1.0 and 1.1.2. Swift Package integration requires SQLite with extension loading enabled. The local retrieval path needs no managed account or GPU. For a memory-constrained deployment, start with a file-backed database and streaming, then test cold-cache behavior and decide whether preloading is worth the extra residency.
Offline RAG, on-device semantic search, and SQLite-backed applications that want to retrieve vectors and metadata together and can validate scan latency and recall on their own data.
You need a shared managed retrieval tier, ANN candidate pruning, or predictable tail latency on a corpus that is too large to scan within your storage and CPU budget.
Quick Start & Installation
pip install sqliteai-vectorComparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| sqlite-vector ★ | 1.2k | — | C | Apache-2.0 | Embedded vector search for local RAG with a C extension for SQLite. |
| pgvector | 23.9k | +96 | C | — | PostgreSQL extension for exact and approximate vector search alongside relationa |
| qdrant | 35.9k | +135 | Rust | Apache-2.0 | Rust vector database for filtered and hybrid RAG retrieval |
| LightRAG | 41k | +110 | Python | MIT | Graph-backed RAG for cross-document retrieval and multimodal indexing |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/sqliteai/sqlite-vector.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about sqlite-vector
How do I add vector search to an existing SQLite schema?
vector_init. Use vector_full_scan for exact retrieval or build a compact representation with vector_quantize and query it with vector_quantize_scan. Join results back to the source table by rowid.Do I need a GPU, and is 30 MB a realistic memory budget?
Can I ship it in a commercial app or self-host it?
When should I choose SQLite-Vector instead of Pinecone?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy