PrismEmbed-Small / README.md
flintglass's picture
Add Flintglass PrismEmbed-Small model card (49.36% All-7, beats MiniLM +7.82 pts, beats bge-m3 at 128d)
d024b97 verified
|
Raw History Blame Contribute Delete
8.36 kB
metadata
license: apache-2.0
language:
  - en
  - multilingual
base_model: jhu-clsp/mmBERT-small
pipeline_tag: feature-extraction
library_name: sentence-transformers
tags:
  - sentence-transformers
  - feature-extraction
  - sentence-similarity
  - embeddings
  - matryoshka
  - rag
  - retrieval
  - commercial-safe
  - zero-ms-marco
  - long-context
  - 8k-context
  - onnx
  - modernbert
  - flintglass
  - prismembed

Flintglass PrismEmbed-Small

Flintglass PrismEmbed-Small (140M, jhu-clsp/mmBERT-small) is a 100% commercial-safe (Zero MS MARCO!), Apache-2.0, 8,192-token Matryoshka bi-encoder embedding model with zero mandatory prompt prefixes—a 1-line drop-in for sentence-transformers and onnxruntime.

Ultra-fast 140M 1,800-language 8K Matryoshka edge embedder: beats all-MiniLM-L6-v2 overall by +7.82 pts (49.36% vs 41.54%), beats 4.3× larger Qwen3-Embedding-0.6B on LongDoc-8K (70.72% vs 66.23%), and beats 4× larger BAAI/bge-m3 at Matryoshka 128d (46.51% vs 45.39%) with 0.9975 ONNX INT8 cosine parity and ZERO MS MARCO!


Two-Stage Commercial-Safe (Zero MS MARCO) Training

  1. Stage 1 — Large-Batch Bidirectional Contrastive Pre-Training (580,710 pairs): 2 epochs of symmetric bidirectional InfoNCE + Multi-Scale Matryoshka Loss (384–512 cross-GPU in-batch negatives) across exclusively Apache-2.0, MIT, and CC-BY-4.0 datasets (allenai/gooaq 350K, qiaojin/PubMedQA 115.6K, miracl/miracl 16-lang 74.8K, mr-tydi 11-lang 18.2K, ServiceNow/repliqa 13.7K, Shitao/MLDR 13-lang 8.5K).
  2. Stage 2 — Hard-Negative + Cross-Encoder Teacher Distillation (105,558 8-doc groups): 1 epoch of hard-negative InfoNCE + soft KL-distillation from Apache-2.0 Qwen/Qwen3-Reranker-4B logits at long document contexts (1,024–8,192 tokens) across all Matryoshka prefixes.
  3. Zero Evaluation Leakage: Strictly SHA-256 deduplicated against all 7 held-out benchmarks.

Strictly Zero-Shot 7-Benchmark Full-Corpus Dense Retrieval (NDCG@10)

All models were evaluated identically over the full deduplicated document corpus of each benchmark (2,338 to 15,975 unique corpus documents per benchmark; graded-relevance IDCG@10; max_length=4096 for long-context models).

Model Params Dim Max Ctx Commercial-Safe (No MS MARCO) SciFact NFCorpus FiQA ArguAna TREC-COVID BEIR-5 Avg Mr.TyDi (11-Lang) LongDoc-8K All-7 Avg MRL 128d All-7
all-MiniLM-L6-v2 22M 384 256 Mixed 62.30 29.47 28.77 35.70 50.77 41.40 23.76 59.98 41.54 37.05
multilingual-e5-small 118M 384 512 Mixed 64.84 31.03 28.32 29.86 64.63 43.74 96.89 62.72 54.04 44.04
BAAI/bge-m3 568M 1024 8,192 No (MS MARCO) 61.97 31.45 32.83 39.44 62.87 45.71 97.26 72.51 56.90 45.39
Qwen/Qwen3-Embedding-0.6B 600M 1024 32K Mixed 66.86 34.72 35.41 46.35 75.31 51.73 92.84 66.23 59.67 54.49
Flintglass PrismEmbed-Small 140M 384 8,192 100% Yes 52.42 21.56 20.79 34.00 56.07 36.97 89.99 70.72 49.36 46.51
Flintglass PrismEmbed-Multilingual 307M 768 8,192 100% Yes 57.07 27.55 23.38 35.73 63.50 41.45 91.57 75.54 53.48 48.19
Flintglass PrismEmbed-Large 395M 1024 8,192 100% Yes 62.97 25.59 28.15 37.13 61.68 43.10 76.84 70.79 51.88 48.33

Pre-Exported ONNX & Hardware Specs

Property Value
Parameters 140M
Backbone jhu-clsp/mmBERT-small
Embedding Dimension 384 (Matryoshka: 384 / 256 / 128)
Pooling / Normalization Mean Pooling + L2 Normalize (native sentence-transformers config included)
Prompt Prefixes Required None (1-line drop-in!)
Max Context Length 8,192 tokens (native RoPE)
Languages 1,800+ languages (mmBERT 256K vocab, 8,192-token native RoPE)
ONNX FP32 (onnx/model.onnx) 563 MB (cosine_similarity = 1.0000 vs PyTorch)
ONNX INT8 (onnx/model_quantized.onnx) 534 MB (per-channel QUInt8, cosine_similarity = 0.9975)
CPU Latency (4 threads) 107 ms (INT8, 256-tok)

Quickstart

Python (sentence-transformers — 1-Line Drop-In + Matryoshka Truncation)

from sentence_transformers import SentenceTransformer

model = SentenceTransformer("flintglass/PrismEmbed-Small", truncate_dim=256)  # or omit truncate_dim for full dims
embeddings = model.encode([
    "How does Matryoshka Representation Learning reduce vector DB memory?",
    "Matryoshka embeddings remain accurate when truncated to 128 or 256 dimensions.",
])
print("Cosine similarity:", float(embeddings[0] @ embeddings[1]))

Fast CPU Inference (onnxruntime, Zero PyTorch Required)

import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer

repo_id = "flintglass/PrismEmbed-Small"
tok = AutoTokenizer.from_pretrained(repo_id)
onnx_path = hf_hub_download(repo_id, "onnx/model_quantized.onnx")
sess = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])

enc = tok(["What is RLVR?", "Reinforcement Learning with Verifiable Rewards."], padding=True, return_tensors="np")
vecs = sess.run(None, {"input_ids": enc["input_ids"].astype(np.int64), "attention_mask": enc["attention_mask"].astype(np.int64)})[0]
print("Cosine similarity:", float(vecs[0] @ vecs[1]))

The Complete 6-Pillar Flintglass Prism Open-Source Agent & RAG Stack

All models are 100% Apache-2.0 and evaluated on zero-leakage held-out benchmarks:

  1. Ingest: PrismParse-4B / PrismParse-2B — Document, Table, Receipt & Math OCR VLMs
  2. Embed: PrismEmbed-Multilingual | PrismEmbed-Large | PrismEmbed-Small (Live Demo)
  3. Rerank: PrismRerank-Large | PrismRerank-Multilingual | PrismRerank-Small (Live Demo)
  4. Protect: PrismGuard-Multilingual — 8K Prompt-Injection & Agent Security (Live Demo)
  5. Execute: Inkling-2-Mini-PrismAgent | PrismAgent-27B | PrismAgent-35B-A3B | PrismAgent-8B
  6. Verify: PrismVerify-4B / PrismVerify-Large — 8K RAG Hallucination & Groundedness Verification (Live Demo)

License

Released under Apache-2.0.