Architecture

Embeddings and models

Two small BGE models run on the server, so memory works without an embedding API key and without sending text to a third party.

Architecture3 pages

Memory quality depends on embeddings, and embeddings usually depend on an API key, a per-token bill and a privacy decision. Memo avoids all three by running small open models locally.

The defaults

Contains Chinese
Model
Xenova/bge-small-zh-v1.5
Dimension
512
Everything else
Model
Xenova/bge-small-en-v1.5
Dimension
384

Both are MIT-licensed BGE models, vendored in the repository and executed through ONNX on the server. No text leaves the deployment to be embedded.

Per-row model tracking

Each memory stores its vector and the model id that produced it, in an untyped vector column. That means two models can coexist, and switching models later does not require a dimension migration — old rows keep their 512-dimensional vector, new rows carry 384 (or the reverse), and comparisons only happen within a model.

Queries are embedded once per model

A query is embedded with each model that exists in the store. A Chinese question can therefore still match English memories and the other way round, which is the common case for bilingual users.

If the models cannot load

The server falls back to a deterministic hash embedder. Recall gets noticeably weaker but the app keeps working; nothing returns an error page because a model file was missing.

Using another provider

Any OpenAI-compatible embedding server can replace the local models, which is useful if you run Ollama or a private gateway:

EMBEDDING_PROVIDER
Example
openai
Purpose
Switches from local ONNX to an HTTP provider.
EMBEDDING_BASE_URL
Example
http://localhost:11434/v1
Purpose
Base URL of the compatible server.
EMBEDDING_MODEL
Example
bge-m3
Purpose
Model name to request.
HF_ENDPOINT
Example
https://hf-mirror.com
Purpose
Model download mirror for restricted networks.
Which parts call a model

The extraction and answer routes can optionally use Claude when ANTHROPIC_API_KEY is set. Embeddings never do — they stay on-device regardless.