gyung commited on
Commit
c889dfb
ยท
verified ยท
1 Parent(s): 19b9bed

Add files using upload-large-folder tool

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
EPOCH_2_FINAL.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "artifact": "KoHRM-Text-1.4B Epoch 2 Final",
3
+ "epoch_label": "epoch2-final",
4
+ "stage": "stage4b-korean-tool-finance-repeat",
5
+ "global_step": 470077,
6
+ "checkpoint_tag": "epoch_1",
7
+ "source_checkpoint": "/home/work/.data/hrm_text_checkpoints/KoHRM-Text-1.4B-stage4b-korean-tool-finance-repeat-gbs180",
8
+ "main_model_repo_revision": "epoch-2-final",
9
+ "pinned_model_repo": "LLM-OS-Models/KoHRM-Text-1.4B-Epoch2"
10
+ }
README.md ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ language:
4
+ - ko
5
+ - en
6
+ tags:
7
+ - kohrm
8
+ - epoch2-final
9
+ - hrm-text
10
+ - korean
11
+ - terminal
12
+ - tool-use
13
+ library_name: transformers
14
+ ---
15
+
16
+ # KoHRM-Text-1.4B Epoch 2 Final
17
+
18
+ This repository/revision is the fixed **Epoch 2 Final** export of KoHRM-Text-1.4B.
19
+
20
+ - Epoch label: `epoch2-final`
21
+ - Final stage: `stage4b-korean-tool-finance-repeat`
22
+ - Global step: `470077`
23
+ - Export: EMA weights converted to `model.safetensors`
24
+ - Rolling latest repo: `https://huggingface.co/LLM-OS-Models/KoHRM-Text-1.4B`
25
+ - Raw resume checkpoints: `https://huggingface.co/LLM-OS-Models/KoHRM-Text-1.4B-raw-checkpoints`
26
+
27
+ ํ•œ๊ตญ์–ด: ์ด ์ €์žฅ์†Œ/๋ฆฌ๋น„์ „์€ KoHRM-Text-1.4B์˜ **์—ํญ 2 ์™„๋ฃŒ๋ณธ**์„ ๊ณ ์ • ์ €์žฅํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ดํ›„ ํ•™์Šต์ด ๊ณ„์† ์ง„ํ–‰๋˜์–ด rolling latest๊ฐ€ ๋ฐ”๋€Œ์–ด๋„ ์ด artifact๋Š” epoch 2 ์™„๋ฃŒ ์ง€์ ์„ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค.
28
+
29
+ ---
30
+ ---
31
+ license: apache-2.0
32
+ language:
33
+ - ko
34
+ - en
35
+ tags:
36
+ - hrm-text
37
+ - korean
38
+ - terminal
39
+ - tool-use
40
+ - code
41
+ - pretraining
42
+ - prefix-lm
43
+ library_name: pytorch
44
+ pipeline_tag: text-generation
45
+ ---
46
+
47
+ # KoHRM-Text-1.4B
48
+
49
+ **Language / ์–ธ์–ด:** [English](#english) | [ํ•œ๊ตญ์–ด](#korean)
50
+
51
+ <a id="english"></a>
52
+
53
+ ## English
54
+
55
+ `KoHRM-Text-1.4B` is a scratch-pretrained Korean/English/code/terminal/tool-use model built from the `sapientinc/HRM-Text` PrefixLM training stack.
56
+
57
+ This is **not** a continued finetune of `sapientinc/HRM-Text-1B`. It uses a new Korean/terminal-oriented 131K byte-level BPE tokenizer and a new scratch training run.
58
+
59
+ ### Current Status
60
+
61
+ This repository is a rolling **latest public model export**. Training is still in progress.
62
+
63
+ - Main repo: `LLM-OS-Models/KoHRM-Text-1.4B`
64
+ - Current public files: `model.safetensors`, `config.json`, tokenizer files, and this `README.md`
65
+ - Raw FSDP2 resume checkpoints: `LLM-OS-Models/KoHRM-Text-1.4B-raw-checkpoints`
66
+ - Prepared data: `LLM-OS-Models/KoHRM-Text-1.4B-prepared-data`
67
+ - Project code: https://github.com/LLM-OS-Models/KoHRM-text
68
+ - Upstream HRM-Text code: https://github.com/sapientinc/HRM-Text
69
+ - HRM-Text paper: https://arxiv.org/html/2605.20613
70
+ - Tokenizer repo: `LLM-OS-Models/HRM-Text-Ko-Terminal-Tokenizer-131K`
71
+
72
+ The main branch is overwritten with the newest converted EMA `safetensors` export as training checkpoints are uploaded. To test the latest public weight, download `revision="main"`.
73
+
74
+ ### Training Method At A Glance
75
+
76
+ KoHRM-Text is best understood as **instruction pretraining from scratch**.
77
+
78
+ It is not ordinary raw-text causal LM pretraining, and it is not only a small SFT pass on top of an existing base model.
79
+
80
+ ```text
81
+ raw data -> tokenizer -> V1Dataset -> PrefixLM batches
82
+ -> HRM H/L recurrence -> LM head -> response-only loss
83
+ ```
84
+
85
+ The input context is handled as a PrefixLM prefix:
86
+
87
+ ```text
88
+ instruction / prefix: bidirectional attention, no loss
89
+ response: causal attention, response-only CE loss
90
+ ```
91
+
92
+ The architecture keeps the upstream HRM-Text recurrent design:
93
+
94
+ ```text
95
+ H module: slower strategic state
96
+ L module: faster execution state
97
+ schedule: H2L3 recurrent computation
98
+ ```
99
+
100
+ For a readable full explanation of the training method, architecture, PT/SFT distinction, staged continuation, and checkpoint naming, see the project document:
101
+
102
+ [MODEL_TRAINING_ARCHITECTURE_GUIDE_2026-05-28.md](MODEL_TRAINING_ARCHITECTURE_GUIDE_2026-05-28.md) in https://github.com/LLM-OS-Models/KoHRM-text
103
+
104
+ ### Important Compatibility Note
105
+
106
+ The public repo currently contains the converted model weights and tokenizer, but it does **not yet** include a Hugging Face `trust_remote_code` modeling implementation for `HrmTextForCausalLM`.
107
+
108
+ What works today:
109
+
110
+ - Download the latest public weights.
111
+ - Load the tokenizer directly with `tokenizers.Tokenizer.from_file("tokenizer.json")`.
112
+ - Inspect `config.json`.
113
+ - Verify `model.safetensors` on CPU or Colab T4.
114
+
115
+ What is not supported yet in plain Transformers:
116
+
117
+ - `AutoModelForCausalLM.from_pretrained("LLM-OS-Models/KoHRM-Text-1.4B")`
118
+ - One-line hosted text generation from this repo
119
+
120
+ Expected reason: `model_type: "hrm_text"` is a custom HRM-Text architecture. Public generation will require adding the compatible `HrmTextForCausalLM` remote-code files to this model repo or releasing a standard wrapper.
121
+
122
+ ### Model Details
123
+
124
+ | Field | Value |
125
+ |---|---:|
126
+ | Model id | `LLM-OS-Models/KoHRM-Text-1.4B` |
127
+ | Standard name | `KoHRM-Text-1.4B` |
128
+ | Training origin | scratch |
129
+ | Architecture family | HRM-Text PrefixLM |
130
+ | Architecture size | `XL` |
131
+ | Parameters | 1,384,120,320 |
132
+ | Context length | 4,096 tokens |
133
+ | Training dtype | bfloat16 |
134
+ | Public export dtype | bfloat16 EMA `safetensors` |
135
+ | Tokenizer | byte-level BPE, NFC normalization |
136
+ | Vocabulary size | 131,072 |
137
+ | Objective | PrefixLM response-only loss |
138
+ | Optimizer | Adam-atan2 from upstream HRM-Text |
139
+ | EMA | 0.9999 |
140
+
141
+ Converted config highlights:
142
+
143
+ ```json
144
+ {
145
+ "model_type": "hrm_text",
146
+ "architectures": ["HrmTextForCausalLM"],
147
+ "vocab_size": 131072,
148
+ "hidden_size": 1536,
149
+ "num_hidden_layers": 32,
150
+ "num_attention_heads": 12,
151
+ "max_position_embeddings": 4096,
152
+ "prefix_lm": true
153
+ }
154
+ ```
155
+
156
+ ### Compared With The HRM-Text Paper
157
+
158
+ This run can take longer than the paper recipe even on 8 x H200 because the setup is not identical:
159
+
160
+ - The paper reference used 16 x H100; this run uses 8 x H200.
161
+ - KoHRM uses a larger 131K tokenizer vocabulary, compared with the upstream 65K tokenizer.
162
+ - The public KoHRM size is about 1.38B parameters.
163
+ - The stable long-run batch is `180,224` tokens/step after OOM probing; larger batches were possible briefly but not chosen for reliability.
164
+ - The continuation includes extra Korean, terminal, tool-call, legal, finance, wiki, and repeated HRM-cleaned stages.
165
+
166
+ This does not automatically guarantee better benchmark scores. The expected upside is domain-specific: Korean tokenization efficiency, Korean legal/finance/wiki coverage, terminal trajectories, tool-call formatting, and code-oriented behavior should have a better chance than the upstream English/general checkpoint. Final claims require evaluation after the planned continuation and SFT finish.
167
+
168
+ ### Tokenizer
169
+
170
+ The tokenizer was trained for Korean, English, code, shell/terminal text, and JSON/tool-call formats. It keeps common chat/tool special tokens as stable single tokens where possible.
171
+
172
+ | Sample bucket | chars/token |
173
+ |---|---:|
174
+ | Korean general text | 2.60 |
175
+ | Korean legal text | 2.36 |
176
+ | Korean terminal instruction | 2.18 |
177
+ | shell command | 2.68 |
178
+ | tool-call JSON | 3.32 |
179
+ | Python code | 3.37 |
180
+ | English | 4.40 |
181
+
182
+ Formatting tokens:
183
+
184
+ ```text
185
+ <|im_start|> instruction start
186
+ <|im_end|> instruction end
187
+ <|box_end|> response/end marker
188
+ <|object_ref_start|> direct condition
189
+ <|object_ref_end|> chain-of-thought style condition
190
+ <|quad_start|> noisy condition
191
+ <|quad_end|> synthetic condition
192
+ ```
193
+
194
+ Prompt format used by the project-side inference code:
195
+
196
+ ```text
197
+ <|im_start|><|object_ref_start|>YOUR_PROMPT_HERE<|im_end|>
198
+ ```
199
+
200
+ ### Colab T4 Quick Generation
201
+
202
+ A ready-to-run Colab notebook is available in the project repo:
203
+
204
+ https://github.com/LLM-OS-Models/KoHRM-text/blob/main/notebooks/KoHRM_Text_1_4B_Colab_T4_Smoke_Test.ipynb
205
+
206
+ The notebook downloads the latest public files and runs a short generation test on a Colab T4.
207
+
208
+ It intentionally avoids `transformers`, `AutoTokenizer`, and `AutoModelForCausalLM`. Instead, it uses:
209
+
210
+ - `tokenizers.Tokenizer.from_file("tokenizer.json")`
211
+ - `safetensors.torch.load_file("model.safetensors")`
212
+ - `kohrm_colab_generate.py`, a small PyTorch SDPA runtime for the HRM-Text architecture
213
+
214
+ ```python
215
+ !pip -q install -U huggingface_hub hf_transfer tokenizers safetensors
216
+ ```
217
+
218
+ ```python
219
+ from pathlib import Path
220
+ import json
221
+ import importlib.util
222
+ import sys
223
+ from huggingface_hub import snapshot_download
224
+ from tokenizers import Tokenizer
225
+
226
+ repo_id = "LLM-OS-Models/KoHRM-Text-1.4B"
227
+
228
+ repo_dir = Path(snapshot_download(
229
+ repo_id,
230
+ revision="main",
231
+ allow_patterns=[
232
+ "README.md",
233
+ "config.json",
234
+ "tokenizer.json",
235
+ "tokenizer_config.json",
236
+ "special_tokens_map.json",
237
+ "model.safetensors",
238
+ "kohrm_colab_generate.py",
239
+ ],
240
+ ))
241
+
242
+ print("Downloaded to:", repo_dir)
243
+ config = json.loads((repo_dir / "config.json").read_text())
244
+ print("model_type:", config["model_type"])
245
+ print("hidden_size:", config["hidden_size"])
246
+ print("vocab_size:", config["vocab_size"])
247
+ print("context:", config["max_position_embeddings"])
248
+
249
+ tokenizer = Tokenizer.from_file(str(repo_dir / "tokenizer.json"))
250
+ wrapped = "<|im_start|><|object_ref_start|>ํ•œ๊ตญ์–ด๋กœ ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ๊ฐ€์žฅ ํฐ ํŒŒ์ผ 10๊ฐœ๋ฅผ ์ฐพ๋Š” ๋ช…๋ น์„ ์•Œ๋ ค์ฃผ์„ธ์š”.<|im_end|>"
251
+ ids = tokenizer.encode(wrapped).ids
252
+ print("prompt tokens:", len(ids))
253
+ print("first token ids:", ids[:20])
254
+
255
+ spec = importlib.util.spec_from_file_location(
256
+ "kohrm_colab_generate",
257
+ repo_dir / "kohrm_colab_generate.py",
258
+ )
259
+ kohrm = importlib.util.module_from_spec(spec)
260
+ sys.modules["kohrm_colab_generate"] = kohrm
261
+ spec.loader.exec_module(kohrm)
262
+
263
+ output = kohrm.generate_text(
264
+ repo_dir,
265
+ "ํ•œ๊ตญ์–ด๋กœ ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ๊ฐ€์žฅ ํฐ ํŒŒ์ผ 10๊ฐœ๋ฅผ ์ฐพ๋Š” bash ๋ช…๋ น์„ ์•Œ๋ ค์ฃผ์„ธ์š”. ๋ช…๋ น๋งŒ ๊ฐ„๋‹จํžˆ ๋‹ตํ•˜์„ธ์š”.",
266
+ max_new_tokens=64,
267
+ max_seq_len=512,
268
+ temperature=0.0,
269
+ )
270
+ print(output)
271
+ ```
272
+
273
+ Expected result:
274
+
275
+ - `model_type` should be `hrm_text`.
276
+ - `vocab_size` should be `131072`.
277
+ - The helper should load the 1.38B public `model.safetensors` export.
278
+ - On Colab T4, generation runs in fp16 through PyTorch scaled-dot-product attention.
279
+ - First generation can take a few minutes because it downloads and loads the full weight file.
280
+
281
+ Prompt format used by the helper:
282
+
283
+ ```text
284
+ <|im_start|><|object_ref_start|>PROMPT<|im_end|>
285
+ ```
286
+
287
+ Plain `AutoModelForCausalLM.generate()` is still not the supported path. This model is a custom `hrm_text` architecture, so ordinary Transformers generation requires a future `trust_remote_code` wrapper. Use the notebook/helper above for public `model.safetensors` generation today.
288
+
289
+ ### Internal Raw-Checkpoint Generation
290
+
291
+ For training-machine debugging and exact raw FSDP2 checkpoint recovery, the project still includes the upstream-style inference path:
292
+
293
+ - `simple_inference_engine.py`
294
+ - raw checkpoints from `LLM-OS-Models/KoHRM-Text-1.4B-raw-checkpoints`
295
+ - CUDA/FlashAttention-oriented execution
296
+
297
+ That path is mainly for internal continuation/evaluation, not the easiest Colab test.
298
+
299
+
300
+ ### Training Data
301
+
302
+ Prepared data artifacts are uploaded to:
303
+
304
+ https://huggingface.co/datasets/LLM-OS-Models/KoHRM-Text-1.4B-prepared-data
305
+
306
+ The training objective is PrefixLM response-only loss. Instruction/prompt tokens are visible as context, while loss is applied to the response span.
307
+
308
+ Major prepared data groups:
309
+
310
+ | Dataset group | Tokens | Use |
311
+ |---|---:|---|
312
+ | `koterm_pretrain_mix_v1` | 711.3M | stage-0/stage0b |
313
+ | HRM cleaned fast-cap stage1/stage1b | 14.55B | HRM-style instruction pretraining |
314
+ | HRM cleaned full/no-cap stage2 | 14.55B | completed continuation |
315
+ | HRM cleaned full/no-cap extra stage2b | 14.55B | active continuation |
316
+ | Local terminal conversations | 9.39B | terminal/code/tool-heavy continuation |
317
+ | Korean tool/legal/wiki/finance mix | 3.02B | Korean domain and tool continuation |
318
+ | BCAI Finance Korean | 857.7M | Korean finance/domain data |
319
+ | Korean legal/admin task data | 629.0M | Korean legal/admin data |
320
+ | Korean Wikipedia | 462.5M | Korean general text |
321
+ | ToolBench train tool-call data | 127.0M | tool-call pretraining |
322
+ | SWE-ZERO + GLM reasoning subsets | 251.2M | code/reasoning data |
323
+
324
+ Evaluation-like datasets are excluded where identified, including ToolBench eval, Terminal Bench style evaluation data, and benchmark-oriented `chi-bench` data.
325
+
326
+ ### Training Run
327
+
328
+ The current run uses staged continuation:
329
+
330
+ ```text
331
+ stage0
332
+ -> stage0b
333
+ -> stage1
334
+ -> stage2
335
+ -> stage3
336
+ -> stage4
337
+ -> stage1b
338
+ -> stage2b
339
+ -> stage3b
340
+ -> stage4b
341
+ -> stage1c
342
+ -> stage2c
343
+ -> stage3c
344
+ -> stage4c
345
+ ```
346
+
347
+ The checkpoint carries model weights, optimizer state, EMA weights, and recurrent carry state. `resume_step_offset` and `total_steps_override` are used so the learning-rate schedule follows the intended longer run instead of resetting at each stage.
348
+
349
+ As of 2026-05-27, `stage2b` is active. The continuation watcher is scheduled to launch `stage3b -> stage4b -> stage1c -> stage2c -> stage3c -> stage4c` after each completed checkpoint. The handoff reads the actual `epoch_1_info.json` `global_step` from each completed checkpoint before starting the next stage.
350
+
351
+ ### Intended Use
352
+
353
+ This checkpoint is intended for:
354
+
355
+ - continued pretraining experiments
356
+ - Korean tokenizer and HRM-Text architecture experiments
357
+ - terminal/tool-call/code pretraining research
358
+ - checkpoint conversion and evaluation work
359
+
360
+ It is not yet intended as a finished assistant model.
361
+
362
+ ### Limitations
363
+
364
+ - This is an intermediate checkpoint, not a final aligned instruct model.
365
+ - The full planned continuation has not finished.
366
+ - Final SFT and safety tuning have not been completed.
367
+ - Public benchmark scores for this new checkpoint are not final.
368
+ - Plain Transformers generation requires adding the custom `hrm_text` modeling wrapper or remote-code files.
369
+ - Tool-call JSON validity and terminal action safety must be evaluated before production use.
370
+
371
+ ### Citation
372
+
373
+ This work builds on HRM-Text:
374
+
375
+ - Paper: https://arxiv.org/html/2605.20613
376
+ - Upstream code: https://github.com/sapientinc/HRM-Text
377
+
378
+ <a id="korean"></a>
379
+
380
+ ## ํ•œ๊ตญ์–ด
381
+
382
+ `KoHRM-Text-1.4B`๋Š” `sapientinc/HRM-Text`์˜ PrefixLM ํ•™์Šต ์Šคํƒ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ฒ˜์Œ๋ถ€ํ„ฐ ํ•™์Šต ์ค‘์ธ ํ•œ๊ตญ์–ด/์˜์–ด/์ฝ”๋“œ/ํ„ฐ๋ฏธ๋„/ํˆด์ฝœ ๋ชจ๋ธ์ž…๋‹ˆ๋‹ค.
383
+
384
+ ์ด ๋ชจ๋ธ์€ `sapientinc/HRM-Text-1B`๋ฅผ ์ด์–ด์„œ ํŒŒ์ธํŠœ๋‹ํ•œ ๋ชจ๋ธ์ด ์•„๋‹™๋‹ˆ๋‹ค. ํ•œ๊ตญ์–ด์™€ ํ„ฐ๋ฏธ๋„/ํˆด์ฝœ ํ˜•์‹์— ๋งž์ถฐ ์ƒˆ๋กœ ๋งŒ๋“  131K byte-level BPE tokenizer๋ฅผ ์‚ฌ์šฉํ•˜๋ฉฐ, ๊ฐ€์ค‘์น˜๋„ scratch pretraining์œผ๋กœ ํ•™์Šตํ•ฉ๋‹ˆ๋‹ค.
385
+
386
+ ### ํ˜„์žฌ ์ƒํƒœ
387
+
388
+ ์ด ์ €์žฅ์†Œ๋Š” ์ตœ์‹  ๊ณต๊ฐœ ๋ณ€ํ™˜๋ณธ์„ ๊ณ„์† ๋ฎ์–ด์“ฐ๋Š” rolling latest model repo์ž…๋‹ˆ๋‹ค. ํ•™์Šต์€ ์•„์ง ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค.
389
+
390
+ - ๋ฉ”์ธ ๋ชจ๋ธ repo: `LLM-OS-Models/KoHRM-Text-1.4B`
391
+ - ํ˜„์žฌ ๊ณต๊ฐœ ํŒŒ์ผ: `model.safetensors`, `config.json`, tokenizer ํŒŒ์ผ, `README.md`
392
+ - raw FSDP2 resume checkpoint: `LLM-OS-Models/KoHRM-Text-1.4B-raw-checkpoints`
393
+ - prepared data: `LLM-OS-Models/KoHRM-Text-1.4B-prepared-data`
394
+ - ํ”„๋กœ์ ํŠธ ์ฝ”๋“œ: https://github.com/LLM-OS-Models/KoHRM-text
395
+ - ์›๋ณธ HRM-Text ์ฝ”๋“œ: https://github.com/sapientinc/HRM-Text
396
+ - HRM-Text ๋…ผ๋ฌธ: https://arxiv.org/html/2605.20613
397
+ - tokenizer repo: `LLM-OS-Models/HRM-Text-Ko-Terminal-Tokenizer-131K`
398
+
399
+ ์ตœ์‹  ๊ณต๊ฐœ weight๋ฅผ ํ…Œ์ŠคํŠธํ•˜๋ ค๋ฉด `revision="main"`์œผ๋กœ ๋‹ค์šด๋กœ๋“œํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ํ•™์Šต ์ค‘ 10,000 step ๋‹จ์œ„๋กœ ์ƒˆ checkpoint๊ฐ€ ๋ณ€ํ™˜๋˜์–ด ์˜ฌ๋ผ์˜ค๋ฉด ๊ฐ™์€ ํŒŒ์ผ๋ช…์ด ์ตœ์‹  EMA `safetensors`๋กœ ๊ฐฑ์‹ ๋ฉ๋‹ˆ๋‹ค.
400
+
401
+ ### ํ•™์Šต ๋ฐฉ์‹ ํ•œ๋ˆˆ์— ๋ณด๊ธฐ
402
+
403
+ KoHRM-Text๋Š” **scratch instruction pretraining**์œผ๋กœ ๋ณด๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์ •ํ™•ํ•ฉ๋‹ˆ๋‹ค.
404
+
405
+ ์ผ๋ฐ˜์ ์ธ raw-text causal LM ์‚ฌ์ „ํ•™์Šต๋„ ์•„๋‹ˆ๊ณ , ์ด๋ฏธ ์™„์„ฑ๋œ base model ์œ„์— ์งง๊ฒŒ ์–น๋Š” SFT๋งŒ๋„ ์•„๋‹™๋‹ˆ๋‹ค.
406
+
407
+ ```text
408
+ raw data -> tokenizer -> V1Dataset -> PrefixLM batches
409
+ -> HRM H/L recurrence -> LM head -> response-only loss
410
+ ```
411
+
412
+ ์ž…๋ ฅ ์ปจํ…์ŠคํŠธ๋Š” PrefixLM prefix๋กœ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
413
+
414
+ ```text
415
+ instruction / prefix: ์–‘๋ฐฉํ–ฅ attention, loss ์—†์Œ
416
+ response: causal attention, response-only CE loss
417
+ ```
418
+
419
+ ์•„ํ‚คํ…์ฒ˜๋Š” ์›๋ณธ HRM-Text recurrent design์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
420
+
421
+ ```text
422
+ H module: ๋А๋ฆฌ๊ฒŒ ๋ณ€ํ•˜๋Š” ์ „๋žต state
423
+ L module: ๋น ๋ฅด๊ฒŒ ๋ณ€ํ•˜๋Š” ์‹คํ–‰ state
424
+ schedule: H2L3 recurrent computation
425
+ ```
426
+
427
+ ํ•™์Šต ๋ฐฉ์‹, ์•„ํ‚คํ…์ฒ˜, PT/SFT ์ฐจ์ด, staged continuation, checkpoint ์ด๋ฆ„์„ ์‰ฝ๊ฒŒ ํ’€์–ด ์“ด ์ „์ฒด ์„ค๋ช…์€ ํ”„๋กœ์ ํŠธ ๋ฌธ์„œ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ณด๋ฉด ๋ฉ๋‹ˆ๋‹ค.
428
+
429
+ [MODEL_TRAINING_ARCHITECTURE_GUIDE_2026-05-28.md](MODEL_TRAINING_ARCHITECTURE_GUIDE_2026-05-28.md) in https://github.com/LLM-OS-Models/KoHRM-text
430
+
431
+ ### ์ค‘์š”ํ•œ ํ˜ธํ™˜์„ฑ ์•ˆ๋‚ด
432
+
433
+ ํ˜„์žฌ ๊ณต๊ฐœ repo์—๋Š” ๋ณ€ํ™˜๋œ model weight์™€ tokenizer๊ฐ€ ์žˆ์ง€๋งŒ, ์•„์ง Hugging Face `trust_remote_code`์šฉ `HrmTextForCausalLM` ๊ตฌํ˜„ ํŒŒ์ผ์€ ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
434
+
435
+ ํ˜„์žฌ ๋ฐ”๋กœ ๊ฐ€๋Šฅํ•œ ๊ฒƒ:
436
+
437
+ - ์ตœ์‹  ๊ณต๊ฐœ weight ๋‹ค์šด๋กœ๋“œ
438
+ - `tokenizers.Tokenizer.from_file("tokenizer.json")`๋กœ tokenizer ๋กœ๋“œ
439
+ - `config.json` ํ™•์ธ
440
+ - CPU ๋˜๋Š” Colab T4์—์„œ `model.safetensors` ๋ฌด๊ฒฐ์„ฑ ํ™•์ธ
441
+
442
+ ์•„์ง ์ผ๋ฐ˜ Transformers์—์„œ ๋ฐ”๋กœ ์•ˆ ๋˜๋Š” ๊ฒƒ:
443
+
444
+ - `AutoModelForCausalLM.from_pretrained("LLM-OS-Models/KoHRM-Text-1.4B")`
445
+ - ์ด repo๋งŒ์œผ๋กœ one-line text generation ์‹คํ–‰
446
+
447
+ ์ด์œ ๋Š” `model_type: "hrm_text"`๊ฐ€ custom HRM-Text architecture์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๊ณต๊ฐœ generation์„ ํ•˜๋ ค๋ฉด ์ด model repo์— `HrmTextForCausalLM` remote-code wrapper๊ฐ€ ์ถ”๊ฐ€๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
448
+
449
+ ### ๋ชจ๋ธ ์ƒ์„ธ
450
+
451
+ | ํ•ญ๋ชฉ | ๊ฐ’ |
452
+ |---|---:|
453
+ | ๋ชจ๋ธ ID | `LLM-OS-Models/KoHRM-Text-1.4B` |
454
+ | ํ‘œ์ค€ ์ด๋ฆ„ | `KoHRM-Text-1.4B` |
455
+ | ํ•™์Šต ์ถœ๋ฐœ์  | scratch |
456
+ | ์•„ํ‚คํ…์ฒ˜ ๊ณ„์—ด | HRM-Text PrefixLM |
457
+ | ์•„ํ‚คํ…์ฒ˜ ํฌ๊ธฐ | `XL` |
458
+ | ํŒŒ๋ผ๋ฏธํ„ฐ | 1,384,120,320 |
459
+ | ์ปจํ…์ŠคํŠธ ๊ธธ์ด | 4,096 tokens |
460
+ | ํ•™์Šต dtype | bfloat16 |
461
+ | ๊ณต๊ฐœ ๋ณ€ํ™˜๋ณธ dtype | bfloat16 EMA `safetensors` |
462
+ | tokenizer | byte-level BPE, NFC normalization |
463
+ | vocabulary size | 131,072 |
464
+ | objective | PrefixLM response-only loss |
465
+ | optimizer | HRM-Text์˜ Adam-atan2 |
466
+ | EMA | 0.9999 |
467
+
468
+ ๋ณ€ํ™˜๋œ config ์ฃผ์š” ๊ฐ’:
469
+
470
+ ```json
471
+ {
472
+ "model_type": "hrm_text",
473
+ "architectures": ["HrmTextForCausalLM"],
474
+ "vocab_size": 131072,
475
+ "hidden_size": 1536,
476
+ "num_hidden_layers": 32,
477
+ "num_attention_heads": 12,
478
+ "max_position_embeddings": 4096,
479
+ "prefix_lm": true
480
+ }
481
+ ```
482
+
483
+ ### HRM-Text ๋…ผ๋ฌธ ๋Œ€๋น„
484
+
485
+ ํ˜„์žฌ run์€ ๋…ผ๋ฌธ recipe๋ณด๋‹ค ๋” ์˜ค๋ž˜ ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์„ค์ •์ด ์™„์ „ํžˆ ๊ฐ™์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.
486
+
487
+ - ๋…ผ๋ฌธ ๊ธฐ์ค€์€ 16 x H100์ด๊ณ , ํ˜„์žฌ run์€ 8 x H200์ž…๋‹ˆ๋‹ค.
488
+ - KoHRM์€ ์›๋ณธ 65K tokenizer๋ณด๋‹ค ํฐ 131K tokenizer vocab์„ ์”๋‹ˆ๋‹ค.
489
+ - ๊ณต๊ฐœ KoHRM ํฌ๊ธฐ๋Š” ์•ฝ 1.38B parameters์ž…๋‹ˆ๋‹ค.
490
+ - ์•ˆ์ • ์žฅ๊ธฐ run batch๋Š” OOM probe ์ดํ›„ `180,224` tokens/step์œผ๋กœ ์žก์•˜์Šต๋‹ˆ๋‹ค. ๋” ํฐ batch๋Š” ์ดˆ๋ฐ˜์— ๊ฐ€๋Šฅํ•ด ๋ณด์—ฌ๋„ ์žฅ๊ธฐ ์•ˆ์ •์„ฑ์ด ๋–จ์–ด์กŒ์Šต๋‹ˆ๋‹ค.
491
+ - ํ•œ๊ตญ์–ด, ํ„ฐ๋ฏธ๋„, ํˆด์ฝœ, ๋ฒ•๋ฅ , ๊ธˆ์œต, ์œ„ํ‚ค, HRM-cleaned ๋ฐ˜๋ณต stage๊ฐ€ ์ถ”๊ฐ€๋์Šต๋‹ˆ๋‹ค.
492
+
493
+ ์ด๊ฒƒ์ด ์ž๋™์œผ๋กœ ๋ชจ๋“  benchmark ์ ์ˆ˜ ์ƒ์Šน์„ ๋ณด์žฅํ•˜์ง€๋Š” ์•Š์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ ํ•œ๊ตญ์–ด ํ† ํฌ๋‚˜์ด์ € ํšจ์œจ, ํ•œ๊ตญ์–ด ๋ฒ•๋ฅ /๊ธˆ์œต/์œ„ํ‚ค coverage, ํ„ฐ๋ฏธ๋„ trajectory, tool-call formatting, code-oriented behavior ์ชฝ์€ ์›๋ณธ ์˜์–ด/general checkpoint๋ณด๋‹ค ์ข‹์•„์งˆ ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์ตœ์ข… ์ฃผ์žฅ์€ continuation๊ณผ SFT๊ฐ€ ๋๋‚œ ๋’ค ํ‰๊ฐ€๋กœ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
494
+
495
+ ### ํ† ํฌ๋‚˜์ด์ €
496
+
497
+ ํ† ํฌ๋‚˜์ด์ €๋Š” ํ•œ๊ตญ์–ด, ์˜์–ด, ์ฝ”๋“œ, shell/terminal ํ…์ŠคํŠธ, JSON/tool-call ํ˜•์‹์„ ๊ณ ๋ คํ•ด์„œ ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ์ž์ฃผ ์“ฐ๋Š” chat/tool special token์€ ๊ฐ€๋Šฅํ•œ ํ•œ ์•ˆ์ •์ ์ธ ๋‹จ์ผ token์œผ๋กœ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
498
+
499
+ | ์ƒ˜ํ”Œ ์ข…๋ฅ˜ | chars/token |
500
+ |---|---:|
501
+ | ํ•œ๊ตญ์–ด ์ผ๋ฐ˜ | 2.60 |
502
+ | ํ•œ๊ตญ์–ด ๋ฒ•๋ฅ  | 2.36 |
503
+ | ํ•œ๊ตญ์–ด ํ„ฐ๋ฏธ๋„ ์ง€์‹œ | 2.18 |
504
+ | shell command | 2.68 |
505
+ | tool-call JSON | 3.32 |
506
+ | Python code | 3.37 |
507
+ | ์˜์–ด | 4.40 |
508
+
509
+ ํฌ๋งท token:
510
+
511
+ ```text
512
+ <|im_start|> instruction ์‹œ์ž‘
513
+ <|im_end|> instruction ์ข…๋ฃŒ
514
+ <|box_end|> response/end marker
515
+ <|object_ref_start|> direct condition
516
+ <|object_ref_end|> chain-of-thought style condition
517
+ <|quad_start|> noisy condition
518
+ <|quad_end|> synthetic condition
519
+ ```
520
+
521
+ ํ”„๋กœ์ ํŠธ ๋‚ด๋ถ€ inference code๊ฐ€ ์“ฐ๋Š” prompt ํ˜•์‹:
522
+
523
+ ```text
524
+ <|im_start|><|object_ref_start|>์—ฌ๊ธฐ์—_ํ”„๋กฌํ”„ํŠธ๋ฅผ_๋„ฃ์Šต๋‹ˆ๋‹ค<|im_end|>
525
+ ```
526
+
527
+ ### Colab T4 ๋น ๋ฅธ ์ƒ์„ฑ
528
+
529
+ ๋ฐ”๋กœ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” Colab ๋…ธํŠธ๋ถ์€ project repo์— ์žˆ์Šต๋‹ˆ๋‹ค.
530
+
531
+ https://github.com/LLM-OS-Models/KoHRM-text/blob/main/notebooks/KoHRM_Text_1_4B_Colab_T4_Smoke_Test.ipynb
532
+
533
+ ์ด ๋…ธํŠธ๋ถ์€ Colab T4์—์„œ ์ตœ์‹  ๊ณต๊ฐœ ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์งง์€ ์ƒ์„ฑ์„ ์ง์ ‘ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
534
+
535
+ ์ผ๋ถ€ Colab ํ™˜๊ฒฝ์—์„œ `transformers`๊ฐ€ `torchvision::nms` import ์˜ค๋ฅ˜๋ฅผ ๋‚ด๊ฑฐ๋‚˜ custom architecture๋ฅผ ๋ชป ์ฐพ๋Š” ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ, ์ด ๋…ธํŠธ๋ถ์€ `AutoTokenizer`์™€ `AutoModelForCausalLM`์„ ์“ฐ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋Œ€์‹  ์•„๋ž˜ ๊ฒฝ๋กœ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
536
+
537
+ - `tokenizers.Tokenizer.from_file("tokenizer.json")`
538
+ - `safetensors.torch.load_file("model.safetensors")`
539
+ - HRM-Text ๊ตฌ์กฐ๋ฅผ ์ง์ ‘ ๊ตฌํ˜„ํ•œ `kohrm_colab_generate.py`
540
+
541
+ ```python
542
+ !pip -q install -U huggingface_hub hf_transfer tokenizers safetensors
543
+ ```
544
+
545
+ ```python
546
+ from pathlib import Path
547
+ import json
548
+ import importlib.util
549
+ import sys
550
+ from huggingface_hub import snapshot_download
551
+ from tokenizers import Tokenizer
552
+
553
+ repo_id = "LLM-OS-Models/KoHRM-Text-1.4B"
554
+
555
+ repo_dir = Path(snapshot_download(
556
+ repo_id,
557
+ revision="main",
558
+ allow_patterns=[
559
+ "README.md",
560
+ "config.json",
561
+ "tokenizer.json",
562
+ "tokenizer_config.json",
563
+ "special_tokens_map.json",
564
+ "model.safetensors",
565
+ "kohrm_colab_generate.py",
566
+ ],
567
+ ))
568
+
569
+ print("Downloaded to:", repo_dir)
570
+ config = json.loads((repo_dir / "config.json").read_text())
571
+ print("model_type:", config["model_type"])
572
+ print("hidden_size:", config["hidden_size"])
573
+ print("vocab_size:", config["vocab_size"])
574
+ print("context:", config["max_position_embeddings"])
575
+
576
+ tokenizer = Tokenizer.from_file(str(repo_dir / "tokenizer.json"))
577
+ wrapped = "<|im_start|><|object_ref_start|>ํ•œ๊ตญ์–ด๋กœ ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ๊ฐ€์žฅ ํฐ ํŒŒ์ผ 10๊ฐœ๋ฅผ ์ฐพ๋Š” ๋ช…๋ น์„ ์•Œ๋ ค์ฃผ์„ธ์š”.<|im_end|>"
578
+ ids = tokenizer.encode(wrapped).ids
579
+ print("prompt tokens:", len(ids))
580
+ print("first token ids:", ids[:20])
581
+
582
+ spec = importlib.util.spec_from_file_location(
583
+ "kohrm_colab_generate",
584
+ repo_dir / "kohrm_colab_generate.py",
585
+ )
586
+ kohrm = importlib.util.module_from_spec(spec)
587
+ sys.modules["kohrm_colab_generate"] = kohrm
588
+ spec.loader.exec_module(kohrm)
589
+
590
+ output = kohrm.generate_text(
591
+ repo_dir,
592
+ "ํ•œ๊ตญ์–ด๋กœ ํ˜„์žฌ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ ๊ฐ€์žฅ ํฐ ํŒŒ์ผ 10๊ฐœ๋ฅผ ์ฐพ๋Š” bash ๋ช…๋ น์„ ์•Œ๋ ค์ฃผ์„ธ์š”. ๋ช…๋ น๋งŒ ๊ฐ„๋‹จํžˆ ๋‹ตํ•˜์„ธ์š”.",
593
+ max_new_tokens=64,
594
+ max_seq_len=512,
595
+ temperature=0.0,
596
+ )
597
+ print(output)
598
+ ```
599
+
600
+ ์ •์ƒ ๊ฒฐ๊ณผ:
601
+
602
+ - `model_type`์€ `hrm_text`์ž…๋‹ˆ๋‹ค.
603
+ - `vocab_size`๋Š” `131072`์ž…๋‹ˆ๋‹ค.
604
+ - helper๊ฐ€ 1.38B ๊ณต๊ฐœ `model.safetensors` ๋ณ€ํ™˜๋ณธ์„ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
605
+ - Colab T4์—์„œ๋Š” fp16 PyTorch scaled-dot-product attention์œผ๋กœ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
606
+ - ์ฒซ ์‹คํ–‰์€ 2.8 GiB๊ธ‰ weight ๋‹ค์šด๋กœ๋“œ์™€ ๋กœ๋“œ ๋•Œ๋ฌธ์— ๋ช‡ ๋ถ„ ๊ฑธ๋ฆด ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
607
+
608
+ helper๊ฐ€ ์“ฐ๋Š” prompt ํ˜•์‹:
609
+
610
+ ```text
611
+ <|im_start|><|object_ref_start|>PROMPT<|im_end|>
612
+ ```
613
+
614
+ ์ผ๋ฐ˜ `AutoModelForCausalLM.generate()`๋Š” ์•„์ง ์ง€์› ๊ฒฝ๋กœ๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ์ด ๋ชจ๋ธ์€ custom `hrm_text` architecture์ด๋ฏ€๋กœ, ์ผ๋ฐ˜ Transformers generation์€ ์ถ”ํ›„ `trust_remote_code` wrapper๊ฐ€ ์ถ”๊ฐ€๋œ ๋’ค ์ง€์›ํ•˜๋Š” ๊ฒƒ์ด ๋งž์Šต๋‹ˆ๋‹ค. ์ง€๊ธˆ ๊ณต๊ฐœ `model.safetensors`๋กœ ๋ฐ”๋กœ ์ƒ์„ฑํ•˜๋ ค๋ฉด ์œ„ ๋…ธํŠธ๋ถ/helper๋ฅผ ์“ฐ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
615
+
616
+ ### ๋‚ด๋ถ€ raw-checkpoint ์ƒ์„ฑ
617
+
618
+ ํ•™์Šต ๋จธ์‹ ์—์„œ ๋””๋ฒ„๊น…ํ•˜๊ฑฐ๋‚˜ raw FSDP2 checkpoint๋ฅผ ์ •ํ™•ํžˆ ๋ณต๊ตฌํ•ด์„œ ํ‰๊ฐ€ํ•  ๋•Œ๋Š” upstream ์Šคํƒ€์ผ inference ๊ฒฝ๋กœ๋„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
619
+
620
+ - `simple_inference_engine.py`
621
+ - `LLM-OS-Models/KoHRM-Text-1.4B-raw-checkpoints`์˜ raw checkpoints
622
+ - CUDA/FlashAttention ์ค‘์‹ฌ ์‹คํ–‰
623
+
624
+ ์ด ๊ฒฝ๋กœ๋Š” ๋‚ด๋ถ€ continuation/evaluation์šฉ์— ๊ฐ€๊น๊ณ , Colab์—์„œ ๊ฐ€์žฅ ์‰ฝ๊ฒŒ ํ™•์ธํ•˜๋ ค๋ฉด ์œ„ ๊ณต๊ฐœ `model.safetensors` helper๋ฅผ ์“ฐ๋Š” ๊ฒƒ์ด ๋‚ซ์Šต๋‹ˆ๋‹ค.
625
+
626
+ ### ํ•™์Šต ๋ฐ์ดํ„ฐ
627
+
628
+ prepared data๋Š” ์•„๋ž˜ dataset repo์— ์—…๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
629
+
630
+ https://huggingface.co/datasets/LLM-OS-Models/KoHRM-Text-1.4B-prepared-data
631
+
632
+ ํ•™์Šต objective๋Š” PrefixLM response-only loss์ž…๋‹ˆ๋‹ค. instruction/prompt token์€ context๋กœ ๋ณด๊ณ , loss๋Š” response span์—๋งŒ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
633
+
634
+ ์ฃผ์š” prepared data group:
635
+
636
+ | ๋ฐ์ดํ„ฐ ๊ทธ๋ฃน | Tokens | ์šฉ๋„ |
637
+ |---|---:|---|
638
+ | `koterm_pretrain_mix_v1` | 711.3M | stage-0/stage0b |
639
+ | HRM cleaned fast-cap stage1/stage1b | 14.55B | HRM-style instruction pretraining |
640
+ | HRM cleaned full/no-cap stage2 | 14.55B | ์™„๋ฃŒ๋œ continuation |
641
+ | HRM cleaned full/no-cap extra stage2b | 14.55B | ์ง„ํ–‰ ์ค‘์ธ continuation |
642
+ | local terminal conversations | 9.39B | terminal/code/tool-heavy continuation |
643
+ | Korean tool/legal/wiki/finance mix | 3.02B | ํ•œ๊ตญ์–ด domain/tool continuation |
644
+ | BCAI Finance Korean | 857.7M | ํ•œ๊ตญ์–ด ๊ธˆ์œต/domain data |
645
+ | Korean legal/admin task data | 629.0M | ํ•œ๊ตญ์–ด ๋ฒ•๋ฅ /ํ–‰์ • data |
646
+ | Korean Wikipedia | 462.5M | ํ•œ๊ตญ์–ด ์ผ๋ฐ˜ ํ…์ŠคํŠธ |
647
+ | ToolBench train tool-call data | 127.0M | tool-call pretraining |
648
+ | SWE-ZERO + GLM reasoning subsets | 251.2M | code/reasoning data |
649
+
650
+ ํ‰๊ฐ€ ์„ฑ๊ฒฉ ๋ฐ์ดํ„ฐ๋Š” ํ™•์ธ๋˜๋Š” ๋ฒ”์œ„์—์„œ train์—์„œ ์ œ์™ธํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์‹œ๋Š” ToolBench eval, Terminal Bench ๊ณ„์—ด ํ‰๊ฐ€ ๋ฐ์ดํ„ฐ, benchmark ์„ฑ๊ฒฉ์˜ `chi-bench`์ž…๋‹ˆ๋‹ค.
651
+
652
+ ### ํ•™์Šต ์ง„ํ–‰
653
+
654
+ ํ˜„์žฌ run์€ staged continuation ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.
655
+
656
+ ```text
657
+ stage0
658
+ -> stage0b
659
+ -> stage1
660
+ -> stage2
661
+ -> stage3
662
+ -> stage4
663
+ -> stage1b
664
+ -> stage2b
665
+ -> stage3b
666
+ -> stage4b
667
+ -> stage1c
668
+ -> stage2c
669
+ -> stage3c
670
+ -> stage4c
671
+ ```
672
+
673
+ checkpoint๋Š” model weights, optimizer state, EMA weights, recurrent carry state๋ฅผ ์ด์–ด๊ฐ‘๋‹ˆ๋‹ค. `resume_step_offset`๊ณผ `total_steps_override`๋ฅผ ์จ์„œ stage๋งˆ๋‹ค learning-rate schedule์ด ๋ฆฌ์…‹๋˜์ง€ ์•Š๊ณ  ๊ธด pretraining run์ฒ˜๋Ÿผ ์ด์–ด์ง€๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.
674
+
675
+ 2026-05-27 ๊ธฐ์ค€ `stage2b`๊ฐ€ ์ง„ํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค. continuation watcher๊ฐ€ ์ดํ›„ `stage3b -> stage4b -> stage1c -> stage2c -> stage3c -> stage4c`๋ฅผ ์ด์–ด์„œ ์‹คํ–‰ํ•˜๋„๋ก ์˜ˆ์•ฝ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. handoff๋Š” ๊ฐ stage์˜ ์‹ค์ œ `epoch_1_info.json` `global_step`์„ ์ฝ๊ณ  ๋‹ค์Œ stage๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
676
+
677
+ ### ์‚ฌ์šฉ ๋ชฉ์ 
678
+
679
+ ์ด checkpoint๋Š” ๋‹ค์Œ ๋ชฉ์ ์— ์ ํ•ฉํ•ฉ๋‹ˆ๋‹ค.
680
+
681
+ - continued pretraining ์‹คํ—˜
682
+ - ํ•œ๊ตญ์–ด tokenizer ๋ฐ HRM-Text architecture ์‹คํ—˜
683
+ - terminal/tool-call/code pretraining ์—ฐ๊ตฌ
684
+ - checkpoint conversion ๋ฐ evaluation ์ž‘์—…
685
+
686
+ ์•„์ง ์™„์„ฑ๋œ assistant model์€ ์•„๋‹™๋‹ˆ๋‹ค.
687
+
688
+ ### ์ œํ•œ ์‚ฌํ•ญ
689
+
690
+ - ์ค‘๊ฐ„ checkpoint์ด๋ฉฐ ์ตœ์ข… aligned instruct model์ด ์•„๋‹™๋‹ˆ๋‹ค.
691
+ - ์ „์ฒด planned continuation์ด ์•„์ง ๋๋‚˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
692
+ - ์ตœ์ข… SFT์™€ safety tuning์ด ์•„์ง ๋๋‚˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
693
+ - ์ƒˆ checkpoint์˜ public benchmark score๋Š” ์•„์ง final์ด ์•„๋‹™๋‹ˆ๋‹ค.
694
+ - ์ผ๋ฐ˜ Transformers generation์€ custom `hrm_text` modeling wrapper ๋˜๋Š” remote-code file์ด ์ถ”๊ฐ€๋˜์–ด์•ผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.
695
+ - tool-call JSON ์œ ํšจ์„ฑ๊ณผ terminal action safety๋Š” ์‹ค์ œ ์‚ฌ์šฉ ์ „์— ๋ณ„๋„ ํ‰๊ฐ€๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
696
+
697
+ ### ์ธ์šฉ
698
+
699
+ ์ด ์ž‘์—…์€ HRM-Text architecture์™€ training stack์„ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.
700
+
701
+ - ๋…ผ๋ฌธ: https://arxiv.org/html/2605.20613
702
+ - ์›๋ณธ ์ฝ”๋“œ: https://github.com/sapientinc/HRM-Text
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "hrm_text",
3
+ "architectures": [
4
+ "HrmTextForCausalLM"
5
+ ],
6
+ "vocab_size": 131072,
7
+ "hidden_size": 1536,
8
+ "intermediate_size": 4096,
9
+ "num_hidden_layers": 32,
10
+ "num_attention_heads": 12,
11
+ "num_key_value_heads": 12,
12
+ "head_dim": 128,
13
+ "H_cycles": 2,
14
+ "L_cycles": 3,
15
+ "L_bp_steps": [
16
+ 0,
17
+ 3
18
+ ],
19
+ "max_position_embeddings": 4096,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_theta": 10000.0,
22
+ "tie_word_embeddings": false,
23
+ "initializer_range": 0.025515518153991442,
24
+ "embedding_scale": 39.191835884530846,
25
+ "prefix_lm": true,
26
+ "pad_token_id": 0,
27
+ "bos_token_id": 2,
28
+ "eos_token_id": 35
29
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f71fd3bf7d9862dac724795cbf8557026d3fe6613b89094ce1529637f2a1bfbc
3
+ size 2768259784
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8f544a7ef438e3589b0448ca9532824cbcb2fa43e6ad36642781803490f7ffb
3
+ size 11458193
tokenizer_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|im_start|>",
4
+ "eos_token": "<|box_end|>",
5
+ "is_local": true,
6
+ "model_max_length": 1000000000000000019884624838656,
7
+ "tokenizer_class": "TokenizersBackend"
8
+ }