Embedders
The embedder turns text into vectors. You pick it with the embeddings setting, as a string, in the manifest, with --embeddings or with DUCKDB_VECTORS_EMBEDDINGS. This page lists the models, the grammar of the string and the way to add your own.
Prefixes
Each prefix selects a back-end. In a manifest, the attributes named <prefix>_<attribute> in the same section configure it.
| Prefix | Runs | Attributes | Extra | Former prefix |
|---|---|---|---|---|
local:<model> | a bundled ONNX model through fastembed, with the core install; local:hashing is the deterministic test embedder | none | none | fastembed: |
huggingface:<repo> | any ONNX repository of the Hugging Face Hub | huggingface_token | none | hf: |
bedrock:<model> | Amazon Bedrock embeddings, such as bedrock:titan or bedrock:cohere.embed-multilingual-v3 | bedrock_region, bedrock_profile | bedrock | none |
The former prefixes stay accepted as aliases, and resolve to the same embedders. The model identifier that the database records does not change, so an existing index is reused and nothing is re-embedded. The prefix openai: is reserved and not implemented. With a batch section, bedrock: embeddings of index run as batch jobs, and an embeddings cache by model and text means that a re-run after a fetch embeds nothing.
Models
An embedder is resolved from a string, a prefix:model pair (local:<model>, huggingface:<repo-id>, bedrock:titan) or a bare name (hashing). The default is local:minishlab/potion-multilingual-128M, a static multilingual model that keeps vectors and the DuckDB file as small as possible. The registry is contributor-extensible, so you can register an open or closed, local or cloud backend without touching the core:
from duckdb_vectors import register_embedder
register_embedder("mybackend", lambda variant: MyEmbedder(variant))The local: prefix runs a bundled ONNX model with no torch dependency. Pick the dimension tier that fits your relevance/size budget:
| Backend | Spec | Dimensions | Use for |
|---|---|---|---|
| fastembed potion (static, multilingual) | local:minishlab/potion-multilingual-128M | 256 | default; smallest DB, international docs |
| fastembed MiniLM (multilingual) | local:sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 | 384 | balanced multilingual relevance |
| fastembed mpnet (multilingual) | local:sentence-transformers/paraphrase-multilingual-mpnet-base-v2 | 768 | higher multilingual relevance |
| fastembed e5-large (multilingual) | local:intfloat/multilingual-e5-large | 1024 | strongest multilingual relevance |
| fastembed bge-small (English) | local:BAAI/bge-small-en-v1.5 | 384 | English-only, compact |
| fastembed bge-large (English) | local:BAAI/bge-large-en-v1.5 | 1024 | English-only, strongest |
| Hugging Face ONNX (any repo) | huggingface:<repo-id>, e.g. huggingface:Qwen/Qwen3-Embedding-0.6B | probed | any HF repo shipping ONNX weights |
| Bedrock Titan | bedrock:titan | 1024 | cloud embedding |
| Hashing (deterministic, no deps) | hashing | 384 | tests and CI only, not relevance |
The huggingface:<repo-id> prefix is core (no extra install): it downloads a repository's ONNX weights and tokenizer.json via huggingface_hub, runs them through the ONNX runtime fastembed already vendors, mean-pools by default, and uses last-token pooling for Qwen3-style repos. Use it to load a model fastembed does not bundle. It now loads the large majority of ONNX embedding exports on the Hub, not just single-file sentence-transformer encoders. A repo must publish ONNX weights (for example onnx/model.onnx) for this backend to load it.
The loader handles three ONNX shapes:
- Simple encoders (bge/e5/sentence-transformers):
input_ids/attention_mask(/token_type_ids) feeding alast_hidden_stateoutput. - External-data ONNX: larger exports whose weights live in a sibling
model.onnx_data. The loader snapshot-downloads the ONNX folder and co-locates the real files in one directory so the ONNX runtime finds the data file beside the graph. - Decoder-style embedding graphs (Qwen3-Embedding and relatives): graphs that declare
position_idsand per-layerpast_key_values.*cache inputs. The loader synthesizesposition_idsfrom the attention mask, feeds zero-length cache tensors (shapes read from the graph), and selects the hidden-state output by name (never the vocabularylogits).
A worked Qwen example — the repo id carries qwen, so the backend switches to last-token pooling automatically (no pooling argument needed):
from duckdb_vectors import VectorStore, index_folder
store = VectorStore(
db_path="vectors.duckdb",
backend="huggingface:onnx-community/Qwen3-Embedding-0.6B-ONNX",
)
index_folder(store, "documentation", recursive=True)onnx-community/Qwen3-Embedding-0.6B-ONNX is an external-data, decoder-style export (external model.onnx_data, position_ids plus 28 layers of KV-cache inputs) that emits a 1024-dimensional last_hidden_state; it exercises every part of the generalized loader. On first use the backend downloads the ONNX weights and tokenizer.json into the huggingface_hub cache (a few hundred megabytes); subsequent runs reuse the cache and need no network. A repo must publish ONNX weights at a path the loader probes (onnx/model.onnx, model.onnx, onnx/model_quantized.onnx, or model_quantized.onnx) in a form the vendored ONNX runtime can run; a repo that ships only PyTorch weights will not load.
Which model and dimension should I choose?
Start with the default, and step up only if relevance on your own corpus falls short. Model choice moves both latency and storage: the cosine scan does work proportional to dimension × chunk count, and the file grows linearly with the dimension.
The default, local:minishlab/potion-multilingual-128M, is a 256-dimension static Model2Vec model: it embeds a query in ~0.1-0.3 ms, keeps the file smallest, and serves multilingual documentation. A contextual (transformer) model such as the MiniLM, mpnet, or e5 tiers ranks better on nuanced or ambiguous queries, at the cost of a larger vector, a larger file, a slower scan, and a much slower embed, which then dominates both query time and indexing time.
Measured candidates (embed p50 over 20 iterations; hit@k is a small fixed multilingual relevance sanity check, not a full benchmark; produced by scripts/benchmark_embedders.py):
| Model | Dimensions | Embed p50 | hit@1 | hit@3 |
|---|---|---|---|---|
local:minishlab/potion-multilingual-128M (default) | 256 | 0.1 ms | 0.80 | 1.00 |
local:sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 | 384 | 4.2 ms | 0.80 | 1.00 |
local:sentence-transformers/paraphrase-multilingual-mpnet-base-v2 | 768 | 11.2 ms | 0.80 | 1.00 |
local:intfloat/multilingual-e5-large | 1024 | 35.6 ms | 0.80 | 1.00 |
local:BAAI/bge-small-en-v1.5 | 384 | 4.0 ms | 0.80 | 1.00 |
local:BAAI/bge-large-en-v1.5 | 1024 | 35.2 ms | 1.00 | 1.00 |
huggingface:onnx-community/Qwen3-Embedding-0.6B-ONNX | 1024 | 44.1 ms | 1.00 | 1.00 |
huggingface:onnx-community/embeddinggemma-300m-ONNX | 768 | ~23 ms | 0.80 | 1.00 |
The two huggingface: rows run through the generalized Hugging Face loader. Qwen3-Embedding is a decoder-style export with external weights; at 1,024 dims and ~44 ms it is the slowest and largest option, and the only one to reach hit@1 1.00 on the multilingual bank. EmbeddingGemma bakes pooling and its projection heads into the graph, and the loader reads that final output directly; reading the raw backbone instead drops hit@1 to 0.60. Measure on your own corpus before trading the default's size and speed for a larger model.
The Bedrock extra
bedrock:titan calls Amazon Bedrock and needs boto3. Install it with the bedrock extra:
$ pip install "duckdb-vectors[bedrock]"See also
- Manifest reference: the
embeddingssection. - Configuration reference: the
embeddingssetting. - Performance workbook: the measured cost of each model.