EmbeddingGemma-300M memory retriever v2

An English embedding model that finds the passages answering a question in notes, procedures, decision records and technical documentation. It is a fine-tune of Google's EmbeddingGemma-300M, packaged as one ONNX graph with pooling and normalization built in, so it runs locally without PyTorch.

On 925 questions over 82,719 passages of that material, it ranks useful evidence higher than the model it started from. nDCG@10, which rewards useful passages near the top of the first ten results, rises from 0.4418 to 0.5621, and precision@10, the useful share of those ten, from 49.71% to 64.16%. The tradeoff is general retrieval: on five public retrieval datasets it scores slightly below upstream, by 0.0042 to 0.0273 nDCG@10.

Experimental. This is an early fine-tune from ongoing training experiments, and a later version is likely to replace it. The results below describe experimental data, not a general improvement over the upstream model.

  • Output: a normalized 768-dimensional vector for each query or passage
  • Input limits: 128 tokens per query and 1,024 per passage, counting prefixes and special tokens
  • Runtimes: ONNX Runtime 1.24.4 on CPU and CUDA; Vulkan through the ONNX Runtime WebGPU plugin
  • Size: 300M parameters; about 1.23 GB for the FP32 graph and its external weights
  • License: Gemma Terms of Use

Embed queries and passages with the same revision, and re-embed stored passages when switching to v2.

On this page: Use the model Β· Results Β· Training Β· Runtime and limits

Quick start

Install the runtime dependencies and download the package. Keep model.onnx, model.onnx.data and the tokenizer from the same package together.

pip install onnxruntime==1.24.4 tokenizers numpy huggingface_hub
hf download Daecore/embeddinggemma-300m-memory-ft-v2 --local-dir downloaded-model

This example embeds a query and a passage on CPU:

from pathlib import Path
import numpy as np
import onnxruntime as ort
from tokenizers import Tokenizer

root = Path("downloaded-model")
tokenizer = Tokenizer.from_file(str(root / "tokenizer.json"))
session = ort.InferenceSession(
    str(root / "model.onnx"), providers=["CPUExecutionProvider"]
)

def embed(text, *, query=False):
    prefix = "task: search result | query: " if query else "title: none | text: "
    tokenizer.enable_truncation(max_length=128 if query else 1024)
    encoded = tokenizer.encode(prefix + text)
    return session.run(["embeddings"], {
        "input_ids": np.array([encoded.ids], dtype=np.int64),
        "attention_mask": np.array([encoded.attention_mask], dtype=np.int64),
    })[0][0]

query = embed("What must happen before a database migration?", query=True)
passage = embed("Take a verified backup before applying the migration.")
print(float(query @ passage))

Higher cosine similarity means a closer match. Always use the query and passage prefixes shown above; the truncation lengths in the example are the tested input limits and include those prefixes. The default output is 768 dimensions. The smaller-width measurements below show the tradeoff when vector storage matters.

Role in retrieval

Gemma supplies the meaning-based candidates in Daecore's hybrid search. BM25 keyword search adds exact matches for terms, names and identifiers, reciprocal-rank fusion merges the two rankings, and the Ettin reranker reorders up to 50 unique passages. A separate selector chooses how many to return. The candidates available therefore shape the final results alongside embedding quality. The package also works as a standalone embedder in other retrieval systems.

Coverage at 50 candidates measures what a reranker has to work with. Hit@50 asks whether the 50 contain any useful passage; known-positive recall@50 asks what share of the passages known to be useful they contain. A reranker can improve the order but cannot recover a passage outside its pool. Gemma's own top 50 describes retrieval by Gemma alone; in Daecore, the pool is the 50 passages left after Gemma's and BM25's results are merged and duplicates removed.

Evaluation

Gemma alone: dense retrieval on experimental data

Both models search the same 82,719 passages with exact FP32 dense retrieval, the same fixed query forms and the same 128/1,024-token input limits. BM25 and Ettin play no part. Each cell reads upstream β†’ Daecore v2.

Reference: the 925 questions with at least one passage graded useful, and 122,231 graded question–passage pairs for them, from a shared reference of 127,665 pairs covering both models' top 50 (September 2026). Questions where a model finds no useful passage stay in.

Cutoff Hit Precision Known-positive recall nDCG
1 56.00% β†’ 67.89% 56.00% β†’ 67.89% 1.44% β†’ 1.79% 0.4621 β†’ 0.5366
3 76.54% β†’ 83.24% 53.30% β†’ 66.15% 3.94% β†’ 5.03% 0.4466 β†’ 0.5440
5 83.35% β†’ 88.86% 52.38% β†’ 65.71% 6.17% β†’ 8.06% 0.4398 β†’ 0.5486
10 88.97% β†’ 92.43% 49.71% β†’ 64.16% 11.18% β†’ 15.07% 0.4418 β†’ 0.5621
20 93.08% β†’ 94.92% 46.08% β†’ 60.94% 19.61% β†’ 27.56% 0.4580 β†’ 0.5888
50 97.73% β†’ 99.03% 40.48% β†’ 52.92% 41.12% β†’ 57.92% 0.5145 β†’ 0.6525

Gemma v2 dense retrieval compared with upstream

Every position in each model's top 50 is graded, or excluded when it could not be graded: 164 upstream positions and 167 v2 positions at rank 50, with no later result moved up to replace them. Precision counts only graded positions. The corpus is not fully labeled, so the other 45 of the 970 questions have no known useful passage, which does not prove none exists.

At 50, v2 finds useful evidence for 99.03% of these questions and retrieves 57.92% of their known useful passages, against 97.73% and 41.12% upstream. The hybrid pool below covers fewer questions at 50: adding BM25 and capping the merged list can push out dense candidates, while reranking can improve early precision.

Passages are graded 0–3, and grades 2 and 3 count as useful; nDCG uses gains 0, 1, 3 and 7. Each question is asked in several forms whose rankings are merged with reciprocal-rank fusion, and identical passage text counts once. The evaluation companion includes coverage for every question, anonymized grades, model identities and metric code. These questions were also used during development, so this is not an untouched test.

Gemma alone: public dense retrieval

Five public retrieval datasets show how much general retrieval quality survives the fine-tune. Scores are dense-only nDCG@10 over full corpora, with matched preprocessing and official relevance judgments.

Dataset Queries Upstream Gemma Daecore v2
SciFact 300 0.7876 0.7783
FiQA 648 0.4741 0.4468
NFCorpus 323 0.3932 0.3890
SciDocs 1,000 0.1945 0.1852
ArguAna 1,406 0.6432 0.6259

V2 is below upstream on all five datasets, most on FiQA (βˆ’0.0273). The first fine-tune was measured only on FiQA and SciFact, where it scored 0.4009 and 0.7679; v2 closes more than half of each of those gaps to upstream. None of these datasets supplied training examples, but they informed development, so they are not untouched tests.

Smaller embeddings with Matryoshka

The model was trained at 768, 512, 256 and 128 dimensions. To use a smaller width, keep the first dimensions and normalize the shortened vector again, using the same width for queries and passages. Each quality column below is v2 nDCG@10, computed from exact rankings of cached FP32 vectors. The experimental column covers the same 925-question panel, judged in the top ten at each width against the same 122,231 graded pairs. The 768-wide results reproduce the full-width scores above.

Dimensions Bytes per FP32 vector Experimental SciFact FiQA NFCorpus SciDocs ArguAna
768 (default) 3,072 0.5621 0.7783 0.4468 0.3890 0.1852 0.6259
512 2,048 0.5648 0.7841 0.4374 0.3876 0.1793 0.6137
256 1,024 0.5323 0.7757 0.4091 0.3660 0.1708 0.5987
128 512 0.5069 0.7488 0.3668 0.3311 0.1484 0.5533

At 512 dimensions, each raw FP32 vector uses one-third less storage, with slightly higher experimental nDCG@10 in this measurement and lower scores on four of the five public datasets. At 256, vector storage falls by two-thirds at a larger quality cost. These byte counts exclude index overhead and compression, and shorter vectors do not make encoding faster. Daecore uses 768; smaller widths have not been checked through the full hybrid pipeline.

Full pipeline: the effect of Gemma v2

Only the embedder changes: upstream Gemma β†’ Daecore Gemma v2. BM25, reciprocal-rank fusion and the fine-tuned Ettin reranker stay fixed, and both pipelines search the same 82,719 passages. Each cell reads before β†’ after, so the change measures what Gemma contributes inside hybrid retrieval.

Reference: the same 925 questions with known useful evidence, fixed before this comparison, and 122,783 graded question–passage pairs (October 2026). Questions where retrieval finds nothing useful stay in. The Ettin card's pipeline table ends at the same fully fine-tuned pipeline.

Return depth Hit Precision Known-positive recall nDCG
1 73.99% β†’ 75.95% 73.99% β†’ 75.95% 2.01% β†’ 2.12% 0.6295 β†’ 0.6527
3 86.81% β†’ 89.41% 71.50% β†’ 75.11% 5.49% β†’ 5.89% 0.6121 β†’ 0.6424
5 89.95% β†’ 92.76% 70.10% β†’ 73.67% 8.53% β†’ 9.32% 0.6054 β†’ 0.6373
10 93.08% β†’ 94.27% 65.20% β†’ 70.49% 15.25% β†’ 16.99% 0.5959 β†’ 0.6377
20 95.68% β†’ 95.46% 56.86% β†’ 64.80% 25.18% β†’ 29.63% 0.5873 β†’ 0.6489
50 96.97% β†’ 97.62% 35.45% β†’ 42.40% 36.85% β†’ 45.83% 0.5374 β†’ 0.6125

At three results, useful-passage precision rises from 71.50% to 75.11%, and nDCG@10 from 0.5959 to 0.6377. At 50, the share of known useful passages in the hybrid pool rises from 36.85% to 45.83%: that is the evidence available to Ettin after merging, and reranking cannot recover passages outside those 50.

The gain is not uniform. Hit@20 falls from 95.68% to 95.46%, a difference of two questions, while precision, known-positive recall and nDCG improve at that depth.

All three pipeline variants rerank with matched PyTorch FP16. Depth 1 uses the 919 questions judged for all three variants; depths 3–50 use all 925. Positions that could not be graded are excluded, with no later result moved up. Grades 2 and 3 count as useful; precision counts graded positions, and recall counts known useful passages. This table uses a larger judged reference and a matched runtime, so its figures differ from the separate CUDA and Vulkan serving check. Daecore returns 3–20 results; these fixed depths do not evaluate its selector.

The evaluation companion provides the paired records, methods and serving checks. The pipeline overview explains retrieval and selection.

Training data and objective

The fine-tune adapts Gemma to finding evidence in document passages, where several passages can be useful for one question, including partial evidence.

Training ingredient Purpose
Mostly synthetic organizational documents, plus one person's largely AI-written project docs Exercise project notes, procedures, decisions and technical material
Queries written by four models from three provider families, without a designated answer Ask for evidence without reducing every question to one target passage
Model-judged relevance grades Distinguish decisive, partial, related and irrelevant evidence

Training and evaluation used the same kind of passages, and the same processes wrote and judged their questions, which limits how far these results generalize.

Public supervision uses existing evidence annotations from HotpotQA, MultiDoc2Dial and FinQA: multi-document questions, document-grounded dialogue, and textual or table evidence for numerical questions. The model learns to retrieve that evidence, not to perform FinQA's calculations; FinQA is unrelated to the FiQA evaluation above.

The objective combines supervised retrieval, a penalty that keeps the model's similarity structure close to upstream Gemma's, and a small preference for grade-3 over grade-2 experimental positives. Passages known to be useful or related are never treated as wrong answers for other questions in the same batch.

The run completed 2,260 updates, and validation selected update 1,130. Counts are unique questions and query–passage pairs seen by that checkpoint:

Source Available questions Questions seen Positive pairs seen
Experimental 2,165 2,165 73,130
HotpotQA 90,272 45,140 90,280
MultiDoc2Dial 4,931 2,466 2,508
FinQA 5,754 2,905 4,966

The checkpoint also saw 59,086 unique explicit experimental negative pairs; public groups used the other passages in each batch as negatives instead. Question and source weighting keep the largest pool from dominating through size alone.

Training recipe
Setting Value
Initialization Upstream Gemma; fresh optimizer
Adapter Attention LoRA, rank 16, alpha 32; merged for serving
Effective batch 64 question groups; up to four positives and four explicit negatives per group
Source weights Experimental 2/3; each public source 1/9
Optimizer AdamW, learning rate 5e-5, weight decay 0.01
Schedule 10% warmup, cosine decay over 2,260 updates
Precision FP16 with dynamic loss scaling
Retention / graded preference weights 2.0 / 0.25
Embedding widths and loss weights 768 / 512 / 256 / 128, weighted 1 / 0.25 / 0.125 / 0.0625

Small validation checks selected the checkpoint before full scoring. The recipe was run once; variation across training seeds is unmeasured.

Runtime and limits

The FP32 ONNX graph includes mean pooling, the learned projection and normalization. CPU, CUDA and Vulkan passed a 74-vector check covering token limits, mixed lengths and concurrent query and passage calls, with maximum differences from the PyTorch reference below 5.5e-7 and unchanged rankings on the tested inputs. Bounded mask operations were rewritten for Vulkan; learned weights are unchanged.

Vulkan runs through the native ONNX Runtime WebGPU plugin, onnxruntime-ep-webgpu==0.4.0, with onnxruntime==1.24.4. Register the plugin library, add its device to the session options and create the session without a providers list. Set dawnBackendType to Vulkan, because Windows can otherwise select Direct3D 12. The tested options also set enableInt64=1, powerPreference=high-performance, validationMode=basic and storageBufferCacheMode=lazyRelease.

Checks used Windows x64 with an NVIDIA RTX 3060 Ti (8 GB); other GPUs and Linux are untested, even where Vulkan is available.

The experimental data is mostly generated and model-judged, with no human reference panel, so it describes this development material rather than other people's documents. The dense and full-pipeline panels share questions and a pooled relevance reference but evaluate different retrieval paths. Some questions omit the project or task context needed for an unambiguous judgment. The 970-question source panel uses natural-language questions and reports no separate scores for terse or paraphrased queries. Passage relevance does not measure how many distinct facts are covered or whether an agent then succeeds.

License

Gemma Terms of Use and the Gemma Prohibited Use Policy. The package includes the required terms, attribution and modification notice.

Downloads last month
228
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Daecore/embeddinggemma-300m-memory-ft-v2

Finetuned
(302)
this model