Customize the local embedded backend model
Description
The local ONNX embedding backend accepts exactly one model. local_embed.rs gates construction on a hardcoded match:
const MINILM_REPO: &str = "Qdrant/all-MiniLM-L6-v2-onnx";
pub fn new(model: &str) -> Result<Self, String> {
match model {
"all-MiniLM-L6-v2" | "all-minilm-l6-v2" => {}
other => return Err(format!(
"unsupported local embedding model '{other}'. Supported: all-MiniLM-L6-v2"
)),
}
So setting semantic.model to any other identifier fails immediately with unsupported local embedding model '<name>'. Supported: all-MiniLM-L6-v2. This is confirmed on 0.58.2 by reading the source and the shipped binary's embedded strings: the two accepted spellings and the error string appear verbatim in the binary. I did not set semantic.model to a rejected value to trigger the error at runtime, so I have not observed the failure message itself.
This matters because all-MiniLM-L6-v2 is an English-centric model. In one comparison I observed a clear gap between the same concept queried in the two languages, where the English phrasing returned the relevant implementation files and the Chinese phrasing returned unrelated lexical matches. That is a single comparison, not a benchmark.
The infrastructure for more models is already in place — the local backend is built directly on ort plus tokenizers and hf-hub, and resolve_model_files() already abstracts "find a local snapshot, else download". Adding a model is therefore a bounded change: one allowlist entry, the HuggingFace repo id, and the per-model tokenizer / pooling / dimension wiring that SemanticIndexFingerprint { dimension, ... } already keys on.
Two related gaps, if they are in scope:
- The
max_fileslimit is a rejection gate rather than a truncation. With it set below the project file count, nothing is indexed at all, and an index that was already loaded from disk is discarded rather than used for queries — the log then reportssemantic_build_failedwhile the plane is nominally enabled. The schema wording ("Maximum number of project files to semantically index") reads like truncation, so this is easy to misconfigure. semantic.max_batch_sizehas nodefaultin the JSON schema, so its default of 64 is only discoverable from the prose docs.
Use case
No response
Thanks for the careful write-up, and for checking the shipped binary rather than only the source.
We've decided not to add more models to the built-in ONNX backend. Each model needs its own tokenizer, pooling and dimension wiring, plus download and integrity handling, and we'd rather not grow that surface. The built-in backend stays a small zero-setup default.
For multilingual search, the supported route is a local embedding server that speaks the OpenAI-compatible /v1/embeddings API. llama.cpp's llama-server --embeddings, Ollama, LM Studio and vLLM all work, and so does a hosted provider. For example, with llama-server serving a multilingual model such as Qwen3-Embedding-0.6B:
// ~/.config/cortexkit/aft.jsonc
{
"semantic": {
"backend": "openai_compatible",
"base_url": "http://localhost:8080/v1",
"model": "qwen3-embedding-0.6b"
}
}
Ollama has its own backend too: "backend": "ollama". The backend and endpoint can only be set in the user config, not in a project's config. Qwen3-Embedding is what we run ourselves. query_instruction: "auto" (the default) adds its retrieval instruction to queries automatically, and it handles Chinese well. We're also building a local embedding service of our own that will plug into AFT directly, so this will get easier.
On the two related gaps:
max_files: you're right that it rejects the whole project instead of truncating, and that a loaded index is then dropped. The schema wording suggests truncation, so this is a bug, and we're tracking it.max_batch_size: confirmed. The schema has nodefault, though the effective default is 64. We'll add it.
I'll leave this open for the max_files part.
The max_files issue is addressed in 0.64.0: it limits which files are newly embedded instead of rejecting the whole project, and already stored vectors remain searchable. The built-in model remains MiniLM as discussed; other models use a local or hosted embedding server. One small follow-up is still open: the schema does not state max_batch_size's runtime default of 64.