Instructions to use microsoft/bitnet-embedding-0.6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/bitnet-embedding-0.6b with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("microsoft/bitnet-embedding-0.6b", dtype="auto") - llama-cpp-python
How to use microsoft/bitnet-embedding-0.6b with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="microsoft/bitnet-embedding-0.6b", filename="bitnet-embeddings-0.6b-bf16-i2_s.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use microsoft/bitnet-embedding-0.6b with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf microsoft/bitnet-embedding-0.6b:BF16 # Run inference directly in the terminal: llama cli -hf microsoft/bitnet-embedding-0.6b:BF16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf microsoft/bitnet-embedding-0.6b:BF16 # Run inference directly in the terminal: llama cli -hf microsoft/bitnet-embedding-0.6b:BF16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf microsoft/bitnet-embedding-0.6b:BF16 # Run inference directly in the terminal: ./llama-cli -hf microsoft/bitnet-embedding-0.6b:BF16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf microsoft/bitnet-embedding-0.6b:BF16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf microsoft/bitnet-embedding-0.6b:BF16
Use Docker
docker model run hf.co/microsoft/bitnet-embedding-0.6b:BF16
- LM Studio
- Jan
- Ollama
How to use microsoft/bitnet-embedding-0.6b with Ollama:
ollama run hf.co/microsoft/bitnet-embedding-0.6b:BF16
- Unsloth Studio
How to use microsoft/bitnet-embedding-0.6b with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for microsoft/bitnet-embedding-0.6b to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for microsoft/bitnet-embedding-0.6b to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for microsoft/bitnet-embedding-0.6b to start chatting
- Atomic Chat new
- Docker Model Runner
How to use microsoft/bitnet-embedding-0.6b with Docker Model Runner:
docker model run hf.co/microsoft/bitnet-embedding-0.6b:BF16
- Lemonade
How to use microsoft/bitnet-embedding-0.6b with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull microsoft/bitnet-embedding-0.6b:BF16
Run and chat with the model
lemonade run user.bitnet-embedding-0.6b-BF16
List all available models
lemonade list
Add model card
Browse files- README.md +366 -0
- fig1_quant_per_task.png +0 -0
- mteb_v2_eval_prompts.json +133 -0
README.md
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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- az
|
| 13 |
+
- be
|
| 14 |
+
- bg
|
| 15 |
+
- bn
|
| 16 |
+
- br
|
| 17 |
+
- bs
|
| 18 |
+
- ca
|
| 19 |
+
- cs
|
| 20 |
+
- cy
|
| 21 |
+
- da
|
| 22 |
+
- de
|
| 23 |
+
- el
|
| 24 |
+
- en
|
| 25 |
+
- eo
|
| 26 |
+
- es
|
| 27 |
+
- et
|
| 28 |
+
- eu
|
| 29 |
+
- fa
|
| 30 |
+
- fi
|
| 31 |
+
- fr
|
| 32 |
+
- fy
|
| 33 |
+
- ga
|
| 34 |
+
- gd
|
| 35 |
+
- gl
|
| 36 |
+
- gu
|
| 37 |
+
- ha
|
| 38 |
+
- he
|
| 39 |
+
- hi
|
| 40 |
+
- hr
|
| 41 |
+
- hu
|
| 42 |
+
- hy
|
| 43 |
+
- id
|
| 44 |
+
- is
|
| 45 |
+
- it
|
| 46 |
+
- ja
|
| 47 |
+
- jv
|
| 48 |
+
- ka
|
| 49 |
+
- kk
|
| 50 |
+
- km
|
| 51 |
+
- kn
|
| 52 |
+
- ko
|
| 53 |
+
- ku
|
| 54 |
+
- ky
|
| 55 |
+
- la
|
| 56 |
+
- lo
|
| 57 |
+
- lt
|
| 58 |
+
- lv
|
| 59 |
+
- mg
|
| 60 |
+
- mk
|
| 61 |
+
- ml
|
| 62 |
+
- mn
|
| 63 |
+
- mr
|
| 64 |
+
- ms
|
| 65 |
+
- my
|
| 66 |
+
- ne
|
| 67 |
+
- nl
|
| 68 |
+
- 'no'
|
| 69 |
+
- om
|
| 70 |
+
- or
|
| 71 |
+
- pa
|
| 72 |
+
- pl
|
| 73 |
+
- ps
|
| 74 |
+
- pt
|
| 75 |
+
- ro
|
| 76 |
+
- ru
|
| 77 |
+
- sa
|
| 78 |
+
- sd
|
| 79 |
+
- si
|
| 80 |
+
- sk
|
| 81 |
+
- sl
|
| 82 |
+
- so
|
| 83 |
+
- sq
|
| 84 |
+
- sr
|
| 85 |
+
- su
|
| 86 |
+
- sv
|
| 87 |
+
- sw
|
| 88 |
+
- ta
|
| 89 |
+
- te
|
| 90 |
+
- th
|
| 91 |
+
- tl
|
| 92 |
+
- tr
|
| 93 |
+
- ug
|
| 94 |
+
- uk
|
| 95 |
+
- ur
|
| 96 |
+
- uz
|
| 97 |
+
- vi
|
| 98 |
+
- xh
|
| 99 |
+
- yi
|
| 100 |
+
- zh
|
| 101 |
+
license: mit
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
# BitNet Embeddings
|
| 105 |
+
|
| 106 |
+
## Model Description
|
| 107 |
+
|
| 108 |
+
BitNet-Embeddings is a family of multilingual text embedding models developed by Microsoft BitNet team.
|
| 109 |
+
The models use decoder-only architecture with last-token pooling and L2 normalization to produce dense text embeddings.
|
| 110 |
+
They can be applied to a wide range of tasks, including text retrieval, clustering, semantic similarity, classification, bitext mining, and reranking.
|
| 111 |
+
They achieve competitive performance on public benchmarks while maintaining excellent inference and storage efficiency.
|
| 112 |
+
|
| 113 |
+
- **Developed by:** BitNet Team, Microsoft Research
|
| 114 |
+
- **Model type:** BitNet b1.58 based Text Embeddings
|
| 115 |
+
- **Language(s):** Multilingual (see [Supported Languages](#supported-languages))
|
| 116 |
+
- **License:** MIT License
|
| 117 |
+
|
| 118 |
+
## Model Sources
|
| 119 |
+
|
| 120 |
+
- **Repository:** [https://github.com/microsoft/BitNet](https://github.com/microsoft/BitNet)
|
| 121 |
+
- **Paper:** [The Era of 1-bit LLMs: BitNet b1.58 and its Inference Optimization](https://arxiv.org/abs/2402.17764)
|
| 122 |
+
- **Paper:** [Multilingual E5 Text Embeddings: A Technical Report](https://arxiv.org/abs/2402.05672)
|
| 123 |
+
|
| 124 |
+
| Model | Weights | Parameters | Embedding Dimension | Max Tokens | MTEB v2 Mean |
|
| 125 |
+
|---|---|---|---|---|---|
|
| 126 |
+
| [bitnet-embeddings-270m](https://huggingface.co/microsoft/bitnet-embedding-270m) | 1.58-bit | 270M | 640 | 32,768 | 66.26 |
|
| 127 |
+
| [harrier-oss-v1-270m](https://huggingface.co/microsoft/harrier-oss-v1-270m) | bf16 | 270M | 640 | 32,768 | 66.5 |
|
| 128 |
+
| [bitnet-embeddings-0.6b](https://huggingface.co/microsoft/bitnet-embedding-0.6b) | 1.58-bit | 0.6B | 1,024 | 32,768 | 67.49 |
|
| 129 |
+
| [harrier-oss-v1-0.6b](https://huggingface.co/microsoft/harrier-oss-v1-0.6b) | bf16 | 0.6B | 1,024 | 32,768 | 69.0 |
|
| 130 |
+
|
| 131 |
+
## Model Details
|
| 132 |
+
|
| 133 |
+
- **Architecture**: Transformer-based, modified with BitLinear layers (BitNet framework).
|
| 134 |
+
- Uses Rotary Position Embeddings (RoPE).
|
| 135 |
+
- Employs SubLN (sub-layer normalization) for training stabilization under quantization.
|
| 136 |
+
- No bias terms in linear or normalization layers.
|
| 137 |
+
- **Quantization**: Native 1.58-bit weights and 8-bit activations (W1.58A8).
|
| 138 |
+
- Weights are quantized to ternary values {-1, 0, +1} using absmean quantization.
|
| 139 |
+
- Activations are quantized to 8-bit integers using absmax quantization (per-token).
|
| 140 |
+
- Trained from scratch with this quantization scheme, not post-training quantized.
|
| 141 |
+
- **Context Length**: 32,768 tokens.
|
| 142 |
+
- **Pooling Strategy**: Last-token (EOS) pooling followed by L2 normalization.
|
| 143 |
+
- **Training Pipeline**:
|
| 144 |
+
1. **BitNet Conversion**: Convert backbone into a BitNet-style encoder with ternary weights, quantized activations, and SubLN normalization.
|
| 145 |
+
2. **Continual Contrastive Pre-training**: Trained on 1B text pairs with InfoNCE loss.
|
| 146 |
+
3. **Distillation-based Supervised Fine-tuning**: Contrastive loss + similarity-distribution distillation + attention-relation distillation from FP16 teacher.
|
| 147 |
+
|
| 148 |
+
| Model | [bitnet-embedding-0.6B](https://huggingface.co/microsoft/bitnet-embedding-0.6b) | [bitnet-embedding-270M](https://huggingface.co/microsoft/bitnet-embedding-270m) |
|
| 149 |
+
|---|---|---|
|
| 150 |
+
| Backbone | Qwen3-0.6B | Gemma3 |
|
| 151 |
+
| Parameters | ~0.6B | ~270M |
|
| 152 |
+
| Embedding Dimension | 1,024 | 640 |
|
| 153 |
+
| Hidden Layers | 28 | 18 |
|
| 154 |
+
| Attention Heads (KV) | 16 (8) | 4 (1) |
|
| 155 |
+
| head_dim | 128 | 256 |
|
| 156 |
+
| Intermediate Size | 3,072 | 2,048 |
|
| 157 |
+
| Activation | SiLU | GELU |
|
| 158 |
+
| Tokenizer | Qwen3 (151,936) | Gemma (262,144) |
|
| 159 |
+
| Post-attn/FFW norms | No | Yes |
|
| 160 |
+
| Embedding scaling | No | sqrt(hidden_size) |
|
| 161 |
+
|
| 162 |
+
## MTEB v2 Evaluation Scores (16-bit embeddings)
|
| 163 |
+
|
| 164 |
+
| Model | Weights | Bitext | Classification | Clustering | Pair Class. | Reranking | Retrieval | STS | **Mean** |
|
| 165 |
+
|---|---|---|---|---|---|---|---|---|---|
|
| 166 |
+
| bitnet-embeddings-270m | 1.58-bit | 80.47 | 71.09 | 52.37 | 79.72 | 60.50 | 66.71 | 74.35 | **66.26** |
|
| 167 |
+
| bitnet-embeddings-0.6b | 1.58-bit | 81.47 | 72.65 | 53.06 | 80.47 | 62.12 | 68.33 | 74.97 | **67.49** |
|
| 168 |
+
|
| 169 |
+
## Embedding Quantization
|
| 170 |
+
|
| 171 |
+
The output embeddings can be quantized to 8, 4, 2, or even 1 bit, allowing users to flexibly trade off between storage cost and retrieval performance based on their application needs.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
|
| 175 |
+
## Training
|
| 176 |
+
|
| 177 |
+
The models are trained with contrastive learning objectives on a large-scale mixture of multilingual datasets covering diverse tasks.
|
| 178 |
+
Knowledge distillation from larger embedding models is used during training.
|
| 179 |
+
The BitNet quantization is applied to all linear layers, resulting in 1.58-bit ternary weights while keeping activations in higher precision.
|
| 180 |
+
|
| 181 |
+
## How to Use (with bitnet.cpp)
|
| 182 |
+
|
| 183 |
+
For achieving the efficiency benefits, use the dedicated C++ implementation: [bitnet.cpp](https://github.com/microsoft/BitNet).
|
| 184 |
+
|
| 185 |
+
### Build
|
| 186 |
+
|
| 187 |
+
```bash
|
| 188 |
+
git clone --recursive https://github.com/microsoft/BitNet.git
|
| 189 |
+
cd BitNet
|
| 190 |
+
cmake -S . -B build \
|
| 191 |
+
-DCMAKE_BUILD_TYPE=Release \
|
| 192 |
+
-DCMAKE_C_COMPILER=clang \
|
| 193 |
+
-DCMAKE_CXX_COMPILER=clang++ \
|
| 194 |
+
-DGGML_NATIVE=ON \
|
| 195 |
+
-DGGML_OPENMP=OFF \
|
| 196 |
+
-DLLAMA_BUILD_COMMON=ON \
|
| 197 |
+
-DLLAMA_BUILD_TOOLS=ON \
|
| 198 |
+
-DLLAMA_BUILD_EXAMPLES=ON
|
| 199 |
+
cmake --build build --target llama-embedding llama-bench -j$(nproc)
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
### Download
|
| 203 |
+
|
| 204 |
+
```bash
|
| 205 |
+
# 270M
|
| 206 |
+
hf download microsoft/bitnet-embedding-270m \
|
| 207 |
+
bitnet-embeddings-270m-bf16-i2_s.gguf \
|
| 208 |
+
--local-dir models/bitnet-embedding-270m
|
| 209 |
+
|
| 210 |
+
# 0.6B
|
| 211 |
+
hf download microsoft/bitnet-embedding-0.6b \
|
| 212 |
+
bitnet-embeddings-0.6b-bf16-i2_s.gguf \
|
| 213 |
+
--local-dir models/bitnet-embedding-0.6b
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
### Inference
|
| 217 |
+
|
| 218 |
+
```bash
|
| 219 |
+
# Choose one model:
|
| 220 |
+
MODEL=models/bitnet-embedding-270m/bitnet-embeddings-270m-bf16-i2_s.gguf
|
| 221 |
+
# MODEL=models/bitnet-embedding-0.6b/bitnet-embeddings-0.6b-bf16-i2_s.gguf
|
| 222 |
+
|
| 223 |
+
./build/bin/llama-embedding \
|
| 224 |
+
-m "$MODEL" \
|
| 225 |
+
-p "query: What is BitNet?" \
|
| 226 |
+
--embd-normalize 2 \
|
| 227 |
+
--embd-output-format array
|
| 228 |
+
```
|
| 229 |
+
|
| 230 |
+
**Example output** (L2-normalized embedding; 640 dimensions for 270M or 1,024 for 0.6B; truncated):
|
| 231 |
+
|
| 232 |
+
```json
|
| 233 |
+
[[0.0239517, 0.6826404, -0.0000000, -0.0644535, 0.0613754, 0.0473094, 0.0114330, ...]]
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
+
Please refer to the [bitnet.cpp GitHub repository](https://github.com/microsoft/BitNet) for detailed compilation steps, usage examples, and command-line options.
|
| 237 |
+
|
| 238 |
+
## Evaluation
|
| 239 |
+
|
| 240 |
+
### Embedding Quality (MMTEB eng, v2)
|
| 241 |
+
|
| 242 |
+
BitNet Embedding 0.6B was evaluated against its full-precision FP16 teacher model on the MMTEB (eng, v2) benchmark:
|
| 243 |
+
|
| 244 |
+
| Model | Cls. | Clust. | PairCls. | Rerank. | Retr. | STS | Summ. | Avg. | Speed (t/s) |
|
| 245 |
+
|-------|------|--------|----------|--------|-------|-----|-------|------|-------------|
|
| 246 |
+
| FP16 Teacher | 86.37 | 55.48 | 82.56 | 43.89 | 55.34 | 81.15 | 31.87 | 67.95 | 382.15 |
|
| 247 |
+
| **BitNet Embedding 0.6B** | **86.49** | **55.42** | **82.30** | **43.41** | **54.03** | **81.15** | **32.06** | **67.60** | **870.90** |
|
| 248 |
+
|
| 249 |
+
The model achieves **67.60** average score on MMTEB (eng, v2), only **0.35 points** below the FP16 teacher, while delivering **2.28x** higher CPU throughput.
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
### Inference Performance (CPU, 8 threads)
|
| 253 |
+
|
| 254 |
+
Performance on **Intel Xeon Platinum 8573C** with 8 threads, Clang/Clang++ (no OpenMP), GGML_NATIVE=ON. All results in tokens/second (mean +/- std over 3 runs).
|
| 255 |
+
|
| 256 |
+
> **Note on build flags:** The results below use `-DGGML_NATIVE=ON`, which auto-detects and enables the best instruction set supported by the host CPU (e.g., AVX, AVX2, AVX-VNNI, FMA, F16C). This yields optimal performance. To target only AVX2 (e.g., for portable binaries), set `-DGGML_NATIVE=OFF` and manually specify:
|
| 257 |
+
> ```
|
| 258 |
+
> -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_F16C=ON
|
| 259 |
+
> -DGGML_AVX512=OFF -DGGML_AVX512_VBMI=OFF -DGGML_AVX512_VNNI=OFF -DGGML_AVX512_BF16=OFF
|
| 260 |
+
> ```
|
| 261 |
+
|
| 262 |
+
#### bitnet-embedding-0.6B
|
| 263 |
+
|
| 264 |
+
| Test | F16.gguf (t/s) | **I2_S.gguf (t/s)** | Speedup |
|
| 265 |
+
|------|---------------|-----------------|---------|
|
| 266 |
+
| pp128 | 382.15 | **870.90** | **2.28x** |
|
| 267 |
+
| pp256 | 373.95 | **827.75** | **2.21x** |
|
| 268 |
+
| pp512 | 371.86 | **716.27** | **1.93x** |
|
| 269 |
+
| pp1024 | 341.55 | **620.58** | **1.82x** |
|
| 270 |
+
| pp2048 | 298.21 | **481.14** | **1.61x** |
|
| 271 |
+
| pp4096 | 236.76 | **336.32** | **1.42x** |
|
| 272 |
+
|
| 273 |
+
#### bitnet-embedding-270m
|
| 274 |
+
|
| 275 |
+
| Test | F16.gguf (t/s) | **I2_S.gguf (t/s)** | Speedup |
|
| 276 |
+
|------|---------------|-----------------|---------|
|
| 277 |
+
| pp128 | 1212.68 | **2019.59** | **1.67x** |
|
| 278 |
+
| pp256 | 1221.28 | **2119.50** | **1.74x** |
|
| 279 |
+
| pp512 | 1394.99 | **2181.23** | **1.56x** |
|
| 280 |
+
| pp1024 | 1265.22 | **2086.46** | **1.65x** |
|
| 281 |
+
| pp2048 | 1024.47 | **1471.60** | **1.44x** |
|
| 282 |
+
| pp4096 | 785.54 | **1033.46** | **1.32x** |
|
| 283 |
+
|
| 284 |
+
## Uses
|
| 285 |
+
|
| 286 |
+
### Direct Use
|
| 287 |
+
|
| 288 |
+
BitNet-Embeddings is designed for direct use in tasks requiring text embeddings. Its primary applications include:
|
| 289 |
+
|
| 290 |
+
- Efficient information retrieval for RAG, web search, enterprise search, and question answering applications.
|
| 291 |
+
- Text clustering, classification, and bitext mining based on dense text embeddings.
|
| 292 |
+
|
| 293 |
+
### Out-of-Scope Use
|
| 294 |
+
|
| 295 |
+
- BitNet-Embeddings does not generate any human-readable texts or other multi-modal content. Instead, it maps input texts into dense embedding vectors that are used by downstream Vector DB or classifiers.
|
| 296 |
+
- **Limited Training Data Representation:** While the training data includes a mix of multilingual datasets, it may not represent diverse linguistic, cultural, or geographical contexts for low-resource languages. As a result, performance in low-resource languages may be significantly limited.
|
| 297 |
+
- **Domain-Specific Limitations:** The training data predominantly covers general-purpose knowledge tasks. Specific or niche domains such as legal, medical, or scientific literature may not be adequately represented, and results in these areas should be interpreted with caution.
|
| 298 |
+
- **Use in High-Risk Applications:** We do not recommend using BitNet-Embeddings in commercial or real-world applications without further testing and development. As the model is being released for research purposes, additional evaluation and fine-tuning are required to ensure reliability and fairness in high-stakes scenarios.
|
| 299 |
+
|
| 300 |
+
## Supported Languages
|
| 301 |
+
|
| 302 |
+
The models are trained on multilingual data and support a wide range of languages,
|
| 303 |
+
including but not limited to: Arabic, Bulgarian, Catalan, Czech, Danish, German, Greek, English, Spanish,
|
| 304 |
+
Estonian, Persian, Finnish, French, Hebrew, Hindi, Croatian, Hungarian, Indonesian, Italian, Japanese,
|
| 305 |
+
Korean, Lithuanian, Latvian, Macedonian, Malay, Dutch, Norwegian, Polish, Portuguese, Romanian, Russian,
|
| 306 |
+
Slovak, Slovenian, Albanian, Serbian, Swedish, Thai, Turkish, Ukrainian, Urdu, Vietnamese, and Chinese.
|
| 307 |
+
|
| 308 |
+
## Evaluation
|
| 309 |
+
|
| 310 |
+
Please follow the [mteb](https://github.com/embeddings-benchmark/mteb) repository on how to reproduce our scores.
|
| 311 |
+
The evaluation prompts used for each task are also available at [mteb_v2_eval_prompts.json](mteb_v2_eval_prompts.json).
|
| 312 |
+
|
| 313 |
+
## Bias, Risks, and Limitations
|
| 314 |
+
|
| 315 |
+
- Predictions may perpetuate biases present in the training data.
|
| 316 |
+
- There is limited support for extremely low-resource languages and underrepresented domains.
|
| 317 |
+
- The model is designed for text embedding tasks (retrieval, similarity, classification) and is not suitable for text generation.
|
| 318 |
+
|
| 319 |
+
## Disclaimer
|
| 320 |
+
|
| 321 |
+
We do not recommend using BitNet Embedding 0.6B in commercial or real-world applications without further testing and development. This model is intended for research and development purposes. Please use responsibly.
|
| 322 |
+
|
| 323 |
+
## FAQ
|
| 324 |
+
|
| 325 |
+
**1. Do I need to add instructions to the query?**
|
| 326 |
+
|
| 327 |
+
Yes, this is how the model is trained, otherwise you will see a performance degradation.
|
| 328 |
+
The task definition should be a one-sentence instruction that describes the task.
|
| 329 |
+
This is a way to customize text embeddings for different scenarios through natural language instructions.
|
| 330 |
+
|
| 331 |
+
On the other hand, there is no need to add instructions to the document side.
|
| 332 |
+
|
| 333 |
+
**2. Why are my reproduced results slightly different from reported in the model card?**
|
| 334 |
+
|
| 335 |
+
Different versions of `transformers` and `pytorch` could cause negligible but non-zero performance differences.
|
| 336 |
+
|
| 337 |
+
**3. What pooling strategy does this model use?**
|
| 338 |
+
|
| 339 |
+
The model uses **last-token pooling** — the embedding of the last non-padding token is used as the sentence representation.
|
| 340 |
+
The embedding is then L2-normalized.
|
| 341 |
+
|
| 342 |
+
## Citation
|
| 343 |
+
|
| 344 |
+
```bibtex
|
| 345 |
+
@article{bitnet2024,
|
| 346 |
+
title={The Era of 1-bit LLMs: BitNet b1.58 and its Inference Optimization},
|
| 347 |
+
author={Ma, Shuming and Wang, Hongyu and others},
|
| 348 |
+
journal={arXiv preprint arXiv:2402.17764},
|
| 349 |
+
year={2024}
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
@inproceedings{wang2025bitnet,
|
| 353 |
+
title={BitNet.cpp: Efficient Edge Inference for Ternary LLMs},
|
| 354 |
+
author={Wang, Jinheng and Zhou, Hansong and Song, Ting and Cao, Shijie and Xia, Yan and Cao, Ting and Wei, Jianyu and Ma, Shuming and Wang, Hongyu and Wei, Furu},
|
| 355 |
+
booktitle={Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
|
| 356 |
+
pages={9305--9322},
|
| 357 |
+
year={2025}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
@article{wang2024multilingual,
|
| 361 |
+
title={Multilingual E5 Text Embeddings: A Technical Report},
|
| 362 |
+
author={Wang, Liang and Yang, Nan and Huang, Xiaolong and Yang, Linjun and Majumder, Rangan and Wei, Furu},
|
| 363 |
+
journal={arXiv preprint arXiv:2402.05672},
|
| 364 |
+
year={2024}
|
| 365 |
+
}
|
| 366 |
+
```
|
fig1_quant_per_task.png
ADDED
|
mteb_v2_eval_prompts.json
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"AILAStatutes": "Identifying the most relevant statutes for a given situation",
|
| 3 |
+
"AfriSentiClassification": "Given a text, categorized by sentiment into positive, negative, or neutral",
|
| 4 |
+
"AlloProfClusteringS2S.v2": "Identify the topic of document titles from Allo Prof dataset",
|
| 5 |
+
"AlloprofReranking": "Given a question, retrieve passages that answer the question",
|
| 6 |
+
"AmazonCounterfactualClassification": "Given an Amazon review, judge whether it is counterfactual.",
|
| 7 |
+
"ArXivHierarchicalClusteringP2P": "Identify the main and secondary category of Arxiv papers based on the titles and abstracts",
|
| 8 |
+
"ArXivHierarchicalClusteringS2S": "Identify the main and secondary category of Arxiv papers based on the titles",
|
| 9 |
+
"ArguAna": "Given a claim, find documents that refute the claim",
|
| 10 |
+
"ArmenianParaphrasePC": "Retrieve semantically similar text",
|
| 11 |
+
"BUCC.v2": "Retrieve parallel sentences",
|
| 12 |
+
"BelebeleRetrieval": "Retrieval the relevant passage for the given query",
|
| 13 |
+
"BibleNLPBitextMining": "Retrieve parallel sentences",
|
| 14 |
+
"BigPatentClustering.v2": "Identify the category of documents from the Big Patent dataset",
|
| 15 |
+
"BiorxivClusteringP2P.v2": "Identify the main category of Biorxiv papers based on the titles and abstracts",
|
| 16 |
+
"BornholmBitextMining": "Retrieve parallel sentences",
|
| 17 |
+
"BrazilianToxicTweetsClassification": "Classify the toxic tweets in Brazilian Portuguese into one of the six categories: LGBTQ+phobia, Xenophobia, Obscene, Insult, Misogyny and Racism.",
|
| 18 |
+
"BulgarianStoreReviewSentimentClassfication": "Classify user reviews into positive, negative or mixed sentiment",
|
| 19 |
+
"CEDRClassification": "Given a comment as query, classify expressed emotions into joy, sadness, surprise, fear, and anger",
|
| 20 |
+
"CLSClusteringP2P.v2": "Identify the main category of scholar papers based on the titles and abstracts",
|
| 21 |
+
"CSFDSKMovieReviewSentimentClassification": "Given a movie review, classify its rating on a scale from 0 to 5",
|
| 22 |
+
"CTKFactsNLI": "Retrieve semantically similar text",
|
| 23 |
+
"CataloniaTweetClassification": "Given a tweet, classify its sentiment into AGAINST, FAVOR or NEUTRAL towards Catalonia's independence.",
|
| 24 |
+
"Core17InstructionRetrieval": "Retrieve relevant passages for the given query with conditions",
|
| 25 |
+
"CovidRetrieval": "Given a question on COVID-19, retrieve news articles that answer the question",
|
| 26 |
+
"CyrillicTurkicLangClassification": "Given a text, classify its language",
|
| 27 |
+
"CzechProductReviewSentimentClassification": "Classify product reviews into positive, neutral, or negative sentiment",
|
| 28 |
+
"DBpediaClassification": "Given the following text, retrieve the appropriate DBpedia category including Company, EducationalInstitution, Artist, Athlete, OfficeHolder, MeanOfTransportation, Building, NaturalPlace, Village, Animal, Plant, Album, Film, WrittenWork.",
|
| 29 |
+
"DalajClassification": "Classify texts based on linguistic acceptability in Swedish",
|
| 30 |
+
"DiaBlaBitextMining": "Retrieve parallel sentences",
|
| 31 |
+
"EstonianValenceClassification": "Given a news article, categorized by sentiment into negatiivne, positiivne, neutraalne or vastuolulin",
|
| 32 |
+
"FaroeseSTS": "Retrieve semantically similar text",
|
| 33 |
+
"FilipinoShopeeReviewsClassification": "Given a shop review, classify its rating on a scale from 1 to 5",
|
| 34 |
+
"FinParaSTS": "Retrieve semantically similar text",
|
| 35 |
+
"FinancialPhrasebankClassification": "Given financial news, categorized by sentiment into positive, negative, or neutral",
|
| 36 |
+
"FloresBitextMining": "Retrieve parallel sentences",
|
| 37 |
+
"GermanSTSBenchmark": "Retrieve semantically similar text",
|
| 38 |
+
"GreekLegalCodeClassification": "Given a greek legal text, classify its topic",
|
| 39 |
+
"GujaratiNewsClassification": "Given a Gujarati news articles, classify ist topic",
|
| 40 |
+
"HALClusteringS2S.v2": "Identify the topic of titles from HAL",
|
| 41 |
+
"HagridRetrieval": "Given a question, retrieve relevant responses",
|
| 42 |
+
"IN22GenBitextMining": "Retrieve parallel sentences",
|
| 43 |
+
"IndicCrosslingualSTS": "Retrieve semantically similar text",
|
| 44 |
+
"IndicGenBenchFloresBitextMining": "Retrieve parallel sentences",
|
| 45 |
+
"IndicLangClassification": "Given a text, classify its language",
|
| 46 |
+
"IndonesianIdClickbaitClassification": "Given an Indonesian news headlines, classify its into clickbait or non-clickbait",
|
| 47 |
+
"IsiZuluNewsClassification": "Given a news article, classify its topic",
|
| 48 |
+
"ItaCaseholdClassification": "Given a judgments, classify its topic",
|
| 49 |
+
"JSICK": "Retrieve semantically similar text",
|
| 50 |
+
"KorHateSpeechMLClassification": "Given a Korean online news comments, classify its fine-grained hate speech classes",
|
| 51 |
+
"KorSarcasmClassification": "Given a twitter, categorized it into sarcasm or not_sarcasm",
|
| 52 |
+
"KurdishSentimentClassification": "Given a text, categorized by sentiment into positive or negative",
|
| 53 |
+
"LEMBPasskeyRetrieval": "Retrieval the relevant passage for the given query",
|
| 54 |
+
"LegalBenchCorporateLobbying": "Given a query, retrieve relevant legal bill summaries",
|
| 55 |
+
"MIRACLRetrievalHardNegatives": "Retrieve Wikipedia passages that answer the question",
|
| 56 |
+
"MLQARetrieval": "Retrieval the relevant passage for the given query",
|
| 57 |
+
"MacedonianTweetSentimentClassification": "Given a Macedonian tweet, categorized by sentiment into positive, negative, or neutral",
|
| 58 |
+
"MalteseNewsClassification": "Given a maltese new, classify its topic",
|
| 59 |
+
"MasakhaNEWSClassification": "Classify the News in the given texts into one of the seven category: politics,sports,health,business,entertainment,technology,religion ",
|
| 60 |
+
"MasakhaNEWSClusteringS2S": "Identify the topic or theme of the given news articles based on the titles",
|
| 61 |
+
"MassiveIntentClassification": "Given a user utterance as query, find the user intents",
|
| 62 |
+
"MedrxivClusteringP2P.v2": "Identify the main category of Medrxiv papers based on the titles and abstracts",
|
| 63 |
+
"MultiEURLEXMultilabelClassification": "Given a text, classify its topic",
|
| 64 |
+
"MultiHateClassification": "Given a text, categorized by sentiment into hate or non-hate",
|
| 65 |
+
"NTREXBitextMining": "Retrieve parallel sentences",
|
| 66 |
+
"NepaliNewsClassification": "Given a news article, categorized it into business, entertainment or sports",
|
| 67 |
+
"News21InstructionRetrieval": "Retrieve relevant passages for the given query with conditions",
|
| 68 |
+
"NollySentiBitextMining": "Retrieve parallel sentences",
|
| 69 |
+
"NordicLangClassification": "Given a text in a Nordic language, classify the language into one of the following categories: Danish, Swedish, Norwegian (Nynorsk), Norwegian (Bokmål), Faroese, Icelandic.",
|
| 70 |
+
"NorwegianCourtsBitextMining": "Retrieve parallel sentences",
|
| 71 |
+
"NusaParagraphEmotionClassification": "Classify the emotion into one of the following categories: fear, sadness, anger, happy, love, surprise, shame.",
|
| 72 |
+
"NusaTranslationBitextMining": "Retrieve parallel sentences",
|
| 73 |
+
"NusaX-senti": "Given a text, categorized by sentiment into positive or negative",
|
| 74 |
+
"NusaXBitextMining": "Retrieve parallel sentences",
|
| 75 |
+
"OdiaNewsClassification": "Given a news article, categorized it into business, entertainment or sports",
|
| 76 |
+
"OpusparcusPC": "Retrieve semantically similar text",
|
| 77 |
+
"PAC": "Classify Polish contract clauses into one of the following two types: \"Safe Contract Clauses\" and \"Unfair Contract Clauses\".",
|
| 78 |
+
"PawsXPairClassification": "Retrieve semantically similar text",
|
| 79 |
+
"PlscClusteringP2P.v2": "Identify the category of titles+abstracts from Library of Science",
|
| 80 |
+
"PoemSentimentClassification": "Given the following verse from a poem, classify its sentiment as negative, neutral, positive, or mixed.",
|
| 81 |
+
"PolEmo2.0-OUT": "Classify the sentiment of products and school online reviews",
|
| 82 |
+
"PpcPC": "Retrieve semantically similar text",
|
| 83 |
+
"PunjabiNewsClassification": "Given a news article, categorized it into two-classes",
|
| 84 |
+
"RTE3": "Retrieve semantically similar text",
|
| 85 |
+
"Robust04InstructionRetrieval": "Retrieve relevant passages for the given query with conditions",
|
| 86 |
+
"RomaniBibleClustering": "Identify verses from the Bible in Kalderash Romani by book.",
|
| 87 |
+
"RuBQReranking": "Given a question, retrieve Wikipedia passages that answer the question",
|
| 88 |
+
"SCIDOCS": "Given a scientific paper title, retrieve paper abstracts that are cited by the given paper",
|
| 89 |
+
"SIB200ClusteringS2S": "Identify the category of documents",
|
| 90 |
+
"SICK-R": "Retrieve semantically similar text",
|
| 91 |
+
"STS12": "Retrieve semantically related sentences",
|
| 92 |
+
"STS13": "Retrieve semantically similar text",
|
| 93 |
+
"STS14": "Retrieve semantically similar text",
|
| 94 |
+
"STS15": "Retrieve semantically similar text",
|
| 95 |
+
"STS17": "Retrieve semantically similar text",
|
| 96 |
+
"STS22.v2": "Given a document, retrieve semantically related documents",
|
| 97 |
+
"STSB": "Retrieve semantically similar text",
|
| 98 |
+
"STSBenchmark": "Retrieve semantically similar text",
|
| 99 |
+
"STSES": "Given a Spanish sentence, retrieve semantically related Spanish sentences",
|
| 100 |
+
"ScalaClassification": "Classify passages into correct or correct in Scandinavian Languages based on linguistic acceptability",
|
| 101 |
+
"SemRel24STS": "Retrieve semantically similar text",
|
| 102 |
+
"SentimentAnalysisHindi": "Given a hindi text, categorized by sentiment into positive, negative or neutral",
|
| 103 |
+
"SinhalaNewsClassification": "Given a news article, categorized it into political, business, technology, sports and Entertainment",
|
| 104 |
+
"SiswatiNewsClassification": "Identify fine-grained news categories in Siswati language.",
|
| 105 |
+
"SlovakMovieReviewSentimentClassification": "Given a movie review, categorized it into positive or negative",
|
| 106 |
+
"SpartQA": "Given the following spatial reasoning question, retrieve the right answer.",
|
| 107 |
+
"SprintDuplicateQuestions": "Find questions that have the same meaning as the input question",
|
| 108 |
+
"StackExchangeClustering.v2": "Identify the topic or theme of StackExchange posts based on the titles",
|
| 109 |
+
"StackOverflowQA": "Given a question about coding, retrieval code or passage that can solve user's question",
|
| 110 |
+
"StatcanDialogueDatasetRetrieval": "Retrieval the relevant passage for the given query",
|
| 111 |
+
"SwahiliNewsClassification": "Given a news article, classify its domain",
|
| 112 |
+
"SwednClusteringP2P": "Identify news categories in Swedish passages",
|
| 113 |
+
"SwissJudgementClassification": "Given a news article, categorized it into approval or dismissal",
|
| 114 |
+
"T2Reranking": "Given a Chinese search query, retrieve web passages that answer the question",
|
| 115 |
+
"TERRa": "Given a premise, retrieve a hypothesis that is entailed by the premise",
|
| 116 |
+
"TRECCOVID": "Given a medical query, retrieve documents that answer the query",
|
| 117 |
+
"Tatoeba": "Retrieve parallel sentences",
|
| 118 |
+
"TempReasonL1": "Given the following question about time, retrieve the correct answer.",
|
| 119 |
+
"ToxicConversationsClassification": "Classify the given comments as either toxic or not toxic",
|
| 120 |
+
"TswanaNewsClassification": "Given a news article, classify its topic",
|
| 121 |
+
"TweetTopicSingleClassification": "Gvien a twitter, classify its topic",
|
| 122 |
+
"TwitterHjerneRetrieval": "Retrieve answers to questions asked in Danish tweets",
|
| 123 |
+
"TwitterURLCorpus": "Find tweets that have the same meaning as the input tweet",
|
| 124 |
+
"VoyageMMarcoReranking": "Given a Japanese search query, retrieve web passages that answer the question",
|
| 125 |
+
"WebLINXCandidatesReranking": "Retrieval the relevant passage for the given query",
|
| 126 |
+
"WikiCitiesClustering": "Identify of Wikipedia articles of cities by country",
|
| 127 |
+
"WikiClusteringP2P.v2": "Identify the category of wiki passages",
|
| 128 |
+
"WikipediaRerankingMultilingual": "Retrieval the relevant passage for the given query",
|
| 129 |
+
"WikipediaRetrievalMultilingual": "Retrieval the relevant passage for the given query",
|
| 130 |
+
"WinoGrande": "Given the following sentence, retrieve an appropriate answer to fill in the missing underscored part.",
|
| 131 |
+
"XNLI": "Retrieve semantically similar text",
|
| 132 |
+
"indonli": "Retrieve semantically similar text"
|
| 133 |
+
}
|