Tamil78 commited on
Commit
95d20e1
·
verified ·
1 Parent(s): 9f49588

Upload 6 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+
3
+ language:
4
+
5
+ * en
6
+ license: apache-2.0
7
+ library_name: onnxruntime
8
+ tags:
9
+ * sentence-transformers
10
+ * embeddings
11
+ * onnx
12
+ * int8
13
+ * retrieval
14
+ * semantic-search
15
+ * rag
16
+ * mobile
17
+ * quantization
18
+ pipeline_tag: feature-extraction
19
+
20
+ # MiniLM-L12 Fine-Tuned INT8 ONNX Embedding Model
21
+
22
+ ## Model Description
23
+
24
+ This repository contains a fine-tuned **MiniLM-L12** sentence embedding model exported to **INT8 ONNX** format for efficient deployment in mobile and edge environments.
25
+
26
+ The model is optimized for semantic similarity, dense retrieval, and Retrieval-Augmented Generation (RAG) applications where low latency and reduced memory usage are important.
27
+
28
+ ## Intended Use
29
+
30
+ This model is suitable for:
31
+
32
+ * Semantic search
33
+ * Dense document retrieval
34
+ * Retrieval-Augmented Generation (RAG)
35
+ * FAQ matching
36
+ * Question-answer retrieval
37
+ * Mobile AI assistants
38
+ * Offline embedding generation
39
+ * Local vector search
40
+
41
+ ## Model Architecture
42
+
43
+ * **Base Model:** `sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2`
44
+ * **Framework:** ONNX Runtime
45
+ * **Precision:** INT8 Quantized
46
+ * **Embedding Type:** Dense sentence embeddings
47
+
48
+ ## Fine-Tuning
49
+
50
+ The model was fine-tuned on a custom dataset of query–answer pairs to improve retrieval quality for local RAG scenarios.
51
+
52
+ The training objective was to produce embeddings where semantically related queries and answers are positioned close together in vector space.
53
+
54
+ ## Evaluation Summary
55
+
56
+ Performance was evaluated using retrieval metrics on a held-out test dataset.
57
+
58
+ | Metric | Fine-Tuned Score |
59
+ | -------------------------- | ---------------: |
60
+ | Recall@1 | 96.39% |
61
+ | Recall@5 | 99.51% |
62
+ | Mean Reciprocal Rank (MRR) | 97.69% |
63
+ | Accuracy | 96.39% |
64
+ | F1 Score | 98.16% |
65
+
66
+ These results indicate strong retrieval performance for semantic search and local RAG pipelines.
67
+
68
+ ## Files Included
69
+
70
+ * `model-int8.onnx`
71
+ * `config.json`
72
+ * `tokenizer.json`
73
+ * `tokenizer_config.json`
74
+ * `special_tokens_map.json`
75
+
76
+ ## Usage Notes
77
+
78
+ This model is intended to be executed with **ONNX Runtime**.
79
+
80
+ Typical workflow:
81
+
82
+ 1. Tokenize the input text using the accompanying tokenizer.
83
+ 2. Run inference with the ONNX model.
84
+ 3. Apply the same pooling strategy used during training.
85
+ 4. Normalize embeddings before similarity search if required by your retrieval pipeline.
86
+ 5. Compare embeddings using cosine similarity.
87
+
88
+ ## Mobile Deployment
89
+
90
+ The INT8 quantized model is designed for resource-constrained environments and can be integrated into:
91
+
92
+ * Android applications
93
+ * iOS applications
94
+ * Flutter applications
95
+ * React Native applications
96
+ * Edge AI deployments
97
+
98
+ The reduced precision helps lower memory usage and improve inference speed while maintaining strong retrieval quality.
99
+
100
+ ## Limitations
101
+
102
+ * Retrieval quality depends on the similarity between deployment data and the fine-tuning dataset.
103
+ * This model generates embeddings and is not intended to generate natural language responses.
104
+ * Performance may vary across domains and languages not represented during fine-tuning.
105
+
106
+ ## Citation
107
+
108
+ If you use this model in academic work or publications, please cite the original MiniLM architecture and the Sentence Transformers framework in addition to referencing this repository.
109
+
110
+ ## Acknowledgements
111
+
112
+ * Sentence Transformers
113
+ * MiniLM
114
+ * ONNX Runtime
115
+ * Hugging Face
config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BertModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "dtype": "float32",
9
+ "eos_token_id": 2,
10
+ "gradient_checkpointing": false,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 384,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 1536,
16
+ "layer_norm_eps": 1e-12,
17
+ "max_position_embeddings": 512,
18
+ "model_type": "bert",
19
+ "num_attention_heads": 12,
20
+ "num_hidden_layers": 12,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "transformers_version": "4.57.6",
24
+ "type_vocab_size": 2,
25
+ "use_cache": true,
26
+ "vocab_size": 250037
27
+ }
model-int8.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f75af5d65f259b29bb22d73616f5acc6297014b933ceea24c51a2aa87f4615f1
3
+ size 118049319
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:cad551d5600a84242d0973327029452a1e3672ba6313c2a3c3d69c4310e12719
3
+ size 17082987
tokenizer_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "250001": {
36
+ "content": "<mask>",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "<s>",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "<s>",
47
+ "do_lower_case": true,
48
+ "eos_token": "</s>",
49
+ "extra_special_tokens": {},
50
+ "mask_token": "<mask>",
51
+ "max_length": 128,
52
+ "model_max_length": 128,
53
+ "pad_to_multiple_of": null,
54
+ "pad_token": "<pad>",
55
+ "pad_token_type_id": 0,
56
+ "padding_side": "right",
57
+ "sep_token": "</s>",
58
+ "stride": 0,
59
+ "strip_accents": null,
60
+ "tokenize_chinese_chars": true,
61
+ "tokenizer_class": "PreTrainedTokenizerFast",
62
+ "truncation_side": "right",
63
+ "truncation_strategy": "longest_first",
64
+ "unk_token": "<unk>"
65
+ }