hyper3-embed-deu / README.md
mnm-matin's picture
Initial model release
88b959f verified
|
Raw History Blame Contribute Delete
5.12 kB
---
license: openmdw-1.1
language:
- de
- en
library_name: sentence-transformers
pipeline_tag: sentence-similarity
base_model: google/gemma-4-E2B-it
base_model_relation: finetune
tags:
- sentence-transformers
- feature-extraction
- text-embeddings
- german
- late-interaction
- mteb
---
<div align="center">
<a href="https://hyper3labs.com">
<img src="https://hyper3labs.com/brand-assets/hyper3labs-logo-primary.svg" width="64" height="64" alt="hyper³labs logo">
</a>
<p><strong>hyper³labs</strong></p>
<h1>hyper3-embed-deu</h1>
<p>
<a href="https://hyper3labs.com">Website</a> ·
<a href="https://github.com/Hyper3Labs">GitHub</a> ·
<a href="https://huggingface.co/hyper3labs">Hugging Face</a> ·
<a href="https://discord.gg/Za3rBkTPSf">Discord</a> ·
<a href="https://x.com/hyper3labs">X</a>
</p>
</div>
**hyper3-embed-deu** is a German text embedding model from [hyper³labs](https://hyper3labs.com), fine-tuned from [Gemma 4 E2B](https://huggingface.co/google/gemma-4-E2B-it). A single bidirectional encoder produces **1,536-dimensional dense embeddings** for vector search, clustering, and classification, alongside **128-dimensional token vectors** for fused dense + MaxSim retrieval over long documents.
| Property | Value |
|---|---|
| Parameters | 4.66B total (1.91B active transformer + heads; 2.75B embeddings) |
| Dense output | 1,536 dimensions, L2-normalized, cosine similarity (4,096-token limit) |
| Fused retrieval | 0.25 dense + 0.75 MaxSim, mixing full document (4,096 tok) and best 512-token window (stride 256) |
| Weights | BF16 backbone, FP32 heads (~8.75 GiB GPU memory; ~9.43 GB download) |
| Languages | German; English in cross-lingual pairs |
## Quick start
```bash
pip install torch==2.14.0 transformers==5.17.0 sentence-transformers==6.1.0 \
huggingface_hub==1.33.0 safetensors==0.8.0 tokenizers==0.23.3
```
### Dense embeddings
Use with any vector database (Qdrant, Milvus, pgvector) or for clustering, classification, and similarity:
```python
from sentence_transformers import SentenceTransformer
model = SentenceTransformer(
"hyper3labs/hyper3-embed-deu",
revision="v1",
trust_remote_code=True,
)
queries = ["Welche Unterlagen brauche ich für die Anmeldung einer Wohnung?"]
documents = [
"Für die Anmeldung benötigen Sie einen Ausweis und die Wohnungsgeberbestätigung.",
"Die Bibliothek ist montags bis freitags geöffnet.",
]
q = model.encode_query(queries)
d = model.encode_document(documents)
print(model.similarity(q, d))
```
Retrieval queries automatically receive a search instruction; documents use no prefix. For symmetric or classification tasks, pass `prompt_name="sts"`, `"clustering"`, `"classification"`, `"pair_classification"`, or a task name from [`config.json`](config.json).
### Fused long-document retrieval
Score a candidate set using both the dense embedding and token-level MaxSim across overlapping 512-token windows:
```python
scores = model[0].model.score_multivector(queries, documents, batch_size=8)
print(scores.cpu().tolist())
```
<details>
<summary><strong>Index a corpus once, or load via Transformers AutoModel</strong></summary>
To precompute document and window representations once and score incoming queries against them:
```python
import torch
core = model[0].model
doc_dense, doc_tokens = core.encode_with_tokens(documents)
windows, owner = core.document_windows(documents)
win_dense, win_tokens = core.encode_with_tokens(windows, max_length=576)
owner_t = torch.tensor(owner)
q_dense, q_tokens = core.encode_with_tokens(queries, prompt_name="query", max_length=1024)
scores = core.fuse_scores(
dense_full=q_dense @ doc_dense.T,
dense_window=core.best_per_document(q_dense @ win_dense.T, owner_t, len(documents)),
maxsim_full=core.maxsim_scores(q_tokens, doc_tokens),
maxsim_window=core.best_per_document(core.maxsim_scores(q_tokens, win_tokens), owner_t, len(documents)),
)
```
To load directly through `transformers` instead of Sentence Transformers:
```python
import torch
from transformers import AutoModel
core = AutoModel.from_pretrained("hyper3labs/hyper3-embed-deu", revision="v1", trust_remote_code=True)
core.to("cuda" if torch.cuda.is_available() else "cpu")
embeddings = core.encode(queries, prompt_name="query")
```
On CUDA hosts, the backbone loads in BF16 (~8.75 GiB); on CPU-only hosts it defaults to FP32 (~17.4 GiB). To set precision explicitly, pass `model_kwargs={"dtype": torch.bfloat16}` (do not call `.half()`, as pooling and MaxSim heads run in FP32).
</details>
## License
Weights, code, and documentation are released under [OpenMDW-1.1](LICENSE) (which includes the Apache-2.0 license for the Gemma 4 base model).
## Citation
```bibtex
@misc{hyper3embeddeu2026,
title = {hyper3-embed-deu: German Text Embeddings from Gemma 4},
author = {hyper3labs},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/hyper3labs/hyper3-embed-deu}
}
```
[Website](https://hyper3labs.com) · [Discord](https://discord.gg/Za3rBkTPSf) · [GitHub](https://github.com/Hyper3Labs)