EmbeddingGemma 2 β€” Weight-Space Programmed (Q8_0 GGUF)

A text-and-code-optimized Q8_0 GGUF build of google/embeddinggemma-2 (270M text backbone, 8,192-token context, Apache 2.0) created via Weight-Space Programming (zero gradient descent, zero training loops, 0.0 ms runtime overhead).

What Changed

  • Modified parameters: 0.0967% of text-only parameters (262,058 scalars), all inside language_model.embedding_projection.weight[256:] (output.weight in GGUF).
  • Matryoshka 256d preserved: The leading 256 rows (W[:256]) are 100% bit-for-bit identical to stock google/embeddinggemma-2.
  • Mechanism: Stock embeddinggemma-2 aligns 4 modalities (text, image, video, audio) into one 768d space, compressing text into a tight anisotropic sub-cone where unrelated documents score ~0.53–0.61 cosine similarity. Using a small unlabeled 112-text calibration panel, we subtracted a ridge-stabilized rank-1 shared-offset carrier from the tail projection rows W[256:] and restored the tail's original energy (Γ—1.5313), then quantized to Q8_0 via llama-quantize.

Held-Out Evaluation Results (Stock β†’ Edited)

Benchmark (unseen held-out) Stock embeddinggemma-2 Edited (wsp-Q8_0) Delta
BEIR NFCorpus Test (768d) nDCG@10 0.4286 0.4325 +0.39 pts
BEIR NFCorpus Test (768d) Margin 0.0925 (neg: 0.577) 0.1367 (neg: 0.314) +48% wider
BEIR SciFact Test (768d) nDCG@10 0.9464 0.9536 +0.72 pts
BEIR SciFact Test (768d) Margin 0.2838 (neg: 0.548) 0.4389 (neg: 0.294) +55% wider
BEIR SciFact Test (256d MRL) 0.9442 0.9442 Bit-identical
Code Retrieval (768d) nDCG@10 / Margin 1.0000 / 0.2169 1.0000 / 0.3702 +71% wider
No-Answer Max Cosine (mean / worst) 0.5796 / 0.6085 0.3349 / 0.3668 βˆ’0.245 lower floor
  • GGUF vs. PyTorch edited parity: 0.99980 min cosine across probe texts.
  • Note: Non-text modalities (image/audio/video) were not evaluated after the tail edit; this build is intended for text & code retrieval. Re-embed both queries and indexed documents when switching from stock embeddinggemma-2.

Usage

llama.cpp (llama-server, requires llama.cpp >= 1.0.0 / gemma-embedding2 support)

llama-server \
  -hf bek91/embeddinggemma-2-wsp-GGUF:Q8_0 \
  --embeddings -c 32768 -b 8192 -ub 8192 -np 4 \
  --host 127.0.0.1 --port 8080

(Note: gemma-embedding2 is a bidirectional encoder, so llama.cpp requires -ub >= max_chunk_tokens.)

node-llama-cpp / @unblocklabs/qmd (requires node-llama-cpp >= 3.22.3)

QMD_EMBED_MODEL="hf:bek91/embeddinggemma-2-wsp-GGUF/embeddinggemma-2-wsp-Q8_0.gguf"

Prompt prefixes match stock google/embeddinggemma-2:

  • Query: task: search result | query: {query}
  • Document: title: {title or "none"} | text: {content}

Attribution & License

Derived from google/embeddinggemma-2 by Google DeepMind, distributed under the Apache 2.0 license.

Downloads last month
365
GGUF
Model size
0.3B params
Architecture
gemma-embedding2
Hardware compatibility
Log In to add your hardware

8-bit

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

Model tree for bek91/embeddinggemma-2-wsp-GGUF

Quantized
(157)
this model