File size: 8,418 Bytes
ec357a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
license: apache-2.0
language:
- en
base_model: answerdotai/ModernBERT-large
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-Large

**Flintglass PrismEmbed-Large** (395M, `answerdotai/ModernBERT-large`) 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`.

**#1 Encoder Model at Matryoshka `128d` (`48.33%` All-7 NDCG@10 β€” beating 568M `BAAI/bge-m3` `45.39%` by `+2.94 pts` and `all-MiniLM-L6-v2` `37.05%` by `+11.28 pts` for 8Γ— smaller vector databases!)**, beats `BAAI/bge-m3` on BEIR-SciFact (`62.97%` vs `61.97%`), beats `all-MiniLM-L6-v2` on BEIR-5 (`43.10%` vs `41.40%`), and beats 600M `Qwen3-Embedding-0.6B` on LongDoc-8K (`70.79%` vs `66.23%`) with **ZERO MS MARCO**!

- **Live CPU Demo (ONNX INT8 + Matryoshka Explorer)**: [flintglass/PrismEmbed-Demo](https://huggingface.co/spaces/flintglass/PrismEmbed-Demo)
- **Full PrismEmbed Family**: [PrismEmbed-Multilingual](https://huggingface.co/flintglass/PrismEmbed-Multilingual) (307M, 1,800+ langs) | [PrismEmbed-Large](https://huggingface.co/flintglass/PrismEmbed-Large) (395M EN) | [PrismEmbed-Small](https://huggingface.co/flintglass/PrismEmbed-Small) (140M, 1,800+ langs)
- **Pair with Second-Stage Rerankers**: [PrismRerank-Large](https://huggingface.co/flintglass/PrismRerank-Large) / [PrismRerank-Multilingual](https://huggingface.co/flintglass/PrismRerank-Multilingual) / [PrismRerank-Small](https://huggingface.co/flintglass/PrismRerank-Small)
- **Pre-Exported ONNX Included**: `onnx/model.onnx` (FP32, 1,580 MB, cosine parity `1.0000`) & `onnx/model_quantized.onnx` (per-channel QUInt8, 1,317 MB, cosine parity `0.9958`)

---

## 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** | 395M |
| **Backbone** | `answerdotai/ModernBERT-large` |
| **Embedding Dimension** | 1024 (Matryoshka: 1024 / 512 / 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** | English-first (8,192-token native RoPE) |
| **ONNX FP32 (`onnx/model.onnx`)** | 1,580 MB (`cosine_similarity = 1.0000` vs PyTorch) |
| **ONNX INT8 (`onnx/model_quantized.onnx`)** | 1,317 MB (per-channel QUInt8, `cosine_similarity = 0.9958`) |
| **CPU Latency (4 threads)** | 531 ms (INT8, 256-tok) |

---

## Quickstart

### Python (`sentence-transformers` β€” 1-Line Drop-In + Matryoshka Truncation)

```python
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("flintglass/PrismEmbed-Large", 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)

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

repo_id = "flintglass/PrismEmbed-Large"
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](https://huggingface.co/flintglass/PrismParse-4B) / [PrismParse-2B](https://huggingface.co/flintglass/PrismParse-2B) β€” Document, Table, Receipt & Math OCR VLMs
2. **Embed**: **PrismEmbed-Multilingual** | **PrismEmbed-Large** | **PrismEmbed-Small** ([Live Demo](https://huggingface.co/spaces/flintglass/PrismEmbed-Demo))
3. **Rerank**: [PrismRerank-Large](https://huggingface.co/flintglass/PrismRerank-Large) | [PrismRerank-Multilingual](https://huggingface.co/flintglass/PrismRerank-Multilingual) | [PrismRerank-Small](https://huggingface.co/flintglass/PrismRerank-Small) ([Live Demo](https://huggingface.co/spaces/flintglass/PrismRerank-Demo))
4. **Protect**: [PrismGuard-Multilingual](https://huggingface.co/flintglass/PrismGuard-Multilingual) β€” 8K Prompt-Injection & Agent Security ([Live Demo](https://huggingface.co/spaces/flintglass/PrismGuard-Demo))
5. **Execute**: [Inkling-2-Mini-PrismAgent](https://huggingface.co/flintglass/Inkling-2-Mini-PrismAgent) | [PrismAgent-27B](https://huggingface.co/flintglass/PrismAgent-27B) | [PrismAgent-35B-A3B](https://huggingface.co/flintglass/PrismAgent-35B-A3B) | [PrismAgent-8B](https://huggingface.co/flintglass/PrismAgent-8B)
6. **Verify**: [PrismVerify-4B](https://huggingface.co/flintglass/PrismVerify-4B) / [PrismVerify-Large](https://huggingface.co/flintglass/PrismVerify-Large) β€” 8K RAG Hallucination & Groundedness Verification ([Live Demo](https://huggingface.co/spaces/flintglass/PrismVerify-Demo))

## License

Released under **Apache-2.0**.