rizwan3d commited on
Commit
bf92763
·
verified ·
1 Parent(s): 2864a52

Publish TinyE5-L6-384 Safetensors

Browse files
README.md CHANGED
@@ -1,3 +1,100 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TinyE5-L6-384
2
+
3
+ **TinyE5-L6-384** is a compact **384-dimensional text embedding model** built from
4
+ `sentence-transformers/all-MiniLM-L6-v2` and fine-tuned for semantic search and
5
+ information retrieval using E5-style query/passage prefixes.
6
+
7
+ The model uses **mean pooling + L2 normalization** and is designed for applications
8
+ where model size, CPU latency, and deployment efficiency matter.
9
+
10
+ ## Highlights
11
+
12
+ - **6 Transformer layers**
13
+ - **384-dimensional embeddings**
14
+ - **22.7M parameters**
15
+ - Only the **last 2 Transformer layers** were fine-tuned
16
+ - **Mean pooling**
17
+ - **L2-normalized embeddings**
18
+ - E5-style `query:` and `passage:` prefixes
19
+ - FP32 and dynamically quantized **INT8 ONNX** deployment
20
+ - INT8 ONNX size: **21.8 MB**
21
+ - Measured INT8 CPU throughput: **377.7 texts/s**
22
+
23
+ ---
24
+
25
+ ## Model Architecture
26
+
27
+ | Property | Value |
28
+ |---|---|
29
+ | Base model | `sentence-transformers/all-MiniLM-L6-v2` |
30
+ | Transformer layers | 6 |
31
+ | Hidden / embedding size | 384 |
32
+ | Total parameters | 22,713,216 |
33
+ | Fine-tuned layers | Last 2 Transformer layers |
34
+ | Trainable parameters | 3,548,928 |
35
+ | Trainable percentage | 15.62% |
36
+ | Pooling | Mean pooling |
37
+ | Normalization | L2 normalization |
38
+ | Query prefix | `query: ` |
39
+ | Passage prefix | `passage: ` |
40
+ | Training max length | 128 tokens |
41
+
42
+ ---
43
+
44
+ ## Benchmark Results
45
+
46
+ ### Quality
47
+
48
+ | Model | Size | STS Spearman ↑ | SciFact Recall@10 ↑ | SciFact nDCG@10 ↑ |
49
+ | ------------------------------- | ----------: | -------------: | ------------------: | ----------------: |
50
+ | **TinyE5-L6-384 (Safetensors)** | 86.7 MB | 0.8138 | 0.7148 | 0.5701 |
51
+ | **TinyE5-L6-384 (FP32 ONNX)** | 86.2 MB | 0.8138 | 0.7148 | 0.5701 |
52
+ | **TinyE5-L6-384 (INT8 ONNX)** | **21.8 MB** | 0.8070 | 0.7259 | 0.5791 |
53
+ | E5-small-v2 | 133 MB | **0.8574** | **0.8093** | **0.6797** |
54
+
55
+ ### CPU Inference Performance
56
+
57
+ | Model | Precision | Size | Latency ↓ | Throughput ↑ |
58
+ | ---------------------- | --------- | ----------: | ---------------: | ----------------: |
59
+ | TinyE5-L6-384 ONNX | FP32 | 86.2 MB | 3.65 ms/text | 274.3 texts/s |
60
+ | **TinyE5-L6-384 ONNX** | **INT8** | **21.8 MB** | **2.65 ms/text** | **377.7 texts/s** |
61
+
62
+ ### INT8 vs FP32 ONNX
63
+
64
+ | Metric | FP32 | INT8 | Change |
65
+ | ----------------- | ------------: | ----------------: | ---------------: |
66
+ | Model size | 86.2 MB | **21.8 MB** | **~75% smaller** |
67
+ | CPU latency | 3.65 ms/text | **2.65 ms/text** | **~27% lower** |
68
+ | CPU throughput | 274.3 texts/s | **377.7 texts/s** | **~38% higher** |
69
+ | STS Spearman | **0.8138** | 0.8070 | -0.0068 |
70
+ | SciFact Recall@10 | 0.7148 | **0.7259** | +0.0111 |
71
+ | SciFact nDCG@10 | 0.5701 | **0.5791** | +0.0090 |
72
+
73
+ > **Summary:** INT8 quantization reduces TinyE5-L6-384 to just **21.8 MB** while increasing CPU throughput to approximately **378 texts/s**, with only a small change in semantic similarity performance and no degradation on the tested SciFact retrieval benchmark.
74
+
75
+
76
+ ## Docker Example
77
+ ```
78
+ services:
79
+ embedding-server:
80
+ image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.9
81
+ ports:
82
+ - "80:80"
83
+ volumes:
84
+ - ./data:/data
85
+ command:
86
+ - --model-id
87
+ - GrowBitLabs/TinyE5-L6-384-INT8
88
+ - --pooling
89
+ - mean
90
+ ```
91
+ ### variants:
92
+ ```
93
+ GrowBitLabs/TinyE5-L6-384
94
+ GrowBitLabs/TinyE5-L6-384-ONNX
95
+ GrowBitLabs/TinyE5-L6-384-INT8
96
+ ```
97
+
98
+ ## Attribution
99
+
100
+ Developed by **[GrowBit Labs](https://growbitlabs.com)**.
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "classifier_dropout": null,
7
+ "dtype": "float32",
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 384,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 1536,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 512,
16
+ "model_type": "bert",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 6,
19
+ "pad_token_id": 0,
20
+ "position_embedding_type": "absolute",
21
+ "transformers_version": "4.57.6",
22
+ "type_vocab_size": 2,
23
+ "use_cache": true,
24
+ "vocab_size": 30522
25
+ }
embedding_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "TinyE5-L6-384",
3
+ "embedding_dimension": 384,
4
+ "pooling": "mean",
5
+ "normalize": true,
6
+ "query_prefix": "query: ",
7
+ "passage_prefix": "passage: ",
8
+ "base_model": "sentence-transformers/all-MiniLM-L6-v2",
9
+ "training_dataset": "sentence-transformers/msmarco-bm25/triplet",
10
+ "train_last_n_layers": 2
11
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1230da4b753a3712e7811e9f1b9068f35097569cd1b0987960a44a14c91b52fc
3
+ size 90864192
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": {
3
+ "content": "[CLS]",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "mask_token": {
10
+ "content": "[MASK]",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "[PAD]",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "sep_token": {
24
+ "content": "[SEP]",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "[UNK]",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_basic_tokenize": true,
47
+ "do_lower_case": true,
48
+ "extra_special_tokens": {},
49
+ "mask_token": "[MASK]",
50
+ "max_length": 128,
51
+ "model_max_length": 512,
52
+ "never_split": null,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "[PAD]",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "[SEP]",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "BertTokenizer",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "[UNK]"
65
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff