Embedding models
ContextSage Pro unlocks larger embedding models via the bridge. Choosing the right model directly affects how well documents are retrieved — not just how fast they load.
Available models
| Model | Context window | Size | Best for |
|---|---|---|---|
| MiniLM L6-v2 | 256 tokens | 80 MB | Quick setup, short documents |
| BGE Large EN v1.5 | 512 tokens | 1.3 GB | Legal documents, contracts, long clauses ✅ |
| Nomic Embed | 8192 tokens | 270 MB | Very long documents, research papers |
| mxbai-embed-large | 512 tokens | 1.3 GB | General purpose, strong retrieval |
Why context window matters for legal documents
The embedding model converts each chunk of text into a vector. If a chunk is longer than the model’s context window, the tail is silently truncated — the vector only represents the first N tokens, and the rest of the chunk is invisible to retrieval.
For legal contracts, this is a critical issue. A non-compete clause or limitation of liability paragraph typically runs 300–500 tokens. With MiniLM’s 256-token window, more than half the clause is cut off before embedding.
Measured on a real contract (Quaker non-compete agreement, 8 pages)
| Model | Context window | Chunks over window | Result |
|---|---|---|---|
| MiniLM L6-v2 | 256 tokens | 11 / 16 (69%) | Most clauses partially embedded |
| BGE Large EN v1.5 | 512 tokens | 0 / 16 (0%) | Every clause fully embedded ✅ |
With MiniLM, 11 of 16 chunks exceeded the 256-token limit. The non-compete restriction itself (chunk 5, 484 tokens) — the most important clause in the document — had nearly half its content truncated during embedding. Retrieval on the truncated vector would return the chunk, but the model would only see an incomplete clause.
BGE Large embeds all 16 chunks in full. The same document, zero truncation.
Chunk size calibration
The chunk sizes ContextSage uses are calibrated to match the active embedding model’s context window. Switching models re-calibrates automatically:
| Model | Default chunk size | Max chunk size |
|---|---|---|
| MiniLM L6-v2 | 200 tokens | 256 tokens |
| BGE Large EN v1.5 | 400 tokens | 512 tokens |
This means switching to BGE Large produces fewer, larger chunks per document — each chunk contains a complete legal clause rather than a mid-sentence fragment. A typical 8-page contract produces ~16 well-formed chunks with BGE Large vs ~20 smaller fragments with MiniLM.
How to switch models
- Make sure the bridge is running (
pnpm bridge) - Open Settings → Embedding model in the app
- Select your model — the bridge downloads it on first use
- Re-ingest any documents you uploaded under the previous model