Unified multimodal encoder — one 768d vector for text, images, documents and audio

A single embedding space (768-d, L2-normalized) that maps every modality to one vector, so a vector database needs one index and plain cosine/ANN search. It is an architectural analogue of google/embeddinggemma-2, but built from smaller open encoders plus small trained heads; EmbeddingGemma 2 itself is not needed at inference — it was only the teacher used to define the space during training.

текст       gte-multilingual-base (305M)        ── head 768→768 ──┐
изображения SigLIP2-so400m-384 (877M) + LoRA    ── head 1152→768 ─┼──► 768d (L2) ──► one ANN index
аудио       CLAP (laion/clap-htsat-unfused)     ── head CLAP→768 ─┘

Storage: 1 536 B/object (768d fp16). Indexing throughput: ~15 pages/s on a V100 (SigLIP2-so400m, batch 8). Query encoding: text tower, sub-10 ms on CPU for short queries.

Measured quality (this release)

Modality / benchmark This model Gemma 2 (teacher) Share
Text: SciFact nDCG@10 0.734 0.851 86%
Text: NFCorpus nDCG@10 0.368 0.370 99%
Text: Arguana nDCG@10 0.426 0.432 99%
Text: MIRACL-ru nDCG@10 0.942 0.965 98%
Text average — — 95.5%
Images: COCO text→image R@10 (held-out 20%) 0.715 0.791 90%
Documents: ViDoRe v3 industrial R@10 0.296 0.678 44%
Scans (internal domain) R@10, single visual channel 0.375 0.417 90%
Audio: ESC-50 text→audio R@10 0.580 0.620 94%

All four rows above are produced by this exact bundle — one image head, one text head and one audio head sharing a single 768-d space (results/unified_eval.json).

Notes on honesty:

  • documents are the known gap: 46% of the teacher. The one-vector result is statistically on par with the multi-vector ColSmol-256M (0.343) on ViDoRe recall@10 (paired bootstrap difference −0.027, CI covers 0) while using 145× less storage and 14× faster indexing;
  • audio is a 50-class pilot on ESC-50 — not a full audio-retrieval benchmark;
  • the single shared text head trades ~5% of document quality for covering captions, indoor field values and audio class names at once (0.296 vs 0.312 with a document-only head);
  • text numbers are the encoder's own space measured before any task-specific fine-tuning.

Repository layout

config.json                      # components, dims, measured metrics
artifacts/vision_lora.safetensors# LoRA (r=8) for SigLIP2-so400m, tuned on COCO
artifacts/image_head.safetensors # ridge 1152→768 (Gemma image space)
artifacts/text_head.safetensors  # ridge 768→768 (Gemma text space)
artifacts/audio_head.safetensors # ridge CLAP→768 (Gemma audio space)
usage.py                         # encode text/images/audio, build an index, search
results/unified_eval.json        # exact numbers shipped with this release

Usage

from usage import UnifiedEncoder

enc = UnifiedEncoder(device="cuda:0")          # or "cpu"
vec_text  = enc.encode_text(["договор аренды", "invoice 2024"])     # (N, 768)
vec_image = enc.encode_image(["page.png", "cat.jpg"])                # (N, 768)
vec_audio = enc.encode_audio(["clip.wav"])                          # (N, 768)

# one index, one metric: cosine == dot product on normalized vectors
import numpy as np
index = np.vstack([vec_image, vec_audio])
scores = index @ vec_text[0]

Any of encode_text, encode_image, encode_audio returns vectors in the same space: a text query can retrieve pages, photos and audio clips through the same index.

Training summary (for reproducibility)

  1. Space: embeddings of google/embeddinggemma-2 (768d) define the target space.
  2. Image head: ridge regression 1152→768 fitted on ColPali page pairs (30 282), MSCOCO image–caption pairs (6 000) and internal scanned forms (96 pages).
  3. Vision LoRA: r=8 on SigLIP2-so400m trained on MSCOCO only (so everyday photos improve); documents are handled by the head, so the trade-off does not hurt them.
  4. Text head: ridge 768→768 fitted on ColPali questions, internal field values and ESC-50 class names.
  5. Audio head: ridge CLAP→768 fitted on ESC-50 clips.
  6. All heads are closed-form ridge solutions (seconds to fit), only LoRA requires GPU training.

Limitations

  • Documents remain 46% of the teacher's quality; closing the gap needs vision-tower training on document data (work in progress).
  • Audio evidence is a 50-class pilot.
  • The space is derived from EmbeddingGemma 2; for a fully independent space a from-scratch contrastive training would be required.
  • Russian handwritten/scanned forms: 0.375 recall@10 in this single visual channel (previous two-channel setups reached 0.719 but violated the one-channel requirement).

Licenses

  • Code and trained heads/LoRA in this repository: Apache-2.0.
  • Base models keep their own licenses: Alibaba-NLP/gte-multilingual-base (Apache-2.0), google/siglip2-so400m-patch14-384 (Apache-2.0), laion/clap-htsat-unfused (Apache-2.0).
  • EmbeddingGemma 2 was used only as a training teacher; no Gemma weights are shipped here.

Citation / related work

Built on top of the earlier results in Adiutant/colsmol-printfix-lora (a print-preserving ColSmol adapter used in the document experiments).

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support