local embedding provider hardcodes English-only model — make it configurable (multilingual default)
Summary
The local embedding provider hardcodes Xenova/all-MiniLM-L6-v2, which is English-only. For non-English users this cripples vector recall — the model can't bridge a non-English query to an English/code memory (or vice-versa). Please make the local model configurable (e.g. LOCAL_EMBEDDING_MODEL) and consider a multilingual default.
src/providers/embedding/local.ts:
this.extractor = await transformers.pipeline(
"feature-extraction",
"Xenova/all-MiniLM-L6-v2", // hardcoded, English-only
);
Why it matters
A coding agent's memories are often a mix of English/code (auto-generated observations) while the user's intent and queries are in their own language. Matching is then cross-lingual, which all-MiniLM-L6-v2 handles poorly.
Benchmark
8 Russian conceptual queries against 10 English/code memories (Go/DevOps domain), EMBEDDING_PROVIDER=local, pure-vector (VECTOR_WEIGHT=1, BM25_WEIGHT=0) to isolate the model:
| Local model | Recall@1 | Recall@3 |
|---|---|---|
all-MiniLM-L6-v2 (current default) |
1/8 | 2/8 |
paraphrase-multilingual-MiniLM-L12-v2 |
8/8 | 8/8 |
Example — query "из-за чего ядро убивает контейнер по памяти и что помогло" ("why does the kernel OOM-kill the container and what fixed it") vs memory "The container was killed by the kernel for exceeding its memory cgroup; lowering the soft heap target stopped it":
- English model: target ranked #10 (last); it puts the same unrelated memory at #1 for almost every Russian query.
- Multilingual model: target ranked #1.
Proposed change
paraphrase-multilingual-MiniLM-L12-v2 (and multilingual-e5-small) are also 384-dim, so swapping is a drop-in — no dimension-guard change, no reindex needed. Making the model env-configurable with a multilingual default fixes non-English users out of the box while keeping English quality essentially unchanged:
import type { EmbeddingProvider } from "../../types.js";
+import { getEnvVar } from "../../config.js";
+
+// Same 384-dim output as all-MiniLM-L6-v2 (drop-in, no reindex), but embeds
+// non-English prose and cross-lingual query↔doc usefully.
+const DEFAULT_LOCAL_MODEL = "Xenova/paraphrase-multilingual-MiniLM-L12-v2";
@@
+ const model = getEnvVar("LOCAL_EMBEDDING_MODEL") || DEFAULT_LOCAL_MODEL;
this.extractor = await transformers.pipeline(
"feature-extraction",
- "Xenova/all-MiniLM-L6-v2",
+ model,
);
If changing the default is undesirable, even just honoring LOCAL_EMBEDDING_MODEL (keeping the English default) would let non-English users opt in. Cloud providers already accept a model env var (OPENAI_EMBEDDING_MODEL, OPENROUTER_EMBEDDING_MODEL); local is the only one without one.
Environment
- agentmemory
v0.9.24(main@fd9e3bd),@xenova/transformers^2.17.2.