abtonmoy commited on
Commit
2b5bcc8
·
verified ·
1 Parent(s): 26319a8

Card: code links to the renamed family repo (Eximius-Labs/fusion-embedding); Clotho T2A R@1 predecessor cell now recorded (0.136)

Browse files
Files changed (1) hide show
  1. README.md +234 -234
README.md CHANGED
@@ -1,234 +1,234 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- language:
4
- - en
5
- pipeline_tag: feature-extraction
6
- tags:
7
- - embeddings
8
- - multimodal
9
- - audio
10
- - retrieval
11
- - matryoshka
12
- - qwen3-vl
13
- - adapters
14
- base_model: Qwen/Qwen3-VL-Embedding-2B
15
- ---
16
-
17
- # fusion-embedding-2-2b-preview
18
-
19
- <div align="center">
20
-
21
- [![Python](https://img.shields.io/badge/python-3.11+-blue.svg)](https://github.com/Eximius-Labs/fusion-embedding-1)
22
- [![PyTorch](https://img.shields.io/badge/PyTorch-2.x-ee4c2c.svg)](https://github.com/Eximius-Labs/fusion-embedding-1)
23
- [![Weights](https://img.shields.io/badge/weights-CC--BY--NC--4.0-green.svg)](#license)
24
- [![Status](https://img.shields.io/badge/status-research%20preview%20v0.1-orange.svg)](#)
25
- [![Code](https://img.shields.io/badge/code-GitHub-black.svg)](https://github.com/Eximius-Labs/fusion-embedding-1)
26
-
27
- </div>
28
-
29
- `fusion-embedding-2-2b-preview` is the second generation of Eximius Labs' unified
30
- multimodal embedding models: **text, images, video, and audio in one vector space**.
31
- It extends the first generation with modality-gated deep adapters — in-layer audio
32
- capacity added to a byte-frozen base. For the first-generation architecture, see
33
- [fusion-embedding-1-2b-preview](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview)
34
- (that line is final at v0.3).
35
-
36
- [GitHub](https://github.com/Eximius-Labs/fusion-embedding-1) | [fusion-embedding-1](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview) | Technical report: in preparation
37
-
38
- ## Model Overview
39
-
40
- <p align="center">
41
- <img src="assets/fe2_model_overview.png" alt="fusion-embedding-2 architecture: frozen Qwen3-VL-Embedding base with modality-gated adapters inside; frozen audio tower and trained FusionResampler on the audio branch; one shared embedding space" width="820px">
42
- </p>
43
-
44
- `fusion-embedding-2-2b-preview` embeds all four modalities with a
45
- [Qwen3-VL-Embedding-2B](https://huggingface.co/Qwen/Qwen3-VL-Embedding-2B) base that is
46
- **byte-identical to its original release** — its text, image, and video behaviour (and
47
- benchmark scores) carry over exactly. Audio is added by training 60.6M parameters
48
- (~2.3% of the stack): a perceiver-resampler that translates frozen
49
- [Qwen2.5-Omni](https://huggingface.co/Qwen/Qwen2.5-Omni-7B) audio-tower features into
50
- the base's input space, and — new in this generation — **28 gated adapters** (44.2M)
51
- that give the frozen language model in-layer capacity to process audio. The adapters
52
- are active only while encoding audio; every other forward pass returns the frozen
53
- layers' output untouched, so the invariance is bitwise, not approximate
54
- (`base_drift == 0` is asserted on every training run, and this model reproduces the
55
- base's text→image retrieval scores to four decimal places). Trained on 518K
56
- audio–caption pairs with a full-corpus frozen-text negative bank, it leads every
57
- unified embedding model we measured on audio↔text retrieval — ahead of ImageBind,
58
- LanguageBind, and Gemini Embedding 2 in both directions — and improves on
59
- fusion-embedding-1 v0.3 in 8 of 12 release-protocol cells, including every
60
- recorded text→audio direction. Audio↔image alignment is emergent (zero
61
- audio–image pairs in training).
62
-
63
- | Feature | Value |
64
- | --- | --- |
65
- | Parameters | ~2.06B frozen base + 640M frozen audio tower; **60.6M trained** |
66
- | Modalities | text, image, video, audio |
67
- | Supported tasks | `retrieval` (all modality pairs), `zero-shot classification` |
68
- | Max input | 254 text tokens · 30 s audio per window (up to 8 windows) |
69
- | Embedding dimension | 2048 |
70
- | Matryoshka dimensions | 64, 128, 256, 512, 1024, 1536, 2048 |
71
- | Pooling strategy | Last-token pooling |
72
- | Base model | Qwen/Qwen3-VL-Embedding-2B (byte-frozen) |
73
- | Audio tower | Qwen/Qwen2.5-Omni-7B audio encoder (frozen) |
74
- | Trained components | FusionResampler 16.4M + 28× gated adapters 44.2M |
75
- | Distribution | ~250 MB trained components; frozen towers download from their original repos |
76
-
77
- ## Training and Evaluation
78
-
79
- Contrastive training (InfoNCE over the Matryoshka ladder, symmetric) against the
80
- frozen base's native chat-template text embeddings: 518,183 audio–caption pairs from
81
- six sources (73,716 clips with content-free metadata excluded), a full-corpus
82
- frozen-text negative bank, soft labels 0.3, false-negative masking 0.98, bf16, 3,900
83
- steps at effective batch 1,024, then a 400-step in-domain fine-tune on the AudioCaps
84
- train split. All evaluation-set audio (Clotho, ESC-50, UrbanSound8K, VGGSound,
85
- AudioCaps test/val) is excluded from training by ID blacklists at ingestion. A
86
- technical report is in preparation.
87
-
88
- All numbers below use the release protocol (bf16 base precision, native chat-template
89
- text). Bold marks the better value per row/column.
90
-
91
- <p align="center">
92
- <img src="assets/fe_positioning.png" alt="Positioning: VGGSound-696 cross-modal retrieval versus model parameters; the fusion-embedding family leads unified models on audio-text and leads the emergent audio-image cluster (ImageBind's supervised pair annotated)" width="860px">
93
- </p>
94
-
95
- <details open>
96
- <summary><b>Versus fusion-embedding-1 v0.3</b></summary>
97
-
98
- | Board / direction | fusion-embedding-1 v0.3 | fusion-embedding-2 (this repo) |
99
- |---|---|---|
100
- | AudioCaps A→T R@1 | **0.332** | 0.302 |
101
- | AudioCaps A→T R@10 | 0.741 | **0.743** |
102
- | AudioCaps T→A R@1 | — | **0.292** |
103
- | AudioCaps T→A R@10 | 0.746 | **0.775** |
104
- | Clotho (zero-shot) A→T R@1 | **0.135** | 0.127 |
105
- | Clotho (zero-shot) A→T R@10 | **0.433** | 0.421 |
106
- | Clotho (zero-shot) T→A R@1 | ~0.13 | **0.151** |
107
- | Clotho (zero-shot) T→A R@10 | 0.460 | **0.482** |
108
- | VGGSound audio→text R@1 | **0.213** | 0.211 |
109
- | VGGSound audio→text R@10 | 0.625 | **0.665** |
110
- | VGGSound text→audio R@1 | 0.213 | **0.266** |
111
- | VGGSound text→audio R@10 | 0.645 | **0.681** |
112
- | VGGSound audio→image R@10 (emergent) | **0.407** | 0.392 |
113
-
114
- fusion-embedding-2 takes the majority of cells, with its largest gains in the
115
- text→audio direction (searching audio with a text query) and on the cross-modal
116
- audio↔text pair. fusion-embedding-1 v0.3 retains the AudioCaps and Clotho A→T R@1
117
- cells and a ~1.5-point edge on emergent audio→image at this fine-tuned operating
118
- point; the pre-fine-tune fusion-embedding-2 checkpoint scores 0.443 on that cell — the
119
- project record — and may be released separately as the emergent-alignment operating
120
- point.
121
-
122
- </details>
123
-
124
- <details>
125
- <summary><b>Cross-modal retrieval — versus unified embedding models</b> (VGGSound-AV, 696 pairs, chance R@10 = 0.014)</summary>
126
-
127
- R@10 shown as audio-side → other / other → audio-side:
128
-
129
- | Model | audio↔image | audio↔text | text↔image |
130
- |---|---|---|---|
131
- | ImageBind-Huge | **0.718 / 0.720** | 0.404 / 0.348 | 0.243 / 0.282 |
132
- | LanguageBind | 0.365 / 0.415 | 0.547 / 0.331 | 0.221 / 0.283 |
133
- | Gemini Embedding 2 (API, 2026-07-09) | 0.312 / 0.316 | 0.379 / 0.374 | 0.273 / **0.366** |
134
- | fusion-embedding-1-2b-preview v0.3 | 0.407 / 0.428 | 0.625 / 0.645 | **0.331** / 0.319 |
135
- | **fusion-embedding-2-2b-preview** | 0.392 / 0.430 | **0.665 / 0.681** | **0.331** / 0.319 |
136
-
137
- ImageBind trains directly on audio–image pairs, so that pair is its supervised
138
- direction; its audio–text alignment is emergent. LanguageBind trains audio against
139
- language; its audio↔image is emergent. Both fusion-embedding generations train on
140
- audio–text only; their audio–image alignment is emergent. All models evaluated with
141
- identical clips, frames, and scoring, using the released imagebind_huge checkpoint and
142
- revision-pinned LanguageBind checkpoints. Gemini Embedding 2 is Google's natively
143
- multimodal embedding API, evaluated at its documented default invocation on the date
144
- shown; API models may change after that date. fusion-embedding-2's text↔image cells
145
- are identical to fusion-embedding-1's by construction — text and images never touch
146
- the trained components — and this is verified: its own readout run reproduces
147
- fusion-embedding-1 v0.3's text→image scores to four decimal places.
148
-
149
- </details>
150
-
151
- <details>
152
- <summary><b>Audio–text retrieval — versus specialist CLAP models</b></summary>
153
-
154
- Specialist CLAP models fine-tune their text towers on audio captions — the direct
155
- trade this architecture declines in order to keep one shared space for all four
156
- modalities. They remain ahead on the audio-caption boards (e.g., AudioCaps T→A R@1:
157
- M2D-CLAP 41.4 vs 29.2 here); this model family is the strongest option we measured
158
- when one model must serve text, images, video, and audio together. See the
159
- [fusion-embedding-1 card](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview)
160
- for the full CLAP comparison tables; fusion-embedding-2 improves on fusion-embedding-1
161
- in the text→audio direction on every board.
162
-
163
- </details>
164
-
165
- ## Usage
166
-
167
- <details>
168
- <summary>Requirements</summary>
169
-
170
- - `fusion_embedding` package: `pip install git+https://github.com/Eximius-Labs/fusion-embedding-1`
171
- - `transformers>=4.46`, `torch` (CUDA), `torchvision`, `pillow`, `soundfile`, `librosa`
172
- - ~14 GB GPU memory at bf16
173
-
174
- </details>
175
-
176
- <details open>
177
- <summary>via <code>inference.py</code> (this repository)</summary>
178
-
179
- ```python
180
- from inference import FusionEmbedder
181
-
182
- fe = FusionEmbedder.from_pretrained(
183
- "EximiusLabs/fusion-embedding-2-2b-preview",
184
- revision="v0.1-preview", # pin a tag if you build on this model
185
- )
186
-
187
- a = fe.embed_audio("dog.wav") # audio file or (array, sr=...)
188
- t = fe.embed_text("a dog barks") # uses the base's native chat template
189
- i = fe.embed_image("dog.jpg") # PIL image or path
190
-
191
- print((a @ t).item(), (a @ i).item()) # cosine similarities in the shared space
192
-
193
- # Matryoshka: pass dim= for smaller embeddings (64..2048)
194
- t_small = fe.embed_text("a dog barks", dim=256)
195
- ```
196
-
197
- The checkpoint contains the gated adapters and the loader refuses to run without them —
198
- an adapter checkpoint can never be silently executed as the first-generation
199
- architecture. All inputs use the base model's chat-template format; embedding quality
200
- is sensitive to this formatting, so use the templates provided by `FusionEmbedder`
201
- rather than constructing your own.
202
-
203
- </details>
204
-
205
- <details>
206
- <summary>Cross-modal ranking tip</summary>
207
-
208
- When ranking a gallery of one modality against queries of another, per-modality
209
- mean-centering of the gallery improves cross-modal recall by roughly two points across
210
- modality pairs:
211
-
212
- ```python
213
- gallery = FusionEmbedder.center(gallery_embeddings)
214
- ```
215
-
216
- </details>
217
-
218
- ## License
219
-
220
- Code is Apache-2.0 ([GitHub](https://github.com/Eximius-Labs/fusion-embedding-1));
221
- model weights in this repository are **CC BY-NC 4.0** (research preview). The frozen
222
- base and audio tower retain their original licenses.
223
-
224
- ## Citation
225
-
226
- ```bibtex
227
- @software{fusion_embedding_2_2026,
228
- title = {Fusion Embedding 2: Modality-Gated Deep Adapters for a
229
- Unified Text, Image, Video, and Audio Embedding Space},
230
- author = {Tonmoy, Abdul Basit},
231
- year = {2026},
232
- url = {https://huggingface.co/EximiusLabs/fusion-embedding-2-2b-preview}
233
- }
234
- ```
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ language:
4
+ - en
5
+ pipeline_tag: feature-extraction
6
+ tags:
7
+ - embeddings
8
+ - multimodal
9
+ - audio
10
+ - retrieval
11
+ - matryoshka
12
+ - qwen3-vl
13
+ - adapters
14
+ base_model: Qwen/Qwen3-VL-Embedding-2B
15
+ ---
16
+
17
+ # fusion-embedding-2-2b-preview
18
+
19
+ <div align="center">
20
+
21
+ [![Python](https://img.shields.io/badge/python-3.11+-blue.svg)](https://github.com/Eximius-Labs/fusion-embedding)
22
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.x-ee4c2c.svg)](https://github.com/Eximius-Labs/fusion-embedding)
23
+ [![Weights](https://img.shields.io/badge/weights-CC--BY--NC--4.0-green.svg)](#license)
24
+ [![Status](https://img.shields.io/badge/status-research%20preview%20v0.1-orange.svg)](#)
25
+ [![Code](https://img.shields.io/badge/code-GitHub-black.svg)](https://github.com/Eximius-Labs/fusion-embedding)
26
+
27
+ </div>
28
+
29
+ `fusion-embedding-2-2b-preview` is the second generation of Eximius Labs' unified
30
+ multimodal embedding models: **text, images, video, and audio in one vector space**.
31
+ It extends the first generation with modality-gated deep adapters — in-layer audio
32
+ capacity added to a byte-frozen base. For the first-generation architecture, see
33
+ [fusion-embedding-1-2b-preview](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview)
34
+ (that line is final at v0.3).
35
+
36
+ [GitHub](https://github.com/Eximius-Labs/fusion-embedding) | [fusion-embedding-1](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview) | Technical report: in preparation
37
+
38
+ ## Model Overview
39
+
40
+ <p align="center">
41
+ <img src="assets/fe2_model_overview.png" alt="fusion-embedding-2 architecture: frozen Qwen3-VL-Embedding base with modality-gated adapters inside; frozen audio tower and trained FusionResampler on the audio branch; one shared embedding space" width="820px">
42
+ </p>
43
+
44
+ `fusion-embedding-2-2b-preview` embeds all four modalities with a
45
+ [Qwen3-VL-Embedding-2B](https://huggingface.co/Qwen/Qwen3-VL-Embedding-2B) base that is
46
+ **byte-identical to its original release** — its text, image, and video behaviour (and
47
+ benchmark scores) carry over exactly. Audio is added by training 60.6M parameters
48
+ (~2.3% of the stack): a perceiver-resampler that translates frozen
49
+ [Qwen2.5-Omni](https://huggingface.co/Qwen/Qwen2.5-Omni-7B) audio-tower features into
50
+ the base's input space, and — new in this generation — **28 gated adapters** (44.2M)
51
+ that give the frozen language model in-layer capacity to process audio. The adapters
52
+ are active only while encoding audio; every other forward pass returns the frozen
53
+ layers' output untouched, so the invariance is bitwise, not approximate
54
+ (`base_drift == 0` is asserted on every training run, and this model reproduces the
55
+ base's text→image retrieval scores to four decimal places). Trained on 518K
56
+ audio–caption pairs with a full-corpus frozen-text negative bank, it leads every
57
+ unified embedding model we measured on audio↔text retrieval — ahead of ImageBind,
58
+ LanguageBind, and Gemini Embedding 2 in both directions — and improves on
59
+ fusion-embedding-1 v0.3 in 8 of 12 release-protocol cells, including every
60
+ recorded text→audio direction. Audio↔image alignment is emergent (zero
61
+ audio–image pairs in training).
62
+
63
+ | Feature | Value |
64
+ | --- | --- |
65
+ | Parameters | ~2.06B frozen base + 640M frozen audio tower; **60.6M trained** |
66
+ | Modalities | text, image, video, audio |
67
+ | Supported tasks | `retrieval` (all modality pairs), `zero-shot classification` |
68
+ | Max input | 254 text tokens · 30 s audio per window (up to 8 windows) |
69
+ | Embedding dimension | 2048 |
70
+ | Matryoshka dimensions | 64, 128, 256, 512, 1024, 1536, 2048 |
71
+ | Pooling strategy | Last-token pooling |
72
+ | Base model | Qwen/Qwen3-VL-Embedding-2B (byte-frozen) |
73
+ | Audio tower | Qwen/Qwen2.5-Omni-7B audio encoder (frozen) |
74
+ | Trained components | FusionResampler 16.4M + 28× gated adapters 44.2M |
75
+ | Distribution | ~250 MB trained components; frozen towers download from their original repos |
76
+
77
+ ## Training and Evaluation
78
+
79
+ Contrastive training (InfoNCE over the Matryoshka ladder, symmetric) against the
80
+ frozen base's native chat-template text embeddings: 518,183 audio–caption pairs from
81
+ six sources (73,716 clips with content-free metadata excluded), a full-corpus
82
+ frozen-text negative bank, soft labels 0.3, false-negative masking 0.98, bf16, 3,900
83
+ steps at effective batch 1,024, then a 400-step in-domain fine-tune on the AudioCaps
84
+ train split. All evaluation-set audio (Clotho, ESC-50, UrbanSound8K, VGGSound,
85
+ AudioCaps test/val) is excluded from training by ID blacklists at ingestion. A
86
+ technical report is in preparation.
87
+
88
+ All numbers below use the release protocol (bf16 base precision, native chat-template
89
+ text). Bold marks the better value per row/column.
90
+
91
+ <p align="center">
92
+ <img src="assets/fe_positioning.png" alt="Positioning: VGGSound-696 cross-modal retrieval versus model parameters; the fusion-embedding family leads unified models on audio-text and leads the emergent audio-image cluster (ImageBind's supervised pair annotated)" width="860px">
93
+ </p>
94
+
95
+ <details open>
96
+ <summary><b>Versus fusion-embedding-1 v0.3</b></summary>
97
+
98
+ | Board / direction | fusion-embedding-1 v0.3 | fusion-embedding-2 (this repo) |
99
+ |---|---|---|
100
+ | AudioCaps A→T R@1 | **0.332** | 0.302 |
101
+ | AudioCaps A→T R@10 | 0.741 | **0.743** |
102
+ | AudioCaps T→A R@1 | — | **0.292** |
103
+ | AudioCaps T→A R@10 | 0.746 | **0.775** |
104
+ | Clotho (zero-shot) A→T R@1 | **0.135** | 0.127 |
105
+ | Clotho (zero-shot) A→T R@10 | **0.433** | 0.421 |
106
+ | Clotho (zero-shot) T→A R@1 | 0.136 | **0.151** |
107
+ | Clotho (zero-shot) T→A R@10 | 0.460 | **0.482** |
108
+ | VGGSound audio→text R@1 | **0.213** | 0.211 |
109
+ | VGGSound audio→text R@10 | 0.625 | **0.665** |
110
+ | VGGSound text→audio R@1 | 0.213 | **0.266** |
111
+ | VGGSound text→audio R@10 | 0.645 | **0.681** |
112
+ | VGGSound audio→image R@10 (emergent) | **0.407** | 0.392 |
113
+
114
+ fusion-embedding-2 takes the majority of cells, with its largest gains in the
115
+ text→audio direction (searching audio with a text query) and on the cross-modal
116
+ audio↔text pair. fusion-embedding-1 v0.3 retains the AudioCaps and Clotho A→T R@1
117
+ cells and a ~1.5-point edge on emergent audio→image at this fine-tuned operating
118
+ point; the pre-fine-tune fusion-embedding-2 checkpoint scores 0.443 on that cell — the
119
+ project record — and may be released separately as the emergent-alignment operating
120
+ point.
121
+
122
+ </details>
123
+
124
+ <details>
125
+ <summary><b>Cross-modal retrieval — versus unified embedding models</b> (VGGSound-AV, 696 pairs, chance R@10 = 0.014)</summary>
126
+
127
+ R@10 shown as audio-side → other / other → audio-side:
128
+
129
+ | Model | audio↔image | audio↔text | text↔image |
130
+ |---|---|---|---|
131
+ | ImageBind-Huge | **0.718 / 0.720** | 0.404 / 0.348 | 0.243 / 0.282 |
132
+ | LanguageBind | 0.365 / 0.415 | 0.547 / 0.331 | 0.221 / 0.283 |
133
+ | Gemini Embedding 2 (API, 2026-07-09) | 0.312 / 0.316 | 0.379 / 0.374 | 0.273 / **0.366** |
134
+ | fusion-embedding-1-2b-preview v0.3 | 0.407 / 0.428 | 0.625 / 0.645 | **0.331** / 0.319 |
135
+ | **fusion-embedding-2-2b-preview** | 0.392 / 0.430 | **0.665 / 0.681** | **0.331** / 0.319 |
136
+
137
+ ImageBind trains directly on audio–image pairs, so that pair is its supervised
138
+ direction; its audio–text alignment is emergent. LanguageBind trains audio against
139
+ language; its audio↔image is emergent. Both fusion-embedding generations train on
140
+ audio–text only; their audio–image alignment is emergent. All models evaluated with
141
+ identical clips, frames, and scoring, using the released imagebind_huge checkpoint and
142
+ revision-pinned LanguageBind checkpoints. Gemini Embedding 2 is Google's natively
143
+ multimodal embedding API, evaluated at its documented default invocation on the date
144
+ shown; API models may change after that date. fusion-embedding-2's text↔image cells
145
+ are identical to fusion-embedding-1's by construction — text and images never touch
146
+ the trained components — and this is verified: its own readout run reproduces
147
+ fusion-embedding-1 v0.3's text→image scores to four decimal places.
148
+
149
+ </details>
150
+
151
+ <details>
152
+ <summary><b>Audio–text retrieval — versus specialist CLAP models</b></summary>
153
+
154
+ Specialist CLAP models fine-tune their text towers on audio captions — the direct
155
+ trade this architecture declines in order to keep one shared space for all four
156
+ modalities. They remain ahead on the audio-caption boards (e.g., AudioCaps T→A R@1:
157
+ M2D-CLAP 41.4 vs 29.2 here); this model family is the strongest option we measured
158
+ when one model must serve text, images, video, and audio together. See the
159
+ [fusion-embedding-1 card](https://huggingface.co/EximiusLabs/fusion-embedding-1-2b-preview)
160
+ for the full CLAP comparison tables; fusion-embedding-2 improves on fusion-embedding-1
161
+ in the text→audio direction on every board.
162
+
163
+ </details>
164
+
165
+ ## Usage
166
+
167
+ <details>
168
+ <summary>Requirements</summary>
169
+
170
+ - `fusion_embedding` package: `pip install git+https://github.com/Eximius-Labs/fusion-embedding`
171
+ - `transformers>=4.46`, `torch` (CUDA), `torchvision`, `pillow`, `soundfile`, `librosa`
172
+ - ~14 GB GPU memory at bf16
173
+
174
+ </details>
175
+
176
+ <details open>
177
+ <summary>via <code>inference.py</code> (this repository)</summary>
178
+
179
+ ```python
180
+ from inference import FusionEmbedder
181
+
182
+ fe = FusionEmbedder.from_pretrained(
183
+ "EximiusLabs/fusion-embedding-2-2b-preview",
184
+ revision="v0.1-preview", # pin a tag if you build on this model
185
+ )
186
+
187
+ a = fe.embed_audio("dog.wav") # audio file or (array, sr=...)
188
+ t = fe.embed_text("a dog barks") # uses the base's native chat template
189
+ i = fe.embed_image("dog.jpg") # PIL image or path
190
+
191
+ print((a @ t).item(), (a @ i).item()) # cosine similarities in the shared space
192
+
193
+ # Matryoshka: pass dim= for smaller embeddings (64..2048)
194
+ t_small = fe.embed_text("a dog barks", dim=256)
195
+ ```
196
+
197
+ The checkpoint contains the gated adapters and the loader refuses to run without them —
198
+ an adapter checkpoint can never be silently executed as the first-generation
199
+ architecture. All inputs use the base model's chat-template format; embedding quality
200
+ is sensitive to this formatting, so use the templates provided by `FusionEmbedder`
201
+ rather than constructing your own.
202
+
203
+ </details>
204
+
205
+ <details>
206
+ <summary>Cross-modal ranking tip</summary>
207
+
208
+ When ranking a gallery of one modality against queries of another, per-modality
209
+ mean-centering of the gallery improves cross-modal recall by roughly two points across
210
+ modality pairs:
211
+
212
+ ```python
213
+ gallery = FusionEmbedder.center(gallery_embeddings)
214
+ ```
215
+
216
+ </details>
217
+
218
+ ## License
219
+
220
+ Code is Apache-2.0 ([GitHub](https://github.com/Eximius-Labs/fusion-embedding));
221
+ model weights in this repository are **CC BY-NC 4.0** (research preview). The frozen
222
+ base and audio tower retain their original licenses.
223
+
224
+ ## Citation
225
+
226
+ ```bibtex
227
+ @software{fusion_embedding_2_2026,
228
+ title = {Fusion Embedding 2: Modality-Gated Deep Adapters for a
229
+ Unified Text, Image, Video, and Audio Embedding Space},
230
+ author = {Tonmoy, Abdul Basit},
231
+ year = {2026},
232
+ url = {https://huggingface.co/EximiusLabs/fusion-embedding-2-2b-preview}
233
+ }
234
+ ```