# Repository Briefing: sqliteai/sqlite-vector
> Source: https://repoforai.com/repo/sqliteai/sqlite-vector (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/sqliteai/sqlite-vector
- **Official Docs / Website**: https://sqlite.ai
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: C
- **License**: Apache-2.0
- **Engineering Health**: A+ (88/100 · Maintenance 35/35 · Adoption 13/25 · Releases 20/20 · License 20/20)
- **Latest Release**: 1.2.0 (2026-11-01) — https://github.com/sqliteai/sqlite-vector/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Self-Hosted, Local AI
- **Momentum**: 1,230 ★ total (+0 24h / +0 7d) · 55 forks
- **When to Use**: Best for: 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. Skip if: 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.

## Overview
```text
### Architecture & 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.
```

## Key Capabilities
```text
- Storage: Fixed-dimension vector BLOBs live in ordinary SQLite tables alongside application data.
- Execution: Exact scans need no prebuilt vector index; quantized scans read a separately built compact representation.
- Quantization: TurboQuant packs 2, 3, or 4 bits per dimension plus one scale per vector and scores the codes with SIMD lookup tables.
- Memory and latency: On Apple M5 Pro with NEON, INT8 preload and streaming report 37.6 ms at 740 MB and 114.4 ms at 30 MB, respectively, with 99.5% recall@20 in both modes.
- Metric choice: Use explicit INT8 for cosine to avoid the unsigned fallback on non-negative data; 1BIT is Hamming-only and best evaluated as a candidate filter.
- Packaging: Native artifacts cover desktop and mobile, with Node, WASM, Swift, and Flutter/Dart integration paths.
```

## Quick Start / Clone
```bash
pip install sqliteai-vector
```
