NVFP4 quantization of intfloat/multilingual-e5-large-instruct
Browse files- .gitattributes +2 -0
- 1_Pooling/config.json +9 -0
- README.md +57 -0
- config.json +79 -0
- config_sentence_transformers.json +7 -0
- model.safetensors +3 -0
- modules.json +20 -0
- recipe.yaml +8 -0
- sentence_xlm-roberta_config.json +4 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +51 -0
- tokenizer.json +3 -0
- tokenizer_config.json +17 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
|
1_Pooling/config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"word_embedding_dimension": 1024,
|
| 3 |
+
"pooling_mode_cls_token": false,
|
| 4 |
+
"pooling_mode_mean_tokens": true,
|
| 5 |
+
"pooling_mode_max_tokens": false,
|
| 6 |
+
"pooling_mode_mean_sqrt_len_tokens": false,
|
| 7 |
+
"pooling_mode_weightedmean_tokens": false,
|
| 8 |
+
"pooling_mode_lasttoken": false
|
| 9 |
+
}
|
README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model:
|
| 4 |
+
- intfloat/multilingual-e5-large-instruct
|
| 5 |
+
tags: [llmcompressor, compressed-tensors, quantized, nvfp4, vllm]
|
| 6 |
+
pipeline_tag: feature-extraction
|
| 7 |
+
library_name: vllm
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# multilingual-e5-large-instruct-nvfp4
|
| 11 |
+
|
| 12 |
+
`NVFP4` quantization of [intfloat/multilingual-e5-large-instruct](https://huggingface.co/intfloat/multilingual-e5-large-instruct), produced with
|
| 13 |
+
[llm-compressor](https://github.com/vllm-project/llm-compressor) 0.13.0 and measured end to end on
|
| 14 |
+
NVIDIA H100 80 GB with vLLM 0.26.0.
|
| 15 |
+
|
| 16 |
+
Only the Linear layers of the encoder are quantized; the vocabulary, position and token-type
|
| 17 |
+
embeddings, the pooler and any classification head stay in bf16.
|
| 18 |
+
|
| 19 |
+
## Measured
|
| 20 |
+
|
| 21 |
+
| variant | size | SciFact nDCG@10 | STS-B de ρ | STS17 en-de ρ | texts/s (bs=256) |
|
| 22 |
+
|---|---|---|---|---|---|
|
| 23 |
+
| bf16 source | 1068 MiB | 0.7204 | 0.8347 | 0.8525 | 1488 |
|
| 24 |
+
| FP8 | 802 MiB | 0.7164 | 0.8349 | 0.8526 | 1511 |
|
| 25 |
+
| NVFP4 | 675 MiB | 0.7036 | 0.8371 | 0.8440 | – |
|
| 26 |
+
|
| 27 |
+
Retrieval costs 1.7 pp nDCG@10 against bf16; STS is unchanged. Size is **−37%**.
|
| 28 |
+
|
| 29 |
+
SciFact: 300 queries over 5183 documents, nDCG@10. STS-B de: mteb/stsb_multi_mt (1379 pairs).
|
| 30 |
+
STS17 en-de: mteb/sts17-crosslingual-sts (250 pairs). Reranking: 1 positive + 19 sampled negatives
|
| 31 |
+
per query. Throughput over 4096 multilingual texts through the vLLM OpenAI endpoint.
|
| 32 |
+
|
| 33 |
+
## A bug you should know about if you quantize BERT-family models yourself
|
| 34 |
+
|
| 35 |
+
The first NVFP4 build of this model scored **0.042** nDCG@10 in vLLM — random-level — while the
|
| 36 |
+
*same weights* scored 0.66 under plain transformers. The weights were fine; the checkpoint was not.
|
| 37 |
+
|
| 38 |
+
For NVFP4, every linear carries its own `weight_global_scale`. vLLM fuses query/key/value into one
|
| 39 |
+
`qkv_proj` and then collapses their scales with `weight_global_scale.max()`
|
| 40 |
+
(`compressed_tensors_w4a4_nvfp4.py:111`), silently rescaling two of the three projections. It warns
|
| 41 |
+
("the weight global scale is different for parallel layers") but continues.
|
| 42 |
+
|
| 43 |
+
llm-compressor is supposed to prevent this: `fuse_weight_observers()` links observers across fused
|
| 44 |
+
groups so they share a global scale. But its `FUSED_LAYER_NAMES`
|
| 45 |
+
(`llmcompressor/observers/helpers.py:162`) only lists decoder naming — `q_proj/k_proj/v_proj`,
|
| 46 |
+
`gate_proj/up_proj`, `w1/w3`. BERT and RoBERTa call them `query`/`key`/`value`, so the group is
|
| 47 |
+
never matched and each projection keeps its own scale.
|
| 48 |
+
|
| 49 |
+
This checkpoint was built with `("query", "key", "value")` appended to that list. Layer 0 q/k/v
|
| 50 |
+
global scales went from `{query: 5344, key: 6048, value: 7904}` to a shared `5344`, vLLM's warning
|
| 51 |
+
disappeared, and nDCG@10 went from 0.042 to 0.704.
|
| 52 |
+
|
| 53 |
+
## Serving
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
vllm serve mbehr90/multilingual-e5-large-instruct-nvfp4 --runner pooling
|
| 57 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "bfloat16",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"hidden_dropout_prob": 0.1,
|
| 13 |
+
"hidden_size": 1024,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 4096,
|
| 16 |
+
"is_decoder": false,
|
| 17 |
+
"layer_norm_eps": 1e-05,
|
| 18 |
+
"max_position_embeddings": 514,
|
| 19 |
+
"model_type": "xlm-roberta",
|
| 20 |
+
"num_attention_heads": 16,
|
| 21 |
+
"num_hidden_layers": 24,
|
| 22 |
+
"output_past": true,
|
| 23 |
+
"pad_token_id": 1,
|
| 24 |
+
"position_embedding_type": "absolute",
|
| 25 |
+
"quantization_config": {
|
| 26 |
+
"config_groups": {
|
| 27 |
+
"group_0": {
|
| 28 |
+
"format": "nvfp4-pack-quantized",
|
| 29 |
+
"input_activations": {
|
| 30 |
+
"actorder": null,
|
| 31 |
+
"block_structure": null,
|
| 32 |
+
"dynamic": "local",
|
| 33 |
+
"group_size": 16,
|
| 34 |
+
"num_bits": 4,
|
| 35 |
+
"observer": "static_minmax",
|
| 36 |
+
"observer_kwargs": {},
|
| 37 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 38 |
+
"strategy": "tensor_group",
|
| 39 |
+
"symmetric": true,
|
| 40 |
+
"type": "float",
|
| 41 |
+
"zp_dtype": null
|
| 42 |
+
},
|
| 43 |
+
"output_activations": null,
|
| 44 |
+
"targets": [
|
| 45 |
+
"Linear"
|
| 46 |
+
],
|
| 47 |
+
"weights": {
|
| 48 |
+
"actorder": null,
|
| 49 |
+
"block_structure": null,
|
| 50 |
+
"dynamic": false,
|
| 51 |
+
"group_size": 16,
|
| 52 |
+
"num_bits": 4,
|
| 53 |
+
"observer": "memoryless_minmax",
|
| 54 |
+
"observer_kwargs": {},
|
| 55 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 56 |
+
"strategy": "tensor_group",
|
| 57 |
+
"symmetric": true,
|
| 58 |
+
"type": "float",
|
| 59 |
+
"zp_dtype": null
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
},
|
| 63 |
+
"format": "nvfp4-pack-quantized",
|
| 64 |
+
"global_compression_ratio": null,
|
| 65 |
+
"ignore": [
|
| 66 |
+
"pooler.dense"
|
| 67 |
+
],
|
| 68 |
+
"kv_cache_scheme": null,
|
| 69 |
+
"quant_method": "compressed-tensors",
|
| 70 |
+
"quantization_status": "compressed",
|
| 71 |
+
"sparsity_config": {},
|
| 72 |
+
"transform_config": {},
|
| 73 |
+
"version": "0.18.0"
|
| 74 |
+
},
|
| 75 |
+
"transformers_version": "5.14.1",
|
| 76 |
+
"type_vocab_size": 1,
|
| 77 |
+
"use_cache": true,
|
| 78 |
+
"vocab_size": 250002
|
| 79 |
+
}
|
config_sentence_transformers.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"__version__": {
|
| 3 |
+
"sentence_transformers": "2.4.0.dev0",
|
| 4 |
+
"transformers": "4.37.0",
|
| 5 |
+
"pytorch": "2.1.0+cu121"
|
| 6 |
+
}
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a982290b45080297b2f0c0ca00989c9d4fbdc47b8a58a261abc50cc5820e8d77
|
| 3 |
+
size 685767200
|
modules.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"idx": 0,
|
| 4 |
+
"name": "0",
|
| 5 |
+
"path": "",
|
| 6 |
+
"type": "sentence_transformers.models.Transformer"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"idx": 1,
|
| 10 |
+
"name": "1",
|
| 11 |
+
"path": "1_Pooling",
|
| 12 |
+
"type": "sentence_transformers.models.Pooling"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"idx": 2,
|
| 16 |
+
"name": "2",
|
| 17 |
+
"path": "2_Normalize",
|
| 18 |
+
"type": "sentence_transformers.models.Normalize"
|
| 19 |
+
}
|
| 20 |
+
]
|
recipe.yaml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
default_stage:
|
| 2 |
+
default_modifiers:
|
| 3 |
+
QuantizationModifier:
|
| 4 |
+
targets: [Linear]
|
| 5 |
+
ignore: ['re:.*classifier.*', 're:.*pooler.*', 're:.*lm_head.*']
|
| 6 |
+
scheme: NVFP4
|
| 7 |
+
bypass_divisibility_checks: false
|
| 8 |
+
requires_calibration_data: true
|
sentence_xlm-roberta_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_seq_length": 512,
|
| 3 |
+
"do_lower_case": false
|
| 4 |
+
}
|
sentencepiece.bpe.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
| 3 |
+
size 5069051
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": false,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8373f9cd3d27591e1924426bcc1c8799bc5a9affc4fc857982c5d66668dd1f41
|
| 3 |
+
size 17082832
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": true,
|
| 6 |
+
"cls_token": "<s>",
|
| 7 |
+
"eos_token": "</s>",
|
| 8 |
+
"extra_special_tokens": [],
|
| 9 |
+
"is_local": true,
|
| 10 |
+
"local_files_only": true,
|
| 11 |
+
"mask_token": "<mask>",
|
| 12 |
+
"model_max_length": 512,
|
| 13 |
+
"pad_token": "<pad>",
|
| 14 |
+
"sep_token": "</s>",
|
| 15 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 16 |
+
"unk_token": "<unk>"
|
| 17 |
+
}
|