Datasets:
Upload reports/embedding-retrieval-bench.md with huggingface_hub
Browse files
reports/embedding-retrieval-bench.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Does a vision-language embedder beat its text sibling on *text* retrieval?
|
| 2 |
+
|
| 3 |
+
**Rig:** RTX 5090 32GB (capsule) · **Date:** 2026-06-08 · **Task:** local-ai-roadmap t037
|
| 4 |
+
**Lineup:** e5-small-v2 (the incumbent) vs Qwen3-Embedding-0.6B (text) vs Qwen3-VL-Embedding-2B (vision-language)
|
| 5 |
+
**Ruler:** BEIR / SciFact (5,183 docs, 300 queries, gold qrels) · all arms capped at 512 tokens, cosine retrieval, identical scoring harness
|
| 6 |
+
|
| 7 |
+
## The myth
|
| 8 |
+
|
| 9 |
+
A vision-language embedding model is built for images. Point it at plain text and you'd expect it to
|
| 10 |
+
do no better than a same-family *text* embedder — the visual machinery is dead weight. And the small,
|
| 11 |
+
old incumbent (e5-small) is "good enough" for a tiny knowledge base anyway.
|
| 12 |
+
|
| 13 |
+
## What SciFact actually says
|
| 14 |
+
|
| 15 |
+
| model | dim | nDCG@10 | recall@10 | MRR@10 | encode docs/s¹ | VRAM |
|
| 16 |
+
|---|---|---|---|---|---|---|
|
| 17 |
+
| e5-small-v2 | 384 | 0.6875 | 0.806 | 0.658 | 1256 | 0.79 GB |
|
| 18 |
+
| Qwen3-Embedding-0.6B | 1024 | 0.7011 | 0.830 | 0.667 | 270 | 2.4 GB |
|
| 19 |
+
| **Qwen3-VL-Embedding-2B** | 2048 | **0.7444** | **0.882** | **0.704** | 129 | 5.0 GB |
|
| 20 |
+
|
| 21 |
+
The VL model wins on every quality metric: **+0.057 nDCG@10 over e5 (+8.3% relative), and +0.043 over its
|
| 22 |
+
own text sibling** — on a pure-text task with not a single pixel in sight. The visual machinery isn't dead
|
| 23 |
+
weight; the contrastive multimodal pre-training produces a stronger *text* representation too.
|
| 24 |
+
|
| 25 |
+
But quality isn't free: e5 encodes ~10x faster and fits in a sixth of the VRAM. This is a clean frontier,
|
| 26 |
+
not a free lunch.
|
| 27 |
+
|
| 28 |
+
~~~
|
| 29 |
+
|
| 30 |
+
## The Matryoshka twist — you can throw away most of the VL vector and still win
|
| 31 |
+
|
| 32 |
+
Both Qwen models use Matryoshka representation learning: the leading dimensions carry the most signal, so
|
| 33 |
+
you can truncate the vector and renormalize. nDCG@10 as the vector shrinks:
|
| 34 |
+
|
| 35 |
+
| dim | Qwen3-VL-2B | Qwen3-Embedding-0.6B |
|
| 36 |
+
|---|---|---|
|
| 37 |
+
| full | 0.7444 (2048) | 0.7011 (1024) |
|
| 38 |
+
| 512 | **0.7307** | 0.6978 |
|
| 39 |
+
| 256 | 0.7092 | 0.667 |
|
| 40 |
+
| 128 | 0.6691 | 0.6239 |
|
| 41 |
+
|
| 42 |
+
The headline: **VL truncated to 512 dims (0.731) still beats the full-1024-dim text model (0.701) and the
|
| 43 |
+
full e5 (0.688).** Even at 256 dims — one eighth of native — it beats both full-size rivals. So the VL
|
| 44 |
+
model's storage cost is negotiable: a quarter-size vector keeps 98% of its quality and remains the best
|
| 45 |
+
retriever in the field. e5's speed advantage stands; its quality ceiling does not.
|
| 46 |
+
|
| 47 |
+
~~~
|
| 48 |
+
|
| 49 |
+
## The vault reality check (and why the corpus is still the wall)
|
| 50 |
+
|
| 51 |
+
The point of t037 was Donald's memory vault — does any of this actually improve *his* retrieval? Ran the
|
| 52 |
+
trio over the real 15-note vault. Two honest observations:
|
| 53 |
+
|
| 54 |
+
- **It helps at the margins.** On "who is the user", e5 misses `identity.md` entirely; the text model
|
| 55 |
+
surfaces it at rank 2; the VL model nails it at **rank 1**. Genuine semantic routing the old model couldn't do.
|
| 56 |
+
- **The corpus is still the bottleneck.** `project-memories.md` dominates nearly every query's top-3 across
|
| 57 |
+
all three models — exactly the cp13 finding (a few notes swamp a tiny index). A better embedder cannot
|
| 58 |
+
out-retrieve a corpus that's too small to discriminate.
|
| 59 |
+
|
| 60 |
+
So: at 15 notes, the upgrade buys you a handful of better answers, not a transformation. The retriever was
|
| 61 |
+
never the limiting reagent here — corpus hygiene and size are. That's the same lesson cp13 taught, now
|
| 62 |
+
confirmed from the other direction.
|
| 63 |
+
|
| 64 |
+
~~~
|
| 65 |
+
|
| 66 |
+
## Footnote that matters — the VL model needed image *libraries*, not a CUDA toolkit
|
| 67 |
+
|
| 68 |
+
Unlike t036 (vLLM quantized inference, walled by a missing CUDA ≥12.9 toolkit on this Blackwell box),
|
| 69 |
+
Qwen3-VL-Embedding-2B loaded cleanly via sentence-transformers once `pillow` + `torchvision` were
|
| 70 |
+
installed — pure Python image deps, no system toolkit. The `tomaarsen/...-vdr` repackage failed (no
|
| 71 |
+
recognized `image_processor_type`); the **official `Qwen/Qwen3-VL-Embedding-2B`** worked. One more datapoint
|
| 72 |
+
for the map of what runs toolkit-free on this box: quant *inference* needs the toolkit, embedding *and*
|
| 73 |
+
training do not.
|
| 74 |
+
|
| 75 |
+
## Verdict — worth it if / not if
|
| 76 |
+
|
| 77 |
+
- **Worth swapping e5 for Qwen3-VL-2B if** retrieval quality is the bottleneck and you can spend the encode
|
| 78 |
+
time + VRAM — and truncate to 512 dims to claw most of the cost back.
|
| 79 |
+
- **Not worth it if** your corpus is small enough that retrieval already saturates (Donald's vault today), or
|
| 80 |
+
if encode throughput dominates your workload — e5's 10x speed is real.
|
| 81 |
+
- **The non-obvious win:** a VL embedder is a legitimately strong *text* retriever. Don't rule it out because
|
| 82 |
+
"it's for images."
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
¹ Encode throughput is the co-resident rate measured *alongside Donald* (llama-server holding ~18.9 GB), at
|
| 86 |
+
per-model batch sizes tuned to fit the free VRAM (e5 64 / text 16 / VL 8) — so it reflects deployment-on-a-busy-box,
|
| 87 |
+
not each model's isolated peak. Quality metrics are batch-invariant and clean. Harness + raw scores:
|
| 88 |
+
`scripts/embed_bench/`, `results/embed-scifact/`.
|