File size: 21,817 Bytes
7695943
3fca9af
7695943
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fca9af
7695943
bc91024
 
9c2f514
7ba88e4
bc91024
 
8eaffae
7ba88e4
8eaffae
3fca9af
7ba88e4
3fca9af
7ba88e4
3fca9af
bc91024
 
 
 
8eaffae
 
293fa8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8eaffae
3fca9af
bc91024
3fca9af
7ba88e4
 
3fca9af
7ba88e4
 
 
 
 
 
3fca9af
bc91024
3fca9af
7ba88e4
3fca9af
b7dc9d7
7ba88e4
6c50946
 
3fca9af
7ba88e4
3fca9af
6c50946
 
3fca9af
b7dc9d7
 
 
 
6c50946
 
7ba88e4
 
 
 
3fca9af
6c50946
 
3fca9af
7ba88e4
3fca9af
7ba88e4
 
 
 
 
 
 
 
3fca9af
bc91024
3fca9af
7ba88e4
3fca9af
7ba88e4
 
3fca9af
7ba88e4
3fca9af
7ba88e4
 
35d95c0
6c50946
 
 
3fca9af
7ba88e4
3fca9af
7ba88e4
 
35d95c0
7ba88e4
b7dc9d7
05b268f
b7dc9d7
6c50946
 
 
3fca9af
7ba88e4
3fca9af
7ba88e4
 
35d95c0
7ba88e4
b7dc9d7
 
3fca9af
7ba88e4
3fca9af
7ba88e4
 
3fca9af
bc91024
 
7ba88e4
bc91024
 
 
 
 
 
 
 
3fca9af
7ba88e4
3fca9af
bc91024
7ba88e4
b7dc9d7
 
 
 
 
 
 
 
 
3fca9af
bc91024
3fca9af
7ba88e4
3fca9af
7ba88e4
 
3fca9af
7ba88e4
3fca9af
b7dc9d7
 
3fca9af
7ba88e4
bc91024
 
3fca9af
 
 
 
bc91024
 
 
 
 
3fca9af
7ba88e4
 
3fca9af
000f1d8
 
6c50946
 
000f1d8
 
6c50946
7ba88e4
000f1d8
6c50946
7ba88e4
b7dc9d7
 
6c50946
 
 
 
 
 
 
 
 
 
 
 
 
 
b7dc9d7
3fca9af
bc91024
3fca9af
bc91024
7ba88e4
 
 
3fca9af
bc91024
3fca9af
7ba88e4
3fca9af
7ba88e4
3fca9af
7ba88e4
3fca9af
7ba88e4
 
b7dc9d7
7ba88e4
000f1d8
bc91024
 
 
 
6c50946
000f1d8
b7dc9d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
---
language:
- ko
- lzh
license: cc-by-sa-4.0
library_name: transformers
tags:
- fill-mask
- text-generation
- sillok
- history
- korean-history
- classical-chinese
pipeline_tag: fill-mask
co2_eq_emissions:
  emissions: 1.1662 # kg, 1-epoch sample run extrapolated to 10 epochs.
  source: "codecarbon"
  training_type: "from_scratch"
  geographical_location: "South Korea, Seoul"
  hardware_used: "1 x NVIDIA A100-PCIE-40GB"
---
datasets:
- "VERITABLE RECORDS of the JOSEON DYNASTY"


# **SillokBert: ์กฐ์„ ์™•์กฐ์‹ค๋ก ํŠนํ™” ์–ธ์–ด ๋ชจ๋ธ**

# **SillokBert: A Language Model Specialized for Veritable Records of the Joseon Dynasty**

## **๋ชจ๋ธ ์„ค๋ช… (Model Description)**

**SillokBert**์€ `bert-base-multilingual-cased` ๋ชจ๋ธ์„ ๊ธฐ๋ฐ˜์œผ๋กœ, ๊ตญ์‚ฌํŽธ์ฐฌ์œ„์›ํšŒ์—์„œ ์ œ๊ณตํ•˜๋Š” ์กฐ์„ ์™•์กฐ์‹ค๋ก ์›๋ฌธ(ํ•œ๋ฌธ) ์ „์ฒด ๋ฐ์ดํ„ฐ์…‹์— Masked Language Modeling(MLM) ํƒœ์Šคํฌ๋กœ ์ถ”๊ฐ€ ํŒŒ์ธํŠœ๋‹(further fine-tuned)ํ•œ ์–ธ์–ด ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค. ๋ณธ ๋ชจ๋ธ์€ ์กฐ์„ ์™•์กฐ์‹ค๋ก์— ๋“ฑ์žฅํ•˜๋Š” ๊ณ ์œ ํ•œ ์–ดํœ˜(์ธ๋ช…, ์ง€๋ช…, ๊ด€์ง ๋“ฑ), ๋ฌธ์–ด์ฒด ์Šคํƒ€์ผ, ๊ทธ๋ฆฌ๊ณ  ๋ณต์žกํ•œ ๋ฌธ๋งฅ ๊ตฌ์กฐ๋ฅผ ๊นŠ์ด ์žˆ๊ฒŒ ํ•™์Šตํ•˜๋„๋ก ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์‹ค๋ก ์›๋ฌธ์˜ ๋นˆ์นธ ์ถ”๋ก , ์›๋ฌธ ๊ต์—ด ๋ฐ ๋ณต์›, ์˜๋ฏธ์  ๊ฒ€์ƒ‰, ํ…์ŠคํŠธ ํŠน์ง• ์ถ”์ถœ ๋“ฑ ๋‹ค์–‘ํ•œ ์—ญ์‚ฌํ•™ ๋ฐ ๋””์ง€ํ„ธ ์ธ๋ฌธํ•™ ์—ฐ๊ตฌ์˜ ๊ธฐ๋ฐ˜(foundational) ๋ชจ๋ธ๋กœ ํ™œ์šฉ๋  ์ˆ˜ ์žˆ๋Š” ์ž ์žฌ๋ ฅ์„ ๊ฐ€์ง‘๋‹ˆ๋‹ค.

**SillokBert** is a language model based on `bert-base-multilingual-cased`, further fine-tuned on the entire Veritable Records of the Joseon Dynasty (Annals of the Joseon Dynasty) original text (Classical Chinese) dataset provided by the National Institute of Korean History using the Masked Language Modeling (MLM) task. This model is designed to deeply learn the unique vocabulary (personal names, place names, official titles, etc.), literary style, and complex contextual structures found in the Annals. It holds the potential to be utilized as a foundational model for various historical and digital humanities research tasks, such as fill-in-the-blank inference, text correction and restoration, semantic search, and feature extraction from the original Sillok texts.

๋ณธ ๋ชจ๋ธ์€ ํ•œ๊ตญํ•™์ค‘์•™์—ฐ๊ตฌ์› ๋””์ง€ํ„ธ์ธ๋ฌธํ•™์—ฐ๊ตฌ์†Œ์˜ "ํ•œ๊ตญ ๊ณ ์ „ ๋ฌธํ—Œ ๊ธฐ๋ฐ˜ ์ง€๋Šฅํ˜• ํ•œ๊ตญํ•™ ์–ธ์–ด๋ชจ๋ธ ๊ฐœ๋ฐœ" ํ”„๋กœ์ ํŠธ์˜ ์ผํ™˜์œผ๋กœ ๊ฐœ๋ฐœ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ณธ ๋ชจ๋ธ์˜ ํ•™์Šต ํ™˜๊ฒฝ์€ ๊ณผํ•™๊ธฐ์ˆ ์ •๋ณดํ†ต์‹ ๋ถ€ ์ •๋ณดํ†ต์‹ ์‚ฐ์—…์ง„ํฅ์›์˜ 2025๋…„ ๊ณ ์„ฑ๋Šฅ์ปดํ“จํŒ…์ง€์›(GPU) ์‚ฌ์—…(G2025-0450)์˜ ์ง€์›์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค. ์—ฐ๊ตฌ์— ํ•„์ˆ˜์ ์ธ ๊ณ ์„ฑ๋Šฅ ์ปดํ“จํŒ… ํ™˜๊ฒฝ์„ ์ง€์›ํ•ด์ฃผ์…”์„œ ์ง„์‹ฌ์œผ๋กœ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค.

This model was developed as part of the "Development of an Intelligent Korean Studies Language Model based on Classical Korean Texts" project at the Digital Humanities Research Institute, The Academy of Korean Studies. The training environment for this model was supported by the 2025 High-Performance Computing Support (GPU) Program of the National IT Industry Promotion Agency (NIPA) (No. G2025-0450). We sincerely appreciate the support for providing the high-performance computing environment essential for our research.

## **ํ™œ์šฉ ๋ฐฉ์•ˆ (Intended Use)**

#### **์ง์ ‘ ์‚ฌ์šฉ (Direct Use)**

`fill-mask` ํŒŒ์ดํ”„๋ผ์ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์˜ ์–ธ์–ด์  ์ดํ•ด๋„๋ฅผ ์ง์ ‘ ํ…Œ์ŠคํŠธํ•˜๊ฑฐ๋‚˜, ํŠน์ • ๋ฌธ๋งฅ์—์„œ ๊ฐ€์žฅ ํ™•๋ฅ ์ด ๋†’์€ ๋‹จ์–ด๋ฅผ ์˜ˆ์ธกํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
You can use the `fill-mask` pipeline to directly test the model's linguistic understanding or to predict the most probable words in a specific context.  
```
# !pip install transformers torch  # ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์„ค์น˜๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ฃผ์„์„ ํ•ด์ œํ•˜๊ณ  ์‹คํ–‰ํ•˜์„ธ์š”.

# transformers ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ํ•„์š”ํ•œ pipeline๊ณผ AutoTokenizer๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.
from transformers import pipeline, AutoTokenizer

# ํ—ˆ๊น…ํŽ˜์ด์Šค Hub์— ์žˆ๋Š” ๋ชจ๋ธ๊ณผ ํ† ํฌ๋‚˜์ด์ €์˜ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
model_path = "ddokbaro/SillokBert"

# ์ง€์ •๋œ ๊ฒฝ๋กœ์—์„œ ํ† ํฌ๋‚˜์ด์ €๋ฅผ ๋ถˆ๋Ÿฌ์˜ต๋‹ˆ๋‹ค.
tokenizer = AutoTokenizer.from_pretrained(model_path)

# "fill-mask" ์ž‘์—…์„ ์œ„ํ•œ ํŒŒ์ดํ”„๋ผ์ธ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
# ์ด ๋•Œ, ๋ฏธ๋ฆฌ ๋ถˆ๋Ÿฌ์˜จ ๋ชจ๋ธ ๊ฒฝ๋กœ์™€ ํ† ํฌ๋‚˜์ด์ €๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
fill_mask = pipeline("fill-mask", model=model_path, tokenizer=tokenizer)

# ์˜ˆ์‹œ ๋ฌธ์žฅ (์กฐ์„ ์™•์กฐ์‹ค๋ก ์Šคํƒ€์ผ)
# ไธŠๆ›ฐ, "ไบˆ ็„ถ ็„ก [MASK] ไน‹ๆ„." (์ž„๊ธˆ๊ป˜์„œ ๋ง์”€ํ•˜์‹œ๊ธธ, '๋‚ด๊ฒŒ๋Š” [MASK]ํ•  ๋œป์ด ์—†๋‹ค.')
text = "ไธŠๆ›ฐ, \"ไบˆ ็„ถ ็„ก [MASK] ไน‹ๆ„.\""

# ํŒŒ์ดํ”„๋ผ์ธ์„ ์‹คํ–‰ํ•˜์—ฌ ๋นˆ์นธ([MASK])์— ๋“ค์–ด๊ฐˆ ๋‹จ์–ด๋ฅผ ์ถ”๋ก ํ•ฉ๋‹ˆ๋‹ค.
results = fill_mask(text)

# ๊ฒฐ๊ณผ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
print(f"'{text}' ๋ฌธ์žฅ์— ๋Œ€ํ•œ ์ถ”๋ก  ๊ฒฐ๊ณผ:")
for item in results:
    # 'sequence'๋Š” [MASK]๊ฐ€ ์ฑ„์›Œ์ง„ ์ „์ฒด ๋ฌธ์žฅ, 'score'๋Š” ํ•ด๋‹น ์˜ˆ์ธก์˜ ์‹ ๋ขฐ๋„ ์ ์ˆ˜์ž…๋‹ˆ๋‹ค.
    print(f"  - ๋ฌธ์žฅ: {item['sequence']}, ์ ์ˆ˜: {item['score']:.4f}, ํ† ํฐ: {item['token_str']}")
```

#### **๋‹ค์šด์ŠคํŠธ๋ฆผ ํƒœ์Šคํฌ ํ™œ์šฉ (Downstream Use)**

๋ณธ ๋ชจ๋ธ์€ ์กฐ์„ ์™•์กฐ์‹ค๋ก ํ…์ŠคํŠธ๋ฅผ ๋Œ€์ƒ์œผ๋กœ ํ•˜๋Š” ๋‹ค์–‘ํ•œ ๋‹ค์šด์ŠคํŠธ๋ฆผ ํƒœ์Šคํฌ์˜ ์‚ฌ์ „ํ•™์Šต ๋ชจ๋ธ๋กœ ํ™œ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
This model can be used as a pre-trained model for various downstream tasks targeting the text of Veritable Records of the Joseon Dynasty.

* ๋ฌธ์„œ ๋ถ„๋ฅ˜ (Text Classification): ํŠน์ • ์ฃผ์ œ(์˜ˆ: ๊ตฐ์‚ฌ, ์™ธ๊ต, ์˜๋ก€)์— ๋Œ€ํ•œ ๊ธฐ์‚ฌ ๋ถ„๋ฅ˜.  
  Classification of articles on specific topics (e.g., military, diplomacy, rituals).  
* ๊ฐœ์ฒด๋ช… ์ธ์‹ (Named Entity Recognition): ์ธ๋ช…, ์ง€๋ช…, ๊ด€์ง๋ช… ๋“ฑ ๊ณ ์œ ๋ช…์‚ฌ ์ž๋™ ์ถ”์ถœ.  
  Automatic extraction of named entities such as personal names, place names, and official titles.  
* ์˜๋ฏธ ๊ฒ€์ƒ‰ (Semantic Search): ํ‚ค์›Œ๋“œ ๋งค์นญ์„ ๋„˜์–ด ์˜๋ฏธ์ ์œผ๋กœ ์œ ์‚ฌํ•œ ๊ธฐ์‚ฌ ๊ฒ€์ƒ‰.  
  Semantic search for articles that are contextually similar, going beyond simple keyword matching.

## **ํ•™์Šต ๋ฐ์ดํ„ฐ (Training Data)**

#### **๋ฐ์ดํ„ฐ ์ถœ์ฒ˜ ๋ฐ ์ˆ˜์ง‘ (Data Source and Collection)**

* ์›์ฒœ ๋ฐ์ดํ„ฐ (Source Data): ๊ณต๊ณต๋ฐ์ดํ„ฐํฌํ„ธ \- ๊ต์œก๋ถ€ ๊ตญ์‚ฌํŽธ์ฐฌ์œ„์›ํšŒ\_์กฐ์„ ์™•์กฐ์‹ค๋ก ์ •๋ณด\_์‹ค๋ก์›๋ฌธ https://www.data.go.kr/data/15053647/fileData.do. ์—ฐ๊ตฌ์˜ ํ† ๋Œ€๊ฐ€ ๋œ ๊ท€์ค‘ํ•œ ์ž๋ฃŒ๋ฅผ ์ œ๊ณตํ•ด์ฃผ์‹  ๊ต์œก๋ถ€ ๊ตญ์‚ฌํŽธ์ฐฌ์œ„์›ํšŒ ์ธก์— ๊ฐ์‚ฌ์˜ ๋ง์”€์„ ์ „ํ•œ๋‹ค.  
  We express our gratitude to the National Institute of Korean History (Ministry of Education) for providing the invaluable data that formed the foundation of this research.  
* ๋ฐ์ดํ„ฐ ๋ฒ„์ „ ๋ฐ ์žฌํ˜„์„ฑ (Data Version and Reproducibility): ๋ณธ ์—ฐ๊ตฌ๋Š” 2022๋…„ 11์›” 03์ผ์— ๋“ฑ๋ก๋œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค. ๊ณต์‹ ๋ฐฐํฌ์ฒ˜์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์—…๋ฐ์ดํŠธ๋  ์ˆ˜ ์žˆ์–ด, ์™„๋ฒฝํ•œ ์žฌํ˜„์„ฑ์„ ๋ณด์žฅํ•˜๊ธฐ ์œ„ํ•ด ํ•™์Šต์— ์‚ฌ์šฉ๋œ ์›๋ณธ XML ํŒŒ์ผ ์ „์ฒด๋ฅผ `raw_data/sillok_raw_xml.zip` ํŒŒ์ผ๋กœ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ, ์ฆ‰์‹œ ํ™œ์šฉ ๊ฐ€๋Šฅํ•œ ์ „์ฒ˜๋ฆฌ ์™„๋ฃŒ ํ…์ŠคํŠธ ํŒŒ์ผ(`train.txt`, `validation.txt`, `test.txt`)์€ `preprocessed_data/` ํด๋”์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
  This research is based on the data registered on November 3, 2022\. As the data from the official distributor may be updated, we provide the entire original XML files used for training as `raw_data/sillok_raw_xml.zip` in this repository to ensure perfect reproducibility. Additionally, the preprocessed text files (`train.txt`, `validation.txt`, `test.txt`) ready for immediate use can be found in the `preprocessed_data/` folder.

#### **๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ (Data Preprocessing)**

`raw_data`์˜ ์›๋ณธ XML์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ณผ์ •์„ ๊ฑฐ์ณ `preprocessed_data`๋กœ ๊ฐ€๊ณต๋˜์—ˆ์Šต๋‹ˆ๋‹ค.  
The original XML from `raw_data` was processed into `preprocessed_data` through the following steps:

1. ๊ตฌ์กฐ ๋ถ„์„ (Structural Parsing): `lxml` ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ XML ํŒŒ์ผ์„ ํŒŒ์‹ฑ.  
   Parsed XML files using the `lxml` library.  
2. ๋ณธ๋ฌธ ์ถ”์ถœ (Text Extraction): ๊ฐ ๊ธฐ์‚ฌ(`level5`) ๋‚ด์˜ `paragraph` ํƒœ๊ทธ์—์„œ ํ…์ŠคํŠธ๋ฅผ ์ถ”์ถœ.  
   Extracted text from the `paragraph` tags within each article (`level5`).  
3. ์ฃผ์„ ์ œ์™ธ (Annotation Exclusion): ์›๋ฌธ์˜ ์˜๋ฏธ๋ฅผ ํ•ด์น˜์ง€ ์•Š์œผ๋ฉด์„œ๋„ ๋ชจ๋ธ ํ•™์Šต์— ๋ฐฉํ•ด๊ฐ€ ๋  ์ˆ˜ ์žˆ๋Š” ํ˜„๋Œ€์ธ์˜ ์ฃผ์„(`<annotation\>`) ๋‚ด์šฉ์€ ์ถ”์ถœ ๊ณผ์ •์—์„œ ๋ชจ๋‘ ์ œ์™ธํ•˜์—ฌ, ์ˆœ์ˆ˜ํ•œ ์›์ „ ํ…์ŠคํŠธ๋งŒ์„ ํ•™์Šต ๋Œ€์ƒ์œผ๋กœ ์‚ผ์•˜์Šต๋‹ˆ๋‹ค.  
   To ensure the model learned purely from the original source text, modern annotations (`<annotation\>`) that could interfere with learning while not affecting the meaning of the original text were excluded during extraction.  
4. ์ •์ œ (Normalization): ์ถ”์ถœ๋œ ํ…์ŠคํŠธ์—์„œ ๋ถˆํ•„์š”ํ•œ ๊ณต๋ฐฑ๊ณผ ์ค„๋ฐ”๊ฟˆ ๋ฌธ์ž๋ฅผ ์ •๊ทœํ™”.  
   Normalized unnecessary whitespace and line breaks in the extracted text.  
5. ํ•„ํ„ฐ๋ง (Filtering): ์˜๋ฏธ ์žˆ๋Š” ๋ฌธ๋งฅ ํ•™์Šต์„ ์œ„ํ•ด ์ตœ์†Œ ๊ธธ์ด 10์ž ๋ฏธ๋งŒ์˜ ๊ธฐ์‚ฌ๋Š” ์ œ์™ธ.  
   Filtered out articles shorter than 10 characters to focus on meaningful contextual learning.

์ƒ์„ธํ•œ ์ „์ฒ˜๋ฆฌ ๋กœ์ง๊ณผ ์ „์ฒด ์ฝ”๋“œ๋Š” ๋ณธ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์— ํ•จ๊ป˜ ์—…๋กœ๋“œ๋œ `scripts/prepare_data.py` ์Šคํฌ๋ฆฝํŠธ์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
The detailed preprocessing logic and the complete code can be found in the `scripts/prepare_data.py` script uploaded to this repository.

#### **๋ฐ์ดํ„ฐ ํ†ต๊ณ„ (Data Statistics)**

* **์ „์ฒด ๊ธฐ์‚ฌ ์ˆ˜ (Total Articles)**: 402,339  
* **๋ฐ์ดํ„ฐ** ๋ถ„ํ•  **(Data Split \- 90/5/5)**:  
  * **ํ•™์Šต (Train)**: 362,107 articles  
  * **๊ฒ€์ฆ (Validation)**: 20,116 articles  
  * **ํ…Œ์ŠคํŠธ (Test)**: 20,116 articles  
* **์ถ”๊ฐ€ ์ •๋ณด (Additional Information)**:  
  * **์ด ๊ธ€์ž ์ˆ˜ (Total Characters)**: 66,322,312  
  * **์–ดํœ˜์ง‘ ํฌ๊ธฐ (Vocabulary Size)**: 119,547

## **ํ•™์Šต ์ ˆ์ฐจ (Training Procedure)**

#### **ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ ์ตœ์ ํ™” (Hyperparameter Optimization \- HPO)**

๋ณธ ๋ชจ๋ธ์€ ํ•œ์ •๋œ ์—ฐ๊ตฌ ์ž์› ๋‚ด์—์„œ ์ตœ์ ์˜ ์„ฑ๋Šฅ์„ ๋„์ถœํ•˜๊ธฐ ์œ„ํ•ด, ๋‹จ๊ณ„์  ํƒ์ƒ‰(Staged Exploration) HPO ์ „๋žต์„ ์ฑ„ํƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ๋„“์€ ํƒ์ƒ‰ ๊ณต๊ฐ„์—์„œ ์ ์ง„์ ์œผ๋กœ ์œ ๋งํ•œ ํ›„๋ณด๊ตฐ์„ ์ขํ˜€๋‚˜๊ฐ€๋Š” ๊น”๋•Œ๊ธฐ(Funnel) ๋ฐฉ์‹์˜ ์ ‘๊ทผ๋ฒ•์œผ๋กœ, ์—ฐ๊ตฌ์˜ ํšจ์œจ์„ฑ๊ณผ ์‹ ๋ขฐ๋„๋ฅผ ๋™์‹œ์— ํ™•๋ณดํ•˜๊ธฐ ์œ„ํ•ด ์„ค๊ณ„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.  
To derive optimal performance within limited research resources, this model adopted a Staged Exploration HPO strategy. This is a funnel-like approach that progressively narrows down promising candidates from a wide search space, designed to ensure both efficiency and reliability in the research.

##### **1๋‹จ๊ณ„: ๊ด‘๋ฒ”์œ„ ํƒ์ƒ‰ (Stage 1: Broad Exploration)**

* ๋ชฉํ‘œ (Objective): ๋„“์€ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ ๊ณต๊ฐ„์—์„œ ์„ฑ๋Šฅ์ด ํ˜„์ €ํžˆ ๋‚ฎ์€ ์˜์—ญ์„ ๋น ๋ฅด๊ฒŒ ์‹๋ณ„ํ•˜๊ณ  ๋ฐฐ์ œ.  
  To quickly identify and exclude underperforming regions from a wide hyperparameter space.  
* ๋ฐฉ๋ฒ• (Method): ์ „์ฒด ํ•™์Šต ๋ฐ์ดํ„ฐ์˜ 10%๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ Trial์„ ์ตœ๋Œ€ 20 ์Šคํ…์ด๋ผ๋Š” ๋งค์šฐ ์งง์€ ์‹œ๊ฐ„ ๋™์•ˆ๋งŒ ํ•™์Šต. ์ด ๋‹จ๊ณ„์—์„œ๋Š” `learning_rate`(`1e-6` \~ `1e-3`), ์œ ํšจ ๋ฐฐ์น˜ ํฌ๊ธฐ(16 \~ 512), `optimizer` ์ข…๋ฅ˜(`AdamW`, `Adafactor`) ๋“ฑ ๋ชจ๋ธ ์„ฑ๋Šฅ์— ์˜ํ–ฅ์„ ๋ฏธ์น˜๋Š” ์ฃผ์š” ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ์— ๋Œ€ํ•ด ๊ฐ€๋Šฅํ•œ ๋„“์€ ํƒ์ƒ‰ ๋ฒ”์œ„๋ฅผ ์„ค์ •ํ•˜์—ฌ ์ž ์žฌ์  ์„ฑ๋Šฅ ์˜์—ญ์„ ํฌ๊ด„์ ์œผ๋กœ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.  
  Each trial was trained for a very short period (max 20 steps) using only 10% of the total training data. A wide search range was set for key hyperparameters influencing model performance, such as `learning_rate` (`1e-6` to `1e-3`), effective batch size (16 to 512), and `optimizer` type (`AdamW`, `Adafactor`), to comprehensively identify potential performance areas.  
* ๊ฒฐ๊ณผ (Result): ์ปดํ“จํŒ… ์ž์› ๋‚ญ๋น„๋ฅผ ์ตœ์†Œํ™”ํ•˜๋ฉฐ, ํ›„์† ํƒ์ƒ‰์„ ์ง‘์ค‘ํ•  ์œ ๋งํ•œ ํŒŒ๋ผ๋ฏธํ„ฐ ์˜์—ญ์— ๋Œ€ํ•œ ์ดˆ๊ธฐ ํ†ต์ฐฐ ํ™•๋ณด (์ตœ์ € `eval_loss` \~3.83).  
  Minimized computational waste and gained initial insights into promising parameter regions for subsequent focused searches (lowest `eval_loss` \~3.83).

##### **2๋‹จ๊ณ„: ์‹ฌ์ธต ํƒ์ƒ‰ (Stage 2: Focused Search)**

* ๋ชฉํ‘œ (Objective): 1๋‹จ๊ณ„์—์„œ ์‹๋ณ„๋œ ์œ ๋ง ์˜์—ญ์„ ๋Œ€์ƒ์œผ๋กœ, ๋” ๋งŽ์€ ๋ฐ์ดํ„ฐ์™€ ํ•™์Šต๋Ÿ‰์„ ํˆฌ์ž…ํ•˜์—ฌ ์‹ ๋ขฐ๋„ ๋†’์€ ํ›„๋ณด๊ตฐ์„ ์••์ถ•.  
  To narrow down a reliable set of candidates by applying more data and training to the promising regions identified in Stage 1\.  
* ๋ฐฉ๋ฒ• (Method): ๋ฐ์ดํ„ฐ์…‹์˜ 40%๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 2-4 ์—ํฌํฌ ๋™์•ˆ ํ•™์Šต์„ ์ง„ํ–‰. 1๋‹จ๊ณ„์˜ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์œ ๋งํ•œ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ ๊ณต๊ฐ„์„ ์ง‘์ค‘์ ์œผ๋กœ ํƒ์ƒ‰ํ–ˆ์Šต๋‹ˆ๋‹ค.  
  Based on the results from Stage 1, a focused search was conducted in the promising hyperparameter space by training for 2-4 epochs using 40% of the dataset.  
  * **learning\_rate**: `2e-5` \~ `1e-4` (log-uniform)  
  * **effective\_batch\_size** (`per_device_train_batch_size` \~ `gradient_accumulation_steps`): 32 \~ 256  
  * **weight\_decay**: `0.0` \~ `0.1`  
  * **lr\_scheduler\_type**: `linear`, `cosine`, `constant_with_warmup`  
* ๊ฒฐ๊ณผ (Result): `eval_loss`๊ฐ€ 1.8822๊นŒ์ง€ ํฌ๊ฒŒ ํ–ฅ์ƒ๋˜์—ˆ์œผ๋ฉฐ, ์ตœ์ข… ํ‰๊ฐ€๋ฅผ ์ง„ํ–‰ํ•  ์ตœ์ƒ์œ„ 10๊ฐœ์˜ ์šฐ์ˆ˜ํ•œ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ ์กฐํ•ฉ์„ ์„ฑ๊ณต์ ์œผ๋กœ ๋„์ถœ. ํŒŒ๋ผ๋ฏธํ„ฐ ์ค‘์š”๋„ ๋ถ„์„ ๊ฒฐ๊ณผ, `learning_rate`์™€ `weight_decay`๊ฐ€ ๋ชจ๋ธ ์„ฑ๋Šฅ์— ๊ฐ€์žฅ ๊ฒฐ์ •์ ์ธ ์˜ํ–ฅ์„ ๋ฏธ์น˜๋Š” ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ํ™•์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. (์ƒ์„ธ ๋‚ด์šฉ์€ `hpo_visualizations/stage2_param_importances.html` ์ฐธ๊ณ )  
  The `eval_loss` was significantly improved to 1.8822, successfully identifying the top 10 hyperparameter combinations for final evaluation. Parameter importance analysis revealed that `learning_rate` and `weight_decay` were the most critical parameters affecting model performance. (See `hpo_visualizations/stage2_param_importances.html` for details).

##### **3๋‹จ๊ณ„: ์ตœ์ข… ๊ฒ€์ฆ (Stage 3: Final Validation)**

* ๋ชฉํ‘œ (Objective): 2๋‹จ๊ณ„์—์„œ ์„ ๋ณ„๋œ ์ƒ์œ„ 10๊ฐœ ํ›„๋ณด๋ฅผ ๋Œ€์ƒ์œผ๋กœ ์ „์ฒด ๋ฐ์ดํ„ฐ์…‹์— ๋Œ€ํ•œ ์‹ค์ œ ์„ฑ๋Šฅ๊ณผ ๊ณผ์ ํ•ฉ ์ง€์ ์„ ์ •๋ฐ€ํ•˜๊ฒŒ ์ธก์ •ํ•˜์—ฌ ์ตœ์ข… ๋ชจ๋ธ์„ ํ™•์ •.  
  To precisely measure the actual performance and overfitting points on the entire dataset for the top 10 candidates selected in Stage 2, thereby finalizing the model.  
* ๋ฐฉ๋ฒ• (Method): ์ „์ฒด ๋ฐ์ดํ„ฐ์…‹(100%)์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ ํ›„๋ณด๋ฅผ 10 ์—ํฌํฌ ๋™์•ˆ ํ•™์Šต. ๋งค ์—ํฌํฌ๋งˆ๋‹ค ๊ฒ€์ฆ ์†์‹ค์„ ๊ธฐ๋กํ•˜์—ฌ ์ตœ์ ์˜ ์„ฑ๋Šฅ์„ ๋ณด์ธ ์‹œ์ ์˜ ๋ชจ๋ธ์„ ์ €์žฅ.  
  Each candidate was trained for 10 epochs using the entire dataset (100%). The model at the point of best performance was saved by recording the validation loss at each epoch.  
* ๊ฒฐ๊ณผ (Result): ์ตœ์ข…์ ์œผ๋กœ `Test Loss` 1.4163, `Perplexity` 4.1219๋ฅผ ๊ธฐ๋กํ•œ Trial 4 ๋ชจ๋ธ์„ ์ตœ์ข… ๋ชจ๋ธ๋กœ ์„ ์ •.  
  The Trial 4 model, which recorded a final `Test Loss` of 1.4163 and a `Perplexity` of 4.1219, was selected as the final model.

#### **์ตœ์ข… ๋ชจ๋ธ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ (Final Model Hyperparameters)**

3๋‹จ๊ณ„ ์ตœ์ข… ๊ฒ€์ฆ์„ ํ†ตํ•ด ์„ ์ •๋œ Trial 4 ๋ชจ๋ธ์˜ ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.  
The hyperparameters for the Trial 4 model, selected through the final validation, are as follows:

* **learning\_rate**: 9.66e-05  
* **per\_device\_train\_batch\_size**: 8  
* **gradient\_accumulation\_steps**: 4 (Effective batch size: 32\)  
* **weight\_decay**: 0.0401  
* **lr\_scheduler\_type**: linear  
* **adam\_beta1**: 0.8943  
* **adam\_beta2**: 0.9923  
* **warmup\_ratio**: 0.0983  
* **optimizer**: AdamW  
* **mlm\_probability**: 0.15  
* **max\_seq\_length**: 256

#### **ํ•™์Šต ํ™˜๊ฒฝ (Training Environment)**

* **Hardware**: 1 x NVIDIA A100-PCIE-40GB  
* **Software**: For reproducibility, the following versions of major libraries were used in this study.  
  * `transformers`: v4.47.1  
  * `datasets`: v3.0.1  
  * `torch`: v2.6.0a0+ecf3bae40a.nv25.01  
  * `optuna`: v4.3.0  
  * `accelerate`: v1.5.2  
  * `pandas`: v2.2.2  
  * `lxml`: v5.3.0  
  * `tqdm`: v4.67.1  
  * `scikit-learn`: v1.6.1

## **ํ‰๊ฐ€ (Evaluation)**

#### **ํ‰๊ฐ€ ์ง€ํ‘œ (Evaluation Metrics)**

* **Test Loss**: The loss value of the model on the test dataset.  
* **Perplexity (PPL)**: A standard metric for evaluating language models, representing uncertainty. **A lower value indicates** that the model predicts the next word better. (Formula: eloss)

#### **ํ‰๊ฐ€ ๊ฒฐ๊ณผ (Evaluation Results)**

ํ•œ ๋ฒˆ๋„ ํ•™์Šต์— ์‚ฌ์šฉ๋˜์ง€ ์•Š์€ ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ์…‹(`test.txt`)์œผ๋กœ ์ƒ์œ„ 10๊ฐœ ํ›„๋ณด ๋ชจ๋ธ์„ ํ‰๊ฐ€ํ•œ ์ตœ์ข… ์„ฑ๋Šฅ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.  
The final performance of the top 10 candidate models, evaluated on the held-out test dataset (`test.txt`), is as follows:

| ์ˆœ์œ„(Rank) | Trial ๋ฒˆํ˜ธ(No.) | Test Loss | Perplexity (PPL) | ๊ฒ€์ฆ(Val) ์ˆœ์œ„์™€์˜ ์ฐจ์ด(vs. Val Rank) |
| :---- | :---- | :---- | :---- | :---- |
| **1** | **4** | **1.4163** | **4.1219** | \- |
| 2 | 11 | 1.4182 | 4.1296 | โ–ฒ 2 |
| 3 | 10 | 1.4197 | 4.1357 | โ–ฒ 2 |
| 4 | 3 | 1.4198 | 4.1362 | โ–ผ 1 |
| 5 | 2 | 1.4202 | 4.1381 | โ–ผ 3 |
| 6 | 7 | 1.4800 | 4.3931 | \- |
| 7 | 8 | 1.5229 | 4.5853 | \- |
| 8 | 6 | 1.5269 | 4.6040 | \- |
| 9 | 5 | 1.5688 | 4.8010 | \- |
| 10 | 9 | 1.5757 | 4.8339 | \- |

๋ถ„์„ (Analysis): ๊ฒ€์ฆ ๋ฐ์ดํ„ฐ์…‹์—์„œ 1์œ„๋ฅผ ์ฐจ์ง€ํ–ˆ๋˜ Trial 4 ๋ชจ๋ธ์ด ํ…Œ์ŠคํŠธ ๋ฐ์ดํ„ฐ์…‹์—์„œ๋„ ๊ฐ€์žฅ ์šฐ์ˆ˜ํ•œ ์ผ๋ฐ˜ํ™” ์„ฑ๋Šฅ์„ ๋ณด์—ฌ, ๋ณธ ์—ฐ๊ตฌ์—์„œ ์ฑ„ํƒํ•œ ๋‹จ๊ณ„์  HPO ์ „๋žต์˜ ์œ ํšจ์„ฑ์„ ์ž…์ฆํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ๊ฒ€์ฆ ์…‹์—์„œ 4์œ„์˜€๋˜ Trial 11์ด ์ตœ์ข… 2์œ„๋ฅผ ๊ธฐ๋กํ•œ ๊ฒƒ์€, ์ตœ์ข… ํ‰๊ฐ€์—์„œ Top 10 ์ „์ฒด๋ฅผ ๊ฒ€์ฆํ•˜๋Š” ๊ณผ์ •์˜ ์ค‘์š”์„ฑ์„ ์‹œ์‚ฌํ•ฉ๋‹ˆ๋‹ค.  
The Trial 4 model, which ranked first on the validation dataset, also showed the best generalization performance on the test dataset, validating the effectiveness of the staged HPO strategy adopted in this study. Furthermore, the fact that Trial 11, ranked 4th on the validation set, achieved the 2nd position in the final evaluation highlights the importance of validating the entire top 10 candidates.

#### **HPO ๊ฒฐ๊ณผ ๋ถ„์„ ์ž๋ฃŒ (Analysis of HPO Results)**

์ „์ฒด ํ•˜์ดํผํŒŒ๋ผ๋ฏธํ„ฐ ์ตœ์ ํ™” ๊ณผ์ •์— ๋Œ€ํ•œ ์ƒ์„ธํ•œ ๊ฒฐ๊ณผ๋Š” ๋ณธ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์˜ `hpo_visualizations` ๋ฐ `hpo_databases` ํด๋”์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
Detailed results of the entire hyperparameter optimization process can be found in the `hpo_visualizations` and `hpo_databases` folders of this repository.

* **์ •์  ์‹œ๊ฐํ™” ๋ณด๊ณ ์„œ (Static Visualization Reports)**  
  * **์œ„์น˜ (Location)**: `hpo_visualizations/`  
  * **์„ค๋ช… (Description)**: HTML files containing interactive graphs that visualize the results of each HPO stage. These can be opened directly in a browser for quick exploration. (Visualization for Stage 1 is excluded due to its short training time and low statistical significance.)  
* **HPO ์›์‹œ ๋ฐ์ดํ„ฐ (Raw HPO Data)**  
  * **์œ„์น˜ (Location)**: `hpo_databases/`  
  * **์„ค๋ช… (Description)**: Original SQLite database files containing the records of all HPO trials. Other researchers can load these files to perfectly reproduce the results of this study or conduct their own analysis.  
  * **ํ™œ์šฉ ์˜ˆ์‹œ (Usage Example)**: You can perform the analysis yourself using the provided `scripts/hpo\_result\_analyzer\_universal.py` script and the DB files.  
```
# 2๋‹จ๊ณ„ ๊ฒฐ๊ณผ ๋ถ„์„ ์žฌํ˜„
# Reproduce Stage 2 analysis
# (DB and Study names should be adjusted to match the actual uploaded files and settings.)
python scripts/hpo_result_analyzer_universal.py \
  --db_path "hpo_databases/hpo_stage2_search.db" \
  --study_name "Sillok-LM_MLM_HyperOpt_Heavier_bert_base_multilingual_cased" \
  --file_prefix "reproduced_stage2_"

# 3๋‹จ๊ณ„ ๊ฒฐ๊ณผ ๋ถ„์„ ์žฌํ˜„
# Reproduce Stage 3 analysis
python scripts/hpo_result_analyzer_universal.py \
  --db_path "hpo_databases/hpo_stage3_validation.db" \
  --study_name "Sillok-LM_Final_Top10_Run" \
  --file_prefix "reproduced_stage3_"
```

## **์ œํ•œ ์‚ฌํ•ญ ๋ฐ ํŽธํ–ฅ์„ฑ (Limitations and Bias)**

* ๋ณธ ๋ชจ๋ธ์€ ์กฐ์„ ์™•์กฐ์‹ค๋ก ์›๋ฌธ ๋ฐ์ดํ„ฐ๋กœ ํ•™์Šต๋˜์—ˆ์œผ๋ฏ€๋กœ, ํ˜„๋Œ€ ํ•œ๊ตญ์–ด๋‚˜ ๋‹ค๋ฅธ ์‹œ๋Œ€์˜ ํ•œ๋ฌธ ํ…์ŠคํŠธ์— ๋Œ€ํ•ด์„œ๋Š” ์„ฑ๋Šฅ์ด ์ €ํ•˜๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.  
  Since this model was trained on the original text of Veritable Records of the Joseon Dynasty, its performance may degrade on modern Korean or Classical Chinese texts from other periods.  
* ์‹ค๋ก์€ ํŠน์ • ๊ณ„์ธต(์™•, ์‚ฌ๋Œ€๋ถ€)์˜ ๊ด€์ ์—์„œ ๊ธฐ๋ก๋œ ์‚ฌ๋ฃŒ์ด๋ฏ€๋กœ, ๋ชจ๋ธ์ด ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ ์˜ˆ์ธกํ•˜๋Š” ๋‚ด์šฉ ๋˜ํ•œ ์ด๋Ÿฌํ•œ ์—ญ์‚ฌ์ , ์ด๋…์  ํŽธํ–ฅ์„ฑ์„ ๋‚ด์žฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๋Š” ๋ชจ๋ธ์˜ ๊ฒฐ๊ณผ๋ฅผ ๋น„ํŒ์ ์œผ๋กœ ํ•ด์„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.  
  Veritable Records of the Joseon Dynasty were recorded from the perspective of a specific class (kings, scholar-officials), so the content generated or predicted by the model may inherit these historical and ideological biases. Users should interpret the model's outputs critically.

## **์—ฐ๊ตฌํŒ€ ๋ฐ ์ธ์šฉ (Team and Citation)**

#### **์—ฐ๊ตฌํŒ€ (Team)**

* **๊น€๋ฐ”๋กœ (Baro Kim)**: ์—ฐ๊ตฌ ์ฑ…์ž„์ž (Principal Investigator), Digital Humanities Research Institute, The Academy of Korean Studies

#### **์ธ์šฉ ์ •๋ณด (Citation)**

์ด ๋ชจ๋ธ์„ ์—ฐ๊ตฌ์— ์‚ฌ์šฉํ•˜์‹ค ๊ฒฝ์šฐ, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ธ์šฉํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.  
If you use this model in your research, please cite it as follows:  
```
@misc{kim2025sillokbert,  
      title={{SillokBert: A Language Model for Veritable Records of the Joseon Dynasty}},   
      author={Baro, Kim},  
      year={2025},  
      publisher={Hugging Face},  
      journal={Hugging Face repository},  
      howpublished={url{[https://huggingface.co/ddokbaro/SillokBert](https://huggingface.co/ddokbaro/SillokBert)}}  
}  
```