File size: 19,979 Bytes
2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 2948983 f6e614c 33080a1 f6e614c 2948983 f6e614c 4a3cd2f 0194e59 f6e614c c07793c bf8ae1c c07793c bf8ae1c c07793c 50549ab c07793c 50549ab c07793c 50549ab c07793c 5aff889 c07793c 5aff889 0dcf39e 5aff889 c07793c 5aff889 6ab8274 e3c0c6e 6ab8274 0dcf39e f6e614c 2948983 f6e614c 5094348 c4c9192 bb698e6 c4c9192 adb3b10 c4c9192 bb698e6 f6e614c 4a3cd2f 0194e59 f6e614c 4a3cd2f c07793c f6e614c 2948983 f6e614c 2948983 f6e614c c07793c 6ab8274 0dcf39e 4a3cd2f 0194e59 9be8fa9 52585d7 5094348 c4c9192 bb698e6 f6e614c | 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 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | ---
language:
- ko
- en
library_name: pytorch
license: other
pipeline_tag: feature-extraction
tags:
- online-handwriting
- mathematical-expression-recognition
- trajectory
- temporal-convolution
- on-device
- pytorch
---
# AIFlow Math Ink 0.6
AIFlow Math Ink 0.6์ ์ํ ํ๊ธฐ๋ฅผ **์ด๋ฏธ์ง๋ณด๋ค point/stroke sequence๋ก ๋จผ์ ์ฒ๋ฆฌํ๋** ์จ๋๋ฐ์ด์ค ์ฐ๊ตฌ ๋ชจ๋ธ์ด๋ค. ์๋ณธ touch event๋ฅผ ๋ณด์กดํ๋ฉด์ ๋ชจ๋ธ ์
๋ ฅ๋ง 6Hz canonical tap์ผ๋ก ์ฌํ๋ณธํํ๊ณ , ๊ฐ ๊ณ ๋ฆฝ ๊ธฐํธ์ 378-class top-k์ visual-family ํ๋ฅ ์ ๋ฐํํ๋ค.
ํ์ฌ ๊ณต๊ฐ๋ณธ์ seed 17ยท31ยท47์ ์ฐ๊ตฌ checkpoint์ grouping/behavior head๋ฅผ ํฌํจํ๋ค. ์ ์ฒด ์์ LaTeX decoder๋ ์์ฑ๋ Android LiteRT ๋ฐฐํฌ๋ณธ์ ์๋๋ค.

## ํต์ฌ ์
๋ ฅ ๊ณ์ฝ

์ค์ ํ ์
๋ ฅ์ ๋ค์ ์์๋ก ์ฒ๋ฆฌํ๋ค.
1. ๊ธฐ๊ธฐ์ ๋ชจ๋ touch event๋ฅผ ์๋ณธ timestamp์ ํจ๊ป ๋ฉ๋ชจ๋ฆฌ์ ๋ณด์กดํ๋ค.
2. stroke๋ณ ์์์ ยท๋์ ยทpen-up์ ํ์ anchor๋ก ๋จ๊ธด๋ค.
3. ๋ชจ๋ธ์ฉ temporal view๋ง 6Hz๋ก ์ฌํ๋ณธํํ๋ค.
4. ์ข
ํก๋น๋ฅผ ๋ณด์กดํด 128ร128 ink space์ ์ค์ ์ ๊ทํํ๋ค.
5. ์ต๋ 128 event, 19๊ฐ feature๋ฅผ `128ร19` tensor๋ก ๋ง๋ ๋ค.
19๊ฐ channel:
```text
shape_x, shape_y,
canvas_x, canvas_y,
direction_x, direction_y,
curvature, pen_up, stroke_progress,
aspect_ratio,
bbox_top, bbox_bottom, bbox_height, center_y,
baseline_available,
time_delta, speed, missing_mask, source_modality
```
- timestamp๊ฐ ์ค์ ๋ก ์์ผ๋ฉด `timestamp_mode=observed`
- ์ ์ ์ด๋ฏธ์ง์ฒ๋ผ ์๊ฐ์ด ์์ผ๋ฉด `timestamp_mode=canonical`, `missing_mask=1`
- ์ถ์ ์๊ฐ์ ์ค์ ๊ด์ธก ์๊ฐ์ฒ๋ผ ์ ์ฅํ์ง ์๋๋ค.
## ๋ชจ๋ธ ๊ตฌ์กฐ
```text
Online stroke
โ 6 Hz canonical taps (128ร19)
โ online dual-TCN adapter
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
Raster 128ร128 โ
โ spatial encoder โ
โ causal virtual-trajectory decoder โ
โ top-4 stroke hypotheses โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โผ
shared residual TCN (hidden=128)
โโ exact head: 378 labels
โโ family head: 324 families
โโ top-k probabilities
Local formula context + stroke tensor
โ 49-d context MLP + stroke TCN
โ identifier_lower / identifier_upper / multiply_operator
Segmentation lattice geometry
โ boundary behavior head
โ candidate crosses a symbol boundary?
```
Raster ๊ฒฝ๋ก๋ ์ต์ข
label shortcut์ ์ฌ์ฉํ์ง ์๋๋ค. ์ด๋ฏธ์ง์์ top-4 virtual stroke๋ฅผ ๋ง๋ ํ ๋์ผ trajectory encoder๋ก ๋ค์ ์ธ์ํ๋ค.
## ๊ณต๊ฐ checkpoint
๊ฐ seed๋ ์ธ ํ์ผ๋ก ๊ตฌ์ฑ๋๋ค.
```text
models/
seed17/
base_378.pt
online_adapter.pt
behavior_role_head.pt
seed31/
...
seed47/
...
artifacts/
boundary_behavior_guard.joblib
```
| ํ์ผ | ์ญํ | ์ฃผ์ ๊ณ์ฝ |
|---|---|---|
| `base_378.pt` | ๊ณตํต trajectory/raster base | hidden 128, top-4 hypothesis, 378 exact, 324 family |
| `online_adapter.pt` | ์ค์ ์จ๋ผ์ธ stroke ๋ณด์ | `dual_tcn_v3`, `top4-skeleton-128x19` |
| `behavior_role_head.pt` | `x/X/ร` ์ญํ ๋ฌธ๋งฅ | 128ร19 stroke + 49 context feature |
| `boundary_behavior_guard.joblib` | ์๋ชป๋ ๋ค๊ธฐํธ ๋ณํฉ ์ต์ | geometry 17 feature, threshold 0.5, weight 6 |
์ธ seed teacher๋ฅผ ๊ทธ๋๋ก ๋ชจ๋ฐ์ผ์ ๋ฃ๋ ๊ฒ์ด ์ต์ข
๋ชฉํ๋ ์๋๋ค. release ๊ฒฝ๋ก๋ seed ensemble์ ํ๋์ student๋ก distillationํ ๋ค LiteRT INT8/FP16์ ๋น๊ตํ๋ ๊ฒ์ด๋ค.
## Checkpoint metadata ํ์ธ
์๋ ์ฝ๋๋ network๋ฅผ ์คํํ์ง ์๊ณ checkpoint ๊ณ์ฝ์ ํ์ธํ๋ค.
```python
from pathlib import Path
import torch
root = Path("models/seed17")
base = torch.load(root / "base_378.pt", map_location="cpu", weights_only=False)
adapter = torch.load(root / "online_adapter.pt", map_location="cpu", weights_only=False)
role = torch.load(root / "behavior_role_head.pt", map_location="cpu", weights_only=False)
print(base["model_version"])
print(base["max_events"], base["sample_hz"])
print(len(base["feature_names"]), len(base["exact_labels"]), len(base["family_labels"]))
print(adapter["adapter_architecture"], adapter["feature_contract"])
print(role["role_labels"], role["context_features"])
```
์ค์ Python composite ์ถ๋ก ์ Colab bundle์ ํผ ๋๋ ํฐ๋ฆฌ์์ ๋ค์์ฒ๋ผ ์คํํ๋ค. Adapter๋ฅผ ์๋ตํ๋ฉด ์ ์ ๋ ๋ฉ์ธ ๋ชจ๋ธ์ด ์๋๋ผ base-only ๊ฒฝ๋ก๊ฐ ๋๋ฏ๋ก ๋ฐ๋์ ํจ๊ป ์ ๋ฌํ๋ค.
```python
from pathlib import Path
from math_grid_drawer.research.math_ink_06 import MathInk06Engine
engine = MathInk06Engine(
Path("artifacts/base_378.pt"),
adapter_checkpoint=Path("artifacts/online_adapter.pt"),
)
result = engine.recognize_online(
strokes,
canvas_width=128,
canvas_height=128,
top_k=5,
)
```
Checkpoint ๋ด๋ถ ๊ฒฝ๋ก๋ lineage ๊ธฐ๋ก์ด๋ฉฐ ๋ก์ปฌ ์ ๋๊ฒฝ๋ก์ ์์กดํด ์ถ๋ก ํ์ง ์๋๋ค.
## ํ์ฌ ์ฑ๋ฅ
### 378-label trajectory classifier
์ต์ online case-context seed 17 ๊ธฐ์ค:
| split | top-1 | top-5 | family top-1 |
|---|---:|---:|---:|
| writer validation, 4,261 samples | 86.13% | 99.48% | 92.94% |
| paired writer-disjoint test, 3,782 samples | 82.87% | 97.73% | 91.22% |
Paired source๋ HWRT ๋ด๋ถ writer hash split๊ณผ UJI Pen v1/v2 writer-disjoint ๊ณ์ฝ์ ์ฌ์ฉํ๋ค. HWRT official test๋ ๊ฑฐ๋ writer ์ค๋ณต ๋๋ฌธ์ ์ ์ธํ๋ค.
### ์์ ํ๋ head
์ ๋ต symbol grouping ์ดํ์ CROHME ์กฐ๊ฑด๋ถ ์ญํ ํ๊ฐ:
| ์งํ | 3-seed ํ๊ท |
|---|---:|
| role accuracy | 93.33% |
| macro-F1 | 76.41% |
| lowercase identifier recall | 95.66% |
| uppercase identifier recall | 55.91% |
| multiplication recall | 88.89% |
| ECE | 4.88% |
ํ๋ head๋ฅผ ์ค์ teacher ์ถ๋ ฅ ๋ค์ ์ฐ๊ฒฐํ๊ณ validation์์๋ง confidence threshold๋ฅผ ์ ํํ ๊ฒฐ๊ณผ, CROHME official test์ ๋์ ๊ธฐํธ exact top-1์ 33.65%์์ 47.30%๋ก ํ๊ท **13.65%p** ์์นํ๋ค. Rewrite precision์ 81.35%์๋ค. ๋ค๋ง ๊ฐ์ ๊ตฌ๊ฐ์ teacher visual-family top-1์ด 53.02%์ ๋ถ๊ณผํด, ํ๋ ๋ฌธ๋งฅ๋ง์ผ๋ก ์๋ชป๋ ํํ๊ตฐ์ ๋ณต๊ตฌํ ์ ์์๋ค.
### R-track ์ฐ์ ์์ ์ด๋ํฐ
์ ํ trajectory encoder์ online adapter๋ ๊ณ ์ ํ๊ณ , CROHME ์ฐ์์์ ์ ๋ต symbol group ์์์ 92KB zero-init formula adapter๋ง ํ์ตํ๋ค. ์ด checkpoint๋ ๊ตฌ์กฐ ๊ฒ์ฆ์ฉ **R_noncommercial_only** ๋ชจ๋ธ์ด๋ฉฐ ์ ํ weight ๋๋ distillation ์
๋ ฅ์ด ์๋๋ค.
| 3-seed ์งํ | ํ๊ท | ์ต์ |
|---|---:|---:|
| writer-validation exact top-1 | 85.19% | 82.91% |
| writer-validation visual-family top-1 | **93.30%** | **93.03%** |
| official test exact top-1 | 82.38% | 81.13% |
| official test visual-family top-1 | 88.17% | 88.03% |
| visual-family ์ผ๋ฐํ gap | 5.13%p | โ |
Validation์์๋ ์ธ seed ๋ชจ๋ ํํ๊ตฐ 92%๋ฅผ ๋๊ฒจ ํ์ฌ TCN ๊ตฌ์กฐ๊ฐ ์ฐ์ ์์์๋ ์ ์ํ ์ ์์์ ํ์ธํ๋ค. ๋ฐ๋ฉด unseen official test์์๋ ๋ชจ๋ ์คํจํ๋ค. ํ ๋ณ๋ชฉ์ ๋ชจ๋ธ ์ฉ๋๋ณด๋ค writer/source domain ์ผ๋ฐํ์ด๋ฉฐ, ๋ค์ gate๋ ์์ฉ ํ์ฉ P-track ์ฐ์์์ writer/device-disjoint ์ฌํ์ต์ด๋ค.
### P ๊ณ ๋ฆฝ๊ธฐํธ ํฉ์ฑ ์์ proxy โ ๊ธฐ๊ฐ
์น์ธ HWRT/UJI trajectory 1,590๊ฐ๋ฅผ ์ซ์ anchor ์ฌ์ด์ ํฉ์ฑ ๋ฐฐ์นํด ํ๋ head์ weight 0.35๋ก ์ถ๊ฐํ seed-17 ์คํ์ accuracy๊ฐ 93.07%๋ก ๊ฐ์์ง๋ง macro-F1 76.64โ73.62%, uppercase recall 61.29โ45.16%๋ก ์
ํ๋๋ค. ์ค์ ์ฐ์์ validation๊ณผ ๋น๊ตํ formula-relative bbox width/height์ ์ต๋ ์ ๋ SMD๋ 2.82๋ก ํธํ ๊ธฐ์ค 0.5๋ฅผ ํฌ๊ฒ ๋์๋ค.
๊ณ ๋ฆฝ๊ธฐํธ์๋ ์ ์ฒด formula bboxยทTrayยท์ด์ ๋ถ์ฌ ๋ถํฌ๊ฐ ์์ผ๋ฏ๋ก ์์ ํฉ์ฑ ๋ฐฐ์น๋ฅผ ํ๋/formula ์ ํ ํ์ต์ ์ฌ์ฉํ์ง ์๋๋ค. ์ด ๊ฒฝ๋ก๋ `rejected_no_3seed_expansion`์ด๋ฉฐ ์คํจ checkpoint๋ ๋ฐฐํฌํ์ง ์๋๋ค. ์น์ธ ๊ณ ๋ฆฝ๊ธฐํธ๋ shape encoder์๋ง ์ ์งํ๊ณ , ํ๋ ํ์ต์ ์ค์ `AIFlow P Formula v1` ์ฐ์์์ ๊ธฐ๋ค๋ฆฐ๋ค.
### Grouping boundary head
| ์งํ | ์ด์ | boundary ์ ์ฉ |
|---|---:|---:|
| CROHME exact partition | 60.04% | 60.25% |
| pair-F1 | 91.07% | 91.26% |
| overmerge formula rate | 21.72% | 20.49% |
### P boundary shared-state ์ ์
์ด๊ธฐ ๊ณต๊ฐ P delta๋ `online_adapter.pt`์ `shared_state_dict`๋ฅผ ์ ์ฉํ์ง ์์ loader ๊ฒฐํจ์ ์์ํ๋ค. ์ด ๋๋ฌธ์ ๊ฐํ main encoder๋ฅผ ๋น ๋จ๋ฆฐ ๋ฎ์ ๊ธฐ์ค์ ๊ณผ ๋น๊ตํ์ผ๋ฉฐ, ํด๋น auxiliary/joint checkpoint์ ์ฑ๋ฅ ์ฃผ์ฅ์ ์ฒ ํํ๋ค.
์ฌ๋ฐ๋ฅธ ํฉ์ฑ ์์์ธ `base โ adapter shared state โ modality adapter โ optional head`๋ก ์ธ seed๋ฅผ ๋ค์ ํ์ตํ ๊ฒฐ๊ณผ๋ ๋ค์๊ณผ ๊ฐ๋ค.
| paired proxy test | ์ ์ ๋ main baseline | joint ๊ฒฐ๊ณผ | ๋ณํ |
|---|---:|---:|---:|
| exact top-1 | **83.03%** | 82.81% | -0.22%p |
| family top-1 | **91.37%** | 90.88% | -0.49%p |
| single-symbol recall | โ | 92.83% | 95% floor ์คํจ |
| cross-boundary recall | โ | 98.47% | ํต๊ณผ |
์ธ seed ๋ชจ๋ release gate๋ฅผ ์คํจํ์ผ๋ฏ๋ก joint delta๋ ๋ฐฐํฌํ์ง ์๋๋ค. ํ์ฌ ์ ํจํ main ๊ตฌ์ฑ์ seed๋ณ `base_378.pt + online_adapter.pt`์ด๋ฉฐ adapter ์์ `shared_state_dict`๋ฅผ ๋ฐ๋์ ๋จผ์ ์ ์ฉํด์ผ ํ๋ค.
Joint delta ์๋ main+shadow auxiliary device stress์์ ์ต์
exact/family ํ๋ฝ์ affine ๋ณํ์ -0.98%p/-1.08%p์๋ค. Software stress๋ ํต๊ณผํ์ง๋ง clean single recall์ด 91.42~94.50%์ด๋ฏ๋ก auxiliary head๋ ์ ํ ์ฑํ ๋์์ด ์๋๋ค.
### Composite torch.export
Export ๊ทธ๋ํ๋ ์ด์ base-only๊ฐ ์๋๋ผ online/raster modality adapter์ shared state๋ฅผ ํฌํจํ๋ค. ์ธ seed ๋ชจ๋ ๊ฐ ๊ฒฝ๋ก ๋ํ ์
๋ ฅ 76๊ฐ์์ eager ๋๋น top-1 100% ์ผ์น, ์ต๋ logit ์ ๋์ค์ฐจ 0.0์ ๊ธฐ๋กํ๋ค. Validation-only calibration์ผ๋ก ๊ณ ์ ๋ online family-fusion 0.15๋ export์ ํฌํจ๋๋ค. Fresh seed-17 online/raster `.pt2` ํฉ๊ณ๋ 24,300,116 bytes๋ค.
`.pt2`๋ Android์ฉ `.tflite`๊ฐ ์๋๋ค. LiteRT Torch 0.9.1 ๋ณํ๊ณผ Android runtime parity๋ ์์ง ์๋ฃ๋์ง ์์์ผ๋ฏ๋ก `litert_exported=false`๋ฅผ ์ ์งํ๋ค.
### CPU latencyยทmemory proxy
Family-fusion 0.15๋ฅผ ํฌํจํ Windows PyTorch CPU ์ฌ์ธก์ ์์ online p95๋ 8.90~9.67ms, raster p95๋ 22.10~26.63ms์๋ค. Tensor state๋ 8.95MB, ๋ชจ๋ธ ๋ก๋ ํ inference RSS ์ฆ๊ฐ๋ถ์ ํฉ์น ๊ตฌ์กฐ proxy๋ 26.39MB๋ค. ์ ์ฒด Python process RSS๋ PyTorch runtime์ ํฌํจํ๋ฏ๋ก Android LiteRT memory ๊ทผ๊ฑฐ๊ฐ ์๋๋ค.
### Online ์ค๋ฅ ํฉ์ ๊ฐ์ฌ
์ ์ composite ์ธ seed๋ฅผ ์ ํ์ ์ฐ์ง ์์ paired writer/device-disjoint 3,782๊ฐ์์ ๋ค์ ๊ฐ์ฌํ๋ค.
| ์งํ | ๊ฒฐ๊ณผ |
|---|---:|
| exact ensemble top-1 | 83.71% |
| exact ensemble top-5 | 98.02% |
| visual-family top-1 | **92.99%** |
| seed oracle top-1 | 88.05% |
| ์ธ seed ๊ณตํต ์ค๋ฅ | 11.95% |
Exact ์ค๋ฅ์ 56.98%(์ ์ฒด 9.28%p)๋ `O/0/o`, ๋์๋ฌธ์, ์์ง์ ยทcross์ฒ๋ผ ๊ฐ์ visual family ์์ ์๋ฏธ ํผ๋์ด๋ค. ๋ฐ๋ผ์ 0.6์ trajectory ๋จ๊ณ๋ ํํ๊ตฐ ํ๋ณด๋ฅผ ๋ฐํํ๊ณ , exact ์๋ฏธ๋ ์ค์ ์์ ํ์ ์๋ ํฌ๊ธฐ์ ํ๋ ๋ฌธ๋งฅ์ด ๊ฒฐ์ ํด์ผ ํ๋ค. ์ค์ P ์ฐ์์์ด ์์ผ๋ฏ๋ก formula-context exact 92% gate๋ ์์ง ํต๊ณผํ์ง ์์๋ค.
Validation์์ family-fusion 0.15๋ฅผ ์ ํํ ๋ค paired-test์ ํ ๋ฒ ์ ์ฉํ์ exact top-1์ 83.71โ83.82%(+0.11%p)์๋ค. ์ด๋ ์์ ๋ณด์ ์ด๋ฉฐ ๋ฌธ๋งฅ ๋ ์ด์ด๋ฅผ ๋์ฒดํ์ง ์๋๋ค.
## ์ถ๋ ฅ ๋ฒ์
์๋ํ ๋ชจ๋ฐ์ผ API:
```text
recognizeOnline(strokes, canvas) โ SymbolResult
recognizeRaster(bitmap) โ SymbolResult
SymbolResult:
candidates[{token, probability}]
confidence
modelVersion
latencyMs
```
์ด๋ฏธ์ง, raw stroke, virtual stroke๋ ์๋ฒ payload๋ก ์ ์กํ์ง ์๋๋ค. virtual hypotheses๋ ๋ก์ปฌ debug์์๋ง ๋
ธ์ถํ๋ค.
## Local P Formula intake
Drawer์ local-only `AIFlow Ink v1`์ ์๋์ผ๋ก ํ์ต ์ ๋ต์ด ๋์ง ์๋๋ค. ๋ณ๋ human annotation JSONL์ด ์ค์ ๋น์๋ณ `device_id`, `label_status=human_verified`, ๋ชจ๋ `formula_cell_id โ token` ์ ๋จ์ฌ๋ฅผ ์ ๊ณตํด์ผ ํ๋ค.
Materializer๋ ๋ค์ ์กฐ๊ฑด์ ๋ชจ๋ ํต๊ณผํ ๋ค์๋ง UTF-8 P Formula v1 JSONL์ ์์์ ์ผ๋ก ์์ฑํ๋ค.
- ๋ชจ๋ raw stroke๊ฐ ์ ํํ ํ symbol group์ ํฌํจ๋จ
- timestampยทpressure ๊ฒฐ์ธก์ ์๋ณธ ๊ทธ๋๋ก ๋ณด์กด
- ๊ธฐ์ค checkpoint์ ์ค๋ณต ์๋ 378 exact vocabulary์ token ์ผ์น
- origin/writer/device/source split ๋์ 0
- training/validation/test์ P ๊ถ๋ฆฌยท๋
๋ฆฝ source gate ํต๊ณผ
์ ์ฒด AIFlow source checkout์์ ์คํํ๋ค.
```powershell
python scripts/materialize_math_ink_06_p_formula.py `
--input path/to/curated `
--annotations path/to/annotations.jsonl `
--checkpoint path/to/base_378.pt `
--output path/to/p_formula_v1.jsonl `
--report path/to/preflight.json
```
์คํจ ์ report๋ง ๋จ๊ณ dataset์ ์์ฑ๋์ง ์๋๋ค. ์ด ๊ธฐ๋ฅ์ ์๋ฒ ์ ์ก์ด๋ ์๋ ์์ง์ ์ํํ์ง ์๋๋ค.
### P-only formula adapter training
Materialize๋ P Formula v1์ ์ ์ฒด formula bbox ๊ธฐ์ค 128ร19 symbol tensor๋ก ๋ณํ๋๋ค. Product encoder์ online adapter๋ ๋๊ฒฐํ๊ณ hidden-64 zero-init formula adapter๋ง ํ์ตํ๋ค.
```text
family CE + exact CEร0.10
context dropout 0.30
inverse-sqrt(source frequency ร exact-label frequency) sampler
validation-only checkpoint selection
```
๊ฐ seed๋ test exact top-1 92%, top-5 99%, macro-F1 90%, writer floor 75%, ๊ฒฐ์ธก metadata slice ํ๋ฝ 3%p ์ดํ๋ฅผ ๋ชจ๋ ํต๊ณผํด์ผ ํ๋ค. Seed 17ยท31ยท47์ด ๊ฐ๋ณ ํต๊ณผํ๊ณ ์ธ run์ ์๋ณธ P Formula JSONL SHA-256์ด ์ ํํ ๊ฐ์ ๊ฒฝ์ฐ์๋ง single mobile student distillation์ ํ์ฉํ๋ค. Teacher ensemble ์์ฒด๋ ๊ธฐ๊ธฐ์ ํ์ฌํ์ง ์๋๋ค.
์ค์ seed-17 composite์ GTX 1650์ ์ฌ์ฉํ 1-epoch fixture smoke์์ CUDA ํ์ต๋ถํฐ report/checkpoint ์์ฑ๊น์ง ํต๊ณผํ๋ค. Fixture checkpoint๋ ์ฑ๋ฅ ๊ทผ๊ฑฐ๊ฐ ์๋๋ฏ๋ก ์ด ๊ณต๊ฐ ์ ์ฅ์์ ํฌํจํ์ง ์์๋ค. ๊ณ ์ recipe๋ [`configs/MATH-INK-06-P-FORMULA-v1.json`](configs/MATH-INK-06-P-FORMULA-v1.json)์ ์๋ค.
### Single-student distillation
ํต๊ณผํ ์ธ teacher๋ base โ shared online adapter โ P formula adapter ์์๋ก ํฉ์ฑํ๋ค. Temperature 2.0์ exact/family ํ๋ฅ ์ seed ์ฌ์ด์์ ํ๊ท ํ๊ณ KL + hard-label CE๋ก hidden-64 formula adapter ํ๋๋ง ํ์ตํ๋ค. Student checkpoint์๋ teacher weight๋ฅผ ํฌํจํ์ง ์๋๋ค.
Student๋ ์์ฒด 92/99ยทmacro-F1ยทwriter/missing gate๋ฟ ์๋๋ผ teacher ensemble ๋๋น exact top-1ยทtop-5ยทvisual-family ํ๋ฝ 1%p ์ดํ๋ฅผ ๋ชจ๋ ๋ง์กฑํด์ผ ํ๋ค. 2/2/2-symbol fixture์ 3-teacherโstudent CUDA ์คํ ๊ฒฝ๋ก๋ ํต๊ณผํ์ง๋ง ์ ์ student gate๋ ์คํจํ๋ค. Fixture์ checkpoint๋ ์ด ๊ณต๊ฐ ์ ์ฅ์์ ์์ผ๋ฉฐ, ์ค์ P ๋ฐ์ดํฐ ์ฑ๋ฅ์ด๋ ์ ํ ๊ฒ์ฆ์ ๋ปํ์ง ์๋๋ค. LiteRT ๋ณํ๋ ์์ง ์ํํ์ง ์์๋ค.
## ์๋ ค์ง ํ๊ณ
- 378-label paired writer/device-disjoint top-1 ๋ชฉํ 92%์ ์์ง ๋ฏธ๋ฌํ๋ค.
- ์ ์ฒด ์์ LaTeX, Tray decoder, gridding์ 0.7 ๋ฒ์๋ค.
- uppercase ์ญํ recall๊ณผ `O/0`, styled-letter hard family๊ฐ ๋จ์ ๋ณ๋ชฉ์ด๋ค.
- ํ๋ exact gate๋ ์ ํจํ์ง๋ง, ์ฐ์์ teacher ํํ๊ตฐ์ด ํ๋ฆฌ๋ฉด ์ญํ head๊ฐ ๋ณต๊ตฌํ ์ ์๋ค.
- R-track formula adapter๋ validation ํํ๊ตฐ 93.30%๋ฅผ ๋ฌ์ฑํ์ผ๋ official test 88.17%์ ๊ทธ์ณ ์ ํ ๊ฒ์ฆ์ ํต๊ณผํ์ง ๋ชปํ๋ค.
- ์น์ธ P ๊ณ ๋ฆฝ๊ธฐํธ ํฉ์ฑ ํ๋ proxy๋ layout SMD ์ต๋ 2.82์ uppercase recall ํ๋ฝ ๋๋ฌธ์ ๊ธฐ๊ฐํ๋ค.
- raster virtual-stroke ๊ฒฝ๋ก๋ digit/Greek slice์์๋ ๊ฐ์ ๋์ง๋ง 378-label release gate๋ฅผ ํต๊ณผํ์ง ๋ชปํ๋ค.
- boundary/behavior/formula adapter๋ CROHME R-track ํ์ต๋ฌผ์ด๋ฏ๋ก ์ ํ weight๋ก distillํ ์ ์๋ค.
- P boundary auxiliary/joint๋ shared-state ์ ์ ํ ์ธ seed release gate๋ฅผ ์คํจํด checkpoint๋ฅผ ์ฒ ํํ๋ค.
- Device stress๋ ์ฑํ๋์ง ์์ shadow auxiliary์ software perturbation ๊ฒฐ๊ณผ์ด๋ฉฐ ์ค์ stylus/device-disjoint ์ฑ๋ฅ ๊ทผ๊ฑฐ๊ฐ ์๋๋ค.
- Android LiteRT ๋ณํ, PyTorch/LiteRT logit parity, ์ ๊ฐยท์ค๊ธยท๊ณ ๊ธ ๊ธฐ๊ธฐ benchmark๊ฐ ๋จ์ ์๋ค.
## ๋ฐ์ดํฐ์ ๊ถ๋ฆฌ
์ด ์ ์ฅ์์๋ ์๋ณธ ํ๊ธฐ ๋ฐ์ดํฐ, ์ด๋ฏธ์ง, OCR cache๋ฅผ ํฌํจํ์ง ์๋๋ค.
- HWRT database: ODbL-1.0 ์ทจ๊ธ, attribution ๋ฐ ํ์ database ๊ฒํ ํ์
- UJI/Pendigits ๊ณ์ด: ๊ฐ ์ ์ถ์ฒ ์กฐ๊ฑด์ ๋ณ๋๋ก ๋ฐ๋ผ์ผ ํจ
- CROHME/MathWriting: ๋น์์
R-track ํ๊ฐ ๋๋ ์ฐ๊ตฌ head์๋ง ์ฌ์ฉ
- checkpoint์ report๋ ํ์ฌ **research-only / non-commercial** ๊ณต๊ฐ๋ฌผ์ด๋ค.
- ์์ฉ checkpoint๋ ๊ถ๋ฆฌ ๊ฒํ ๋ฅผ ํต๊ณผํ P-track ๋ฐ์ดํฐ๋ก ์ฒ์๋ถํฐ ์ฌํ์ตํด์ผ ํ๋ค.
์ด ๊ณต๊ฐ๋ ์ ํ ์ ํ๋ยท์์ฉ ๋ฐฐํฌ ๊ฐ๋ฅ์ฑยทLiteRT ํธํ์ฑ์ ๋ณด์ฆํ์ง ์๋๋ค.
## ๋ณด์
PyTorch checkpoint์ joblib/pickle์ ์ ๋ขฐํ ์ ์๋ ์ถ์ฒ์์ ๋ก๋ํ๋ฉด ์์ ์ฝ๋๋ฅผ ์คํํ ์ ์๋ค. `MANIFEST.json`์ SHA-256์ ํ์ธํ๊ณ ์ ๋ขฐ๋ ํ๊ฒฝ์์๋ง ์ฌ์ฉํ๋ค.
## ์ฐ๊ตฌ ์๋ฃ
- ์ ์ฒด ๊ธฐ์ ๋ณด๊ณ ์: [`reports/RESEARCH_REPORT.md`](reports/RESEARCH_REPORT.md)
- boundary ํ์ต ๊ฒฐ๊ณผ: [`reports/boundary_behavior_guard_report.json`](reports/boundary_behavior_guard_report.json)
- 3-seed ํ๋ head: [`reports/behavior_role_3seed_summary.json`](reports/behavior_role_3seed_summary.json)
- P boundary ์ ์ 3-seed: [`reports/p_boundary_joint_sharedfix_3seed_summary.json`](reports/p_boundary_joint_sharedfix_3seed_summary.json)
- ์ ์ main device stress: [`reports/p_boundary_device_stress_sharedfix_3seed.json`](reports/p_boundary_device_stress_sharedfix_3seed.json)
- Seed-17 composite export: [`exports/seed17/export_manifest.json`](exports/seed17/export_manifest.json)
- Composite CPU benchmark: [`reports/composite_cpu_benchmark.json`](reports/composite_cpu_benchmark.json)
- Online 3-seed ์ค๋ฅ ํฉ์: [`reports/online_error_consensus_paired_test_3seed.json`](reports/online_error_consensus_paired_test_3seed.json)
- Online family-fusion calibration: [`reports/online_family_fusion_calibration_3seed.json`](reports/online_family_fusion_calibration_3seed.json)
- ํ๋ exact gate 3-seed: [`reports/behavior_exact_gate_3seed.json`](reports/behavior_exact_gate_3seed.json)
- ์์ context ๊ณ์ฝ ๊ฐ์ฌ: [`reports/formula_context_contract_3seed.json`](reports/formula_context_contract_3seed.json)
- R-track ์์ ์ด๋ํฐ 3-seed: [`reports/formula_adapter_h64_3seed_summary.json`](reports/formula_adapter_h64_3seed_summary.json)
- P ํฉ์ฑ ํ๋ proxy seed-17 ์คํจ: [`reports/behavior_role_p_proxy_w035_seed17.json`](reports/behavior_role_p_proxy_w035_seed17.json)
- P ํฉ์ฑ ๋ฐฐ์น ๋ถํฌ ๊ฐ์ฌ: [`reports/p_proxy_shift_seed17.json`](reports/p_proxy_shift_seed17.json)
- LiteRT Colab notebook: [`colab/AIFlow_Math_Ink_06_LiteRT.ipynb`](colab/AIFlow_Math_Ink_06_LiteRT.ipynb)
- ์ค์ P formula schema: [`contracts/aiflow_p_formula_v1.schema.json`](contracts/aiflow_p_formula_v1.schema.json)
- P formula ์ฌ๋ annotation schema: [`contracts/aiflow_p_formula_annotation_v1.schema.json`](contracts/aiflow_p_formula_annotation_v1.schema.json)
- P-only formula ํ์ต recipe: [`configs/MATH-INK-06-P-FORMULA-v1.json`](configs/MATH-INK-06-P-FORMULA-v1.json)
- P-only formula student distiller: [`scripts/distill_math_ink_06_p_formula_student.py`](scripts/distill_math_ink_06_p_formula_student.py)
- ํ์ผ checksum: [`MANIFEST.json`](MANIFEST.json)
|