chanhoInspace commited on
Commit
421004b
·
1 Parent(s): b4b7ad3

Init - HiEmbed_base_onnx_v1

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ 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
+ *.onnx_data filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
38
+ *.png filter=lfs diff=lfs merge=lfs -text
39
+ *.webp filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <h1><span style="color:#475b9f;">H</span> <span style="color:#ff5733;">i</span> Embed_base_v1
3
+ <p>
4
+ <p style="font-size: 0.6em;">: Hancom InSpace Embedding Model (Base Type)</p>
5
+ </h1>
6
+ </div>
7
+
8
+
9
+
10
+ <img src="./images/InSpace.png" alt="Alt text" width="100%"/>
11
+
12
+
13
+ **Developer: Hancom InSpace**
14
+
15
+ **Supported languages: Korean, English**
16
+
17
+ **Model Release Date: September 7th, 2025**
18
+
19
+ ---
20
+
21
+ ## Information
22
+
23
+ Introducing `HiEmbed_base`, a lightweight embedding model for vector search from Hancom InSpace.
24
+ This model demonstrates outstanding performance in both Korean and English text retrieval, efficiently supporting multilingual environments. When implementing **RAG (Retrieval-Augmented Generation)** in a business setting, it offers high competitiveness in terms of supported languages, model size, speed, and accuracy, allowing for the expectation of excellent results.
25
+ Through this model release, we aim to contribute to the activation of the domestic LLM and RAG ecosystem. We hope that many people will freely test it and apply it to various services.
26
+ This model was trained with the support of GPU infrastructure from **Gyeongnam Technopark.**
27
+
28
+ ## Training
29
+
30
+ **Dataset: In-house built dataset (3 million entries)**
31
+
32
+ > `HiEmbed_base` is designed to maximize multilingual performance in both Korean and English simultaneously. We constructed an optimized dataset through iterative experiments, and its main features are as follows.
33
+ >
34
+
35
+ **Data Types**
36
+
37
+ - **KO:** QA and documents in the fields of administration, law, news, finance, and science & technology.
38
+ - **EN:** Q&A data on various topics, including web searches and community Q&A.
39
+
40
+ **Dataset Composition and Scale**
41
+
42
+ - **Structure:** Utilizes a triplet structure of query, positive, and negative.
43
+
44
+ ```json
45
+ {
46
+ "query": "question or anchor sentence",
47
+ "pos": ["positive sample sentence 1"],
48
+ "neg": ["negative sample sentence 1"]
49
+ }
50
+ ```
51
+
52
+ - **Core Processing:** Applied Hard Negative Sampling to enhance the model's discriminative ability.
53
+ - **Final Scale:** Training was conducted with a total of 3 million data entries constructed through the above process.
54
+ - **Data Split:**
55
+ - **Training/Validation Ratio:** 92% / 8%
56
+ - **Training Data Language Ratio (KO:EN):** 7:3 (Focused on strengthening Korean performance)
57
+ - **Validation Data Language Ratio (KO:EN):** 1:1 (For a balanced performance evaluation of both languages)
58
+
59
+ We have put a great deal of effort into the quality of the dataset and the balance of the training data to improve not only Korean but also multilingual support and performance, including English. After testing various ratios, we found that maintaining a 7:3 ratio during training yielded the best results.
60
+
61
+ ## Usage
62
+
63
+ ### **Install**
64
+
65
+ First, install the necessary libraries. For GPU support, ensure you have a compatible CUDA environment.
66
+
67
+ ```python
68
+ # Common libraries
69
+ pip install -U transformers onnx
70
+
71
+ # For using Optimum
72
+ # For GPU (CUDA)
73
+ pip install optimum[onnxruntime-gpu]
74
+ # For CPU only
75
+ pip install optimum[onnxruntime]
76
+ ```
77
+
78
+ **Note:** Ensure that the installed version of `onnxruntime-gpu` is compatible with your system's CUDA version. If you encounter errors, you may need to manually install a specific version of `onnxruntime-gpu` that matches your CUDA environment.
79
+
80
+ **Running the model on a GPU**
81
+
82
+ Set the provider to `CUDAExecutionProvider` and specify the GPU index for the `device`.
83
+
84
+ ```python
85
+ from optimum.pipelines import pipeline
86
+ from transformers import AutoTokenizer
87
+ from optimum.onnxruntime import ORTModelForFeatureExtraction
88
+
89
+ model_path = "/onnx/.."
90
+ sentences = [
91
+ "경상남도는 산불 피해를 입은 4개 시·군에 대해 긴급 복구비 83억원을 지원하고, 주민 설명회를 통해 주택 복구 일정과 절차를 안내할 계획이라고 밝혔다.",
92
+ "한컴인스페이스(대표 최명진)는 기술성 평가를 통과하고 프리 IPO로 125억 원을 유치했으며, 이를 기반으로 연내 코스닥 상장 절차를 본격화할 계획이라고 밝혔다."
93
+ ]
94
+
95
+ # 1. Load model with CUDAExecutionProvider
96
+ ort_model = ORTModelForFeatureExtraction.from_pretrained(
97
+ model_path,
98
+ provider="CUDAExecutionProvider",
99
+ local_files_only=True
100
+ )
101
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
102
+
103
+ # 2. Create pipeline on a specific GPU
104
+ pipe = pipeline(
105
+ task="feature-extraction",
106
+ model=ort_model,
107
+ tokenizer=tokenizer,
108
+ device="cuda:0" # Target the first GPU
109
+ )
110
+
111
+ # 3. Get embeddings
112
+ embeddings = pipe(sentences)
113
+ print("Embeddings generated on GPU.")
114
+
115
+ ```
116
+
117
+ **Running the model on multiple GPUs**
118
+
119
+ The optimum pipeline for ONNX Runtime does not automatically parallelize a single request across multiple GPUs. The common approach for multi-GPU usage is to run separate inference processes on different GPUs to handle batches in parallel.
120
+
121
+ You can achieve this by creating multiple pipelines, each assigned to a different GPU device.
122
+
123
+ ```python
124
+ from optimum.pipelines import pipeline
125
+ from transformers import AutoTokenizer
126
+ from optimum.onnxruntime import ORTModelForFeatureExtraction
127
+
128
+ model_path = "/onnx/.."
129
+
130
+ # Load the model once
131
+ ort_model = ORTModelForFeatureExtraction.from_pretrained(
132
+ model_path,
133
+ provider="CUDAExecutionProvider",
134
+ local_files_only=True
135
+ )
136
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
137
+
138
+ # Create a pipeline for each GPU
139
+ pipe_gpu0 = pipeline(task="feature-extraction", model=ort_model, tokenizer=tokenizer, device="cuda:0")
140
+ pipe_gpu1 = pipeline(task="feature-extraction", model=ort_model, tokenizer=tokenizer, device="cuda:1")
141
+
142
+ # Process different data on each pipeline (e.g., in separate threads/processes)
143
+ sentences_batch1 = ["경상남도는 산불 피해를 입은 4개 시·군에 대해 긴급 복구비 83억원을 지원하고, 주민 설명회를 통해 주택 복구 일정과 절차를 안내할 계획이라고 밝혔다."]
144
+ sentences_batch2 = ["한컴인스페이스(대표 최명진)는 기술성 평가를 통과하고 프리 IPO로 125억 원을 유치했으며, 이를 기반으로 연내 코스닥 상장 절차를 본격화할 계획이라고 밝혔다."]
145
+
146
+ embeddings1 = pipe_gpu0(sentences_batch1)
147
+ embeddings2 = pipe_gpu1(sentences_batch2)
148
+
149
+ print("Batch 1 processed on cuda:0.")
150
+ print("Batch 2 processed on cuda:1.")
151
+ ```
152
+
153
+ ## Benchmark
154
+
155
+ ### Korean Leaderboard
156
+
157
+ | Model | Korean | KLUE-STS | KLUE-TC | Ko-StrategyQA | KorSTS | AutoRAGRetrieval | XPQARetrieval |
158
+ | --- | --- | --- | --- | --- | --- | --- | --- |
159
+ | bge-m3 | 69.2 | 87.71 | 55.5 | 79.4 | 80.26 | 83.01 | 29.33 |
160
+ | BGE-m3-ko | 70.72 | 88.65 | 55.35 | 79.59 | 81.59 | 87.38 | 31.8 |
161
+ | HancomInSapce_HiEmbed_base | 71.53 | 87.98 | 61.79 | 79.92 | 81.75 | 85.62 | 32.13 |
162
+ | ibm-granite_granite-embedding-107m-multilingual | 57.95 | 73.25 | 48.23 | 70.53 | 70.6 | 68.24 | 16.83 |
163
+ | intfloat_multilingual-e5-base | 64.41 | 77.71 | 59.74 | 75.45 | 75.2 | 77.66 | 20.7 |
164
+ | intfloat_multilingual-e5-large | 68.14 | 81.58 | 62.09 | 79.82 | 79.24 | 80.66 | 25.45 |
165
+ | intfloat_multilingual-e5-large-instruct | 67.11 | 86.98 | 63.61 | 75.68 | 79.64 | 68.08 | 28.64 |
166
+ | KURE-v1 | 71.44 | 87.74 | 61.32 | 79.99 | 81.25 | 87.08 | 31.25 |
167
+ | sentence-transformers_all-MiniLM-L6-v2 | 15.67 | 22.36 | 19.84 | 1.41 | 42.3 | 6.22 | 1.9 |
168
+ | Snowflake_snowflake-arctic-embed-l-v2.0 | 68.69 | 82.55 | 58.98 | 80.46 | 73.81 | 83.86 | 32.47 |
169
+ | Snowflake_snowflake-arctic-embed-m | 20.96 | 38.52 | 19.57 | 4.57 | 39.1 | 19.19 | 4.8 |
170
+ | Snowflake_snowflake-arctic-embed-s | 17.64 | 26.17 | 20.5 | 4.89 | 33.36 | 16.91 | 4 |
171
+
172
+ ### English Leaderboard
173
+
174
+ | Model | English | Retrieval | STS | Classification | Clustering | PairClassification | Reranking |
175
+ | --- | --- | --- | --- | --- | --- | --- | --- |
176
+ | bge-m3 | 28.5 | 54.42 | 80.44 | 63.68 | 42.04 | 84.48 | 55.27 |
177
+ | BGE-m3-ko | 28.66 | 55.83 | 81.18 | 63.64 | 43.49 | 83.95 | 55.2 |
178
+ | HancomInSapce_HiEmbed_base | 29.07 | 56.22 | 81.37 | 64.45 | 44.83 | 84.8 | 56.21 |
179
+ | ibm-granite_granite-embedding-107m-multilingual | 26.3 | 44.77 | 72.55 | 54.26 | 41.82 | 80.29 | 55.59 |
180
+ | intfloat_multilingual-e5-base | 27.75 | 48.8 | 75.98 | 61.34 | 44.22 | 83.74 | 54.16 |
181
+ | intfloat_multilingual-e5-large | 28.28 | 52.29 | 78.97 | 61.66 | 45.52 | 84.32 | 54.67 |
182
+ | intfloat_multilingual-e5-large-instruct | 29.05 | 50.29 | 81 | 62.67 | 49.9 | 82.12 | 55.32 |
183
+ | KURE-v1 | 28.77 | 55.8 | 80.74 | 64.16 | 44.12 | 84.56 | 55.71 |
184
+ | sentence-transformers_all-MiniLM-L6-v2 | 27.11 | 17.54 | 51.56 | 51.86 | 46.22 | 82.37 | 58.04 |
185
+ | Snowflake_snowflake-arctic-embed-l-v2.0 | 28.75 | 57.6 | 75.68 | 60.06 | 47.58 | 83 | 57 |
186
+ | Snowflake_snowflake-arctic-embed-m | 26.58 | 22.95 | 51.23 | 49.39 | 47.65 | 75.83 | 57.88 |
187
+ | Snowflake_snowflake-arctic-embed-s | 26.87 | 21.5 | 48.07 | 52.19 | 46.79 | 80.11 | 55.93 |
188
+
189
+ ### Overall Leaderboard
190
+
191
+ | Model | Overall | Korean | English | Retrieval | STS | Classification | Clustering | PairClassification | Reranking |
192
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
193
+ | bge-m3 | 63.39 | 69.2 | 28.5 | 54.42 | 80.44 | 63.68 | 42.04 | 84.48 | 55.27 |
194
+ | BGE-m3-ko | 63.88 | 70.72 | 28.66 | 55.83 | 81.18 | 63.64 | 43.49 | 83.95 | 55.2 |
195
+ | **HancomInSapce_HiEmbed_base** | **64.65** | **71.53** | **29.07** | **56.22** | **81.37** | **64.45** | **44.83** | **84.8** | **56.21** |
196
+ | ibm-granite_granite-embedding-107m-multilingual | 58.21 | 57.95 | 26.3 | 44.77 | 72.55 | 54.26 | 41.82 | 80.29 | 55.59 |
197
+ | intfloat_multilingual-e5-base | 61.37 | 64.41 | 27.75 | 48.8 | 75.98 | 61.34 | 44.22 | 83.74 | 54.16 |
198
+ | intfloat_multilingual-e5-large | 62.91 | 68.14 | 28.28 | 52.29 | 78.97 | 61.66 | 45.52 | 84.32 | 54.67 |
199
+ | intfloat_multilingual-e5-large-instruct | 63.55 | 67.11 | 29.05 | 50.29 | 81 | 62.67 | 49.9 | 82.12 | 55.32 |
200
+ | KURE-v1 | 64.18 | 71.44 | 28.77 | 55.8 | 80.74 | 64.16 | 44.12 | 84.56 | 55.71 |
201
+ | sentence-transformers_all-MiniLM-L6-v2 | 51.27 | 15.67 | 27.11 | 17.54 | 51.56 | 51.86 | 46.22 | 82.37 | 58.04 |
202
+ | Snowflake_snowflake-arctic-embed-l-v2.0 | 63.49 | 68.69 | 28.75 | 57.6 | 75.68 | 60.06 | 47.58 | 83 | 57 |
203
+ | Snowflake_snowflake-arctic-embed-m | 50.82 | 20.96 | 26.58 | 22.95 | 51.23 | 49.39 | 47.65 | 75.83 | 57.88 |
204
+ | Snowflake_snowflake-arctic-embed-s | 50.76 | 17.64 | 26.87 | 21.5 | 48.07 | 52.19 | 46.79 | 80.11 | 55.93 |
205
+
206
+ ## About us
207
+ <img src="./images/sejong1.webp" alt="Alt text" width="100%"/>
208
+
209
+ [Contact us](https://www.inspace.co.kr/)
210
+
211
+ ## Caption
212
+
213
+ ```json
214
+ @misc{
215
+ title={HiEmbed_base_v1: Hancom InSpace Embedding Model (Base Type)},
216
+ author={JoChanho, KimHajeong},
217
+ year={2025}
218
+ }
219
+ ```
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "XLMRobertaModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": null,
8
+ "eos_token_id": 2,
9
+ "export_model_type": "transformer",
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 4096,
15
+ "layer_norm_eps": 1e-05,
16
+ "max_position_embeddings": 8194,
17
+ "model_type": "xlm-roberta",
18
+ "num_attention_heads": 16,
19
+ "num_hidden_layers": 24,
20
+ "output_past": true,
21
+ "pad_token_id": 1,
22
+ "position_embedding_type": "absolute",
23
+ "torch_dtype": "float32",
24
+ "transformers_version": "4.55.4",
25
+ "type_vocab_size": 1,
26
+ "use_cache": true,
27
+ "vocab_size": 250002
28
+ }
images/InSpace.png ADDED

Git LFS Details

  • SHA256: 3f426d788e2a43730b9e1969a73ea91068b003ef37a17c9c18683cf08770b2ac
  • Pointer size: 130 Bytes
  • Size of remote file: 11.8 kB
images/sejong1.webp ADDED

Git LFS Details

  • SHA256: 2ecad7ed68f177b0de6dad9d540d788ee7c39e57e13a77a81d952e94048d8ead
  • Pointer size: 131 Bytes
  • Size of remote file: 122 kB
model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40e0d7f048a1b94b49cbb61b7eeeb941dd17ff71f28204ac1835c4d80c749622
3
+ size 636853
model.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:76a5b5de45fd610937f030bd92b451e42fc08fc49ca86695548fea44d9730232
3
+ size 86507520
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:e4f7e21bec3fb0044ca0bb2d50eb5d4d8c596273c422baef84466d2c73748b9c
3
+ size 17083053
tokenizer_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "max_length": 2048,
51
+ "model_max_length": 8192,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "<pad>",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "</s>",
57
+ "sp_model_kwargs": {},
58
+ "stride": 0,
59
+ "tokenizer_class": "XLMRobertaTokenizerFast",
60
+ "truncation_side": "right",
61
+ "truncation_strategy": "longest_first",
62
+ "unk_token": "<unk>"
63
+ }