coderecode95 commited on
Commit
4a62dcc
·
verified ·
1 Parent(s): c32c13e

Upload folder using huggingface_hub

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
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2024 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
README.md CHANGED
@@ -1,3 +1,255 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
4
+ base_model: Qwen/Qwen3-4B
5
+ base_model_relation: finetune
6
+ language:
7
+ - ko
8
+ library_name: transformers
9
+ tags:
10
+ - korean
11
+ - classification
12
+ - natural-language-inference
13
+ - function-calling
14
+ - tool-use
15
+ - calibrated
16
+ - multiple-choice
17
+ datasets:
18
+ - klue/klue
19
+ - skt/kobest_v1
20
+ - kocohub/korean-hate-speech
21
+ - jason9693/APEACH
22
+ - Davlan/sib200
23
+ model-index:
24
+ - name: KJH-Judge-4B-ko
25
+ results:
26
+ - task: {type: text-classification, name: Sentiment classification}
27
+ dataset: {name: NSMC, type: e9t/nsmc, split: test}
28
+ metrics:
29
+ - {type: accuracy, value: 85.7, name: accuracy (0-shot, n=1000)}
30
+ - task: {type: text-classification, name: Natural language inference}
31
+ dataset: {name: KorNLI (XNLI), type: kakaobrain/kor_nli, config: xnli, split: test}
32
+ metrics:
33
+ - {type: accuracy, value: 74.5, name: accuracy (0-shot, n=1000)}
34
+ - task: {type: text-classification, name: Paraphrase detection (binary STS)}
35
+ dataset: {name: KLUE-STS, type: klue/klue, config: sts, split: validation}
36
+ metrics:
37
+ - {type: accuracy, value: 85.9, name: accuracy (0-shot, n=519)}
38
+ - task: {type: text-classification, name: Hate speech detection}
39
+ dataset: {name: Korean UnSmile, type: smilegate-ai/kor_unsmile, split: valid}
40
+ metrics:
41
+ - {type: accuracy, value: 82.1, name: accuracy (0-shot, n=1000)}
42
+ - task: {type: multiple-choice, name: Knowledge QA}
43
+ dataset: {name: KMMLU, type: HAERAE-HUB/KMMLU, split: test}
44
+ metrics:
45
+ - {type: accuracy, value: 42.6, name: accuracy (0-shot, n=990)}
46
+ - task: {type: multiple-choice, name: Korean knowledge QA}
47
+ dataset: {name: HAE-RAE Bench 1.0, type: HAERAE-HUB/HAE_RAE_BENCH_1.0, split: test}
48
+ metrics:
49
+ - {type: accuracy, value: 56.1, name: accuracy (0-shot, n=983)}
50
+ ---
51
+
52
+ # KJH-Judge-4B-ko
53
+
54
+ > [Korean JEV Benchmark](https://huggingface.co/datasets/DaehanKim/korean-jev-benchmark)를 보고 판정 모델을 직접 만들어 본 **개인 학습 프로젝트**입니다. 아래 수치는 모두 직접 잰 결과이며, 실서비스에서 검증한 모델은 아닙니다.
55
+
56
+ **정해진 보기 중 하나를 골라, 보정된 확률과 함께 돌려주는 한국어 판정 모델입니다.** 감정·주제 분류, 문장 관계(함의·모순), 혐오 표현 검수, 정책에 따른 행동 선택, 에이전트의 도구 호출 판단(도구 호출 / 되묻기 / 직접 답변) 같은 일에 씁니다. 다른 모델의 답변을 채점하는 LLM-as-a-judge 모델이 아닙니다.
57
+
58
+ > **English summary.** A personal learning project: a Korean decision model fine-tuned from Qwen3-4B. Given a task description, an item, and 2–26 options, it returns the chosen option with **calibrated probabilities** from a single forward pass (no text generation, ~tens of ms per decision on a GPU). Good for classification, NLI, moderation, policy actions, and tool-call routing. It does not generate text, extract spans, or do numeric reasoning.
59
+
60
+ ![학습하지 않은 한국어 벤치마크](assets/benchmark.png)
61
+
62
+ ## 이 모델의 특징
63
+
64
+ - **보기 고르기만 합니다.** 글을 생성하지 않고 프롬프트를 한 번 계산한 뒤, 보기 기호(A, B, …) 토큰의 점수만 읽습니다. 그래서 빠르고(GPU 서버 안 계산 기준 판정 한 번 약 90ms), 답이 항상 보기 중 하나입니다.
65
+ - **확률이 보정되어 있습니다.** 검증셋으로 맞춘 온도(1.72)로 보정해, Korean JEV Benchmark에서 기대 보정 오차(ECE)가 0.027입니다. “확신 70% 미만이면 사람에게 넘기기” 같은 기준을 걸 수 있습니다. 다만 학습하지 않은 출처의 데이터에서는 평균 확신이 정확도보다 최대 10%p 정도 높게 나왔으니, 기준값은 쓰려는 데이터에서 다시 맞추는 것이 좋습니다.
66
+ - **보기 순서에 흔들리지 않습니다.** 보기를 정확히 거꾸로 놓고 다시 물어도 97.9%가 같은 답입니다.
67
+
68
+ ## 빠르게 시작하기
69
+
70
+ ```bash
71
+ pip install torch "transformers>=5" accelerate huggingface_hub
72
+ ```
73
+
74
+ 이 저장소의 [`judge.py`](judge.py)를 내려받아 쓰는 것이 가장 간단합니다 (학습·평가와 같은 프롬프트, 온도 보정, 묶음 판정 포함).
75
+
76
+ ```python
77
+ import os, sys
78
+ from huggingface_hub import hf_hub_download
79
+ sys.path.insert(0, os.path.dirname(hf_hub_download("coderecode95/KJH-Judge-4B-ko", "judge.py")))
80
+ from judge import Judge
81
+
82
+ j = Judge("coderecode95/KJH-Judge-4B-ko") # GPU가 있으면 bf16, 없으면 CPU fp32
83
+
84
+ j.decide("문장의 전반적인 감정 극성을 판단한다. 부정 표현과 반어를 고려한다.",
85
+ {"text": "배송은 느렸지만 물건은 정말 마음에 들어요"},
86
+ ["긍정적 감정", "부정적 감정"])
87
+ # {'choice': 'A', 'index': 0, 'text': '긍정적 감정', 'confidence': 0.9…, 'probs': {'A': 0.9…, 'B': 0.0…}}
88
+
89
+ # 여러 개를 한 번에 (GPU에서 묶어 계산)
90
+ j.decide_batch([
91
+ {"instruction": "한국어 뉴스 제목의 중심 주제를 고른다.", "item": {"headline": "손흥민, 시즌 10호골"},
92
+ "choices": ["사회", "IT과학", "세계", "생활문화", "정치", "스포츠", "경제"]},
93
+ {"instruction": "전제를 참이라고 할 때 가설을 분류한다.", "item": {"premise": "보증금은 퇴거 후 30일 이내 반환한다.", "hypothesis": "보증금은 퇴거 당일 돌려받는다."},
94
+ "choices": ["entailment", "contradiction", "neutral"]},
95
+ ])
96
+ ```
97
+
98
+ ### judge.py 없이 transformers만으로
99
+
100
+ ```python
101
+ import torch, json
102
+ from transformers import AutoModelForCausalLM, AutoTokenizer
103
+ from huggingface_hub import hf_hub_download
104
+
105
+ name = "coderecode95/KJH-Judge-4B-ko"
106
+ tok = AutoTokenizer.from_pretrained(name)
107
+ model = AutoModelForCausalLM.from_pretrained(name, dtype=torch.bfloat16, device_map="auto").eval()
108
+ T = json.load(open(hf_hub_download(name, "calibration.json")))["temperature"] # 1.7179
109
+
110
+ choices = ["긍정적 감정", "부정적 감정"]
111
+ prompt = ("문장의 전반적인 감정 극성을 판단한다.\n\n"
112
+ "text: 배송은 느렸지만 물건은 정말 마음에 들어요\n\n"
113
+ "보기:\n" + "\n".join(f"{chr(65+i)}. {c}" for i, c in enumerate(choices)) +
114
+ "\n\n정답 보기의 기호 하나만 답하세요.")
115
+ ids = tok(f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n", return_tensors="pt", add_special_tokens=False).input_ids.to(model.device)
116
+ with torch.no_grad():
117
+ logits = model(ids).logits[0, -1]
118
+ letters = [tok.encode(chr(65 + i), add_special_tokens=False)[0] for i in range(len(choices))]
119
+ probs = torch.softmax(logits[letters].float() / T, -1)
120
+ print({c: round(p, 4) for c, p in zip(choices, probs.tolist())})
121
+ ```
122
+
123
+ ### 프롬프트 형식
124
+
125
+ 학습과 평가에 쓴 형식입니다. 이 형식을 지켜야 위 성능이 나옵니다.
126
+
127
+ ```
128
+ <|im_start|>user
129
+ {과제 설명}
130
+
131
+ {항목 이름}: {값} ← 항목마다 한 줄. 값이 문자열이 아니면 JSON
132
+ {항목 이름}: {값}
133
+
134
+ 보기:
135
+ A. {보기 1}
136
+ B. {보기 2}
137
+ …
138
+
139
+ 정답 보기의 기호 하나만 답하세요.<|im_end|>
140
+ <|im_start|>assistant
141
+ ```
142
+
143
+ - 보기는 2~26개입니다.
144
+ - 과제 설명은 짧고 구체적으로 쓰세요. 판단 기준을 한두 문장 덧붙이면(예: “반어를 고려한다”, “정보가 없다는 이유만으로 모순을 고르지 않는다”) 정확도가 크게 오릅니다.
145
+ - `generate()`로 쓸 경우 `max_new_tokens=1`로 보기 기호 하나만 받으세요 (이 저장소의 `generation_config.json`은 `do_sample: false`입니다). 확률이 필요하면 위처럼 logits를 읽으세요.
146
+
147
+ ## 성능
148
+
149
+ ### 1. 학습하지 않은 공개 벤치마크
150
+
151
+ 이 모델의 학습에 쓰지 않은 출처의 공개 데이터입니다 (KLUE-STS는 학습에 쓴 KLUE NLI·YNAT와 같은 KLUE 묶음이지만, STS 과제는 학습하지 않았습니다). 0-shot, 위 프롬프트 형식, 보기 기호 점수 방식으로 쟀습니다 (표본은 고정 시드, 괄호는 95% 신뢰구간). 재현 스크립트: [`eval/bench_heldout.py`](eval/bench_heldout.py).
152
+
153
+ <!-- HELDOUT:start -->
154
+ | 벤치마크 | 무엇을 재나 | 문항 | 정확도 (95% 구간) | 무작위 | 출처 · 라이선스 |
155
+ |---|---|---:|---:|---:|---|
156
+ | NSMC | 영화 리뷰 감성 (긍정/부정) | 1,000 | **85.7%** (83.4~87.7) | 50% | e9t/nsmc · ratings_test · CC0 1.0 |
157
+ | KorNLI (XNLI) | 문장 관계 3분류 (XNLI 한국어 번역) | 1,000 | **74.5%** (71.7~77.1) | 33% | kakaobrain/kor_nli · xnli/test · CC BY-SA 4.0 |
158
+ | KLUE-STS | 두 문장이 같은 뜻인지 (예/아니오) | 519 | **85.9%** (82.7~88.7) | 50% | klue/klue · sts/validation (binary-label) · CC BY-SA 4.0 |
159
+ | Korean UnSmile | 악플·혐오 표현 여부 | 1,000 | **82.1%** (79.6~84.4) | 50% | smilegate-ai/kor_unsmile · valid (clean 여부) · CC BY-NC-ND 4.0 |
160
+ | KMMLU | 한국어 전문 지식 4지선다 (45과목) | 990 | **42.6%** (39.6~45.7) | 25% | HAERAE-HUB/KMMLU · test · CC BY-ND 4.0 |
161
+ | HAE-RAE Bench 1.0 | 한국 문화·어휘 지식 5지선다 | 983 | **56.1%** (53.0~59.2) | 21% | HAERAE-HUB/HAE_RAE_BENCH_1.0 · test · CC BY-NC-ND 4.0 |
162
+ <!-- HELDOUT:end -->
163
+
164
+ <!-- COMPARE:start -->
165
+ **같은 조건 비교** · 같은 문항 · 같은 프롬프트 · 0-shot · 보기 기호 점수. 다른 모델은 생각(thinking)을 끄고 각자의 대화 형식으로 물었습니다.
166
+
167
+ | 벤치마크 | **KJH-Judge-4B-ko (4B)** | Gemma 4 26B-A4B-it (0-shot) |
168
+ |---|---:|---:|
169
+ | NSMC | **85.7%** | 88.7% |
170
+ | KorNLI (XNLI) | **74.5%** | 77.1% |
171
+ | KLUE-STS | **85.9%** | 88.4% |
172
+ | Korean UnSmile | **82.1%** | 81.3% |
173
+ | KMMLU | **42.6%** | 64.0% |
174
+ | HAE-RAE Bench 1.0 | **56.1%** | 79.7% |
175
+ <!-- COMPARE:end -->
176
+
177
+ 원본 Qwen3-4B의 사전학습에 이 데이터가 들어갔는지는 알 수 없습니다. KMMLU·HAE-RAE는 전문 지식을 묻는 시험이라, 판정 능력보다 원본 모델의 지식이 점수를 좌우합니다.
178
+
179
+ ### 2. Korean JEV Benchmark (참고: 같은 출처의 시험 문항)
180
+
181
+ [DaehanKim/korean-jev-benchmark](https://huggingface.co/datasets/DaehanKim/korean-jev-benchmark) 25,418문항 전체입니다. 이 시험 문항 자체로 학습하지는 않았지만, **같은 출처 데이터(KLUE, KoBEST 등)의 학습 분할로 학습했기 때문에** 다른 모델의 0-shot 점수와 같은 조건의 비교가 아닙니다.
182
+
183
+ | 항목 | 값 |
184
+ |---|---|
185
+ | 전체 정확도 | **90.37%** (학습 전 Qwen3-4B 29.56%, 무작위 29.86%) |
186
+ | 학습 데이터가 없는 과목 (Belebele 한국어 독해) | **86.87%** |
187
+ | 보기를 거꾸로 놓아도 같은 답 | 97.93% |
188
+ | 기대 보정 오차 (ECE) | 0.0265 |
189
+
190
+ | 과목 | 정확도 | 과목 | 정확도 |
191
+ |---|---:|---|---:|
192
+ | KoBEST BoolQ | 95.65% | KLUE YNAT (뉴스 주제) | 93.93% |
193
+ | KoBEST HellaSwag | 94.65% | KLUE NLI | 92.39% |
194
+ | KoBEST SentiNeg | 93.91% | APEACH (혐오) | 88.64% |
195
+ | KoBEST COPA | 92.55% | KoBEST WiC | 84.96% |
196
+ | SIB-200 | 94.44% | Korean Hate Speech (3분류) | 77.87% |
197
+ | FunctionChat 도구 고르기 | 94.68% | EnterpriseOps 정책 행동 (7분류) | 83.43% |
198
+ | FunctionChat 대화 | 93.50% | 법령 질문 (v2·v3, 6개 묶음) | 90.8~99.2% |
199
+ | FunctionChat 호출 판단 | 84.55% | 법령 기간 계산 | 69.10% |
200
+
201
+ ### 속도
202
+
203
+ 개인 GPU 서버에서 같은 문항 60개(NSMC·KorNLI)로 잰 참고값입니다 (네트워크 왕복 포함, 측정 스크립트: [`eval/bench_speed.py`](eval/bench_speed.py)).
204
+
205
+ | 측정 | **KJH-Judge-4B-ko** | Gemma 4 26B-A4B-it |
206
+ |---|---:|---:|
207
+ | 판정 한 번 (중앙값) | **250ms** (서버 안 계산 87ms) | 621ms |
208
+ | 동시 4개씩 보냈을 때 처리량 | 3.9건/초 | **9.9건/초** |
209
+ | 생각을 켜고 답을 생성할 때 | | 6.3초 |
210
+
211
+ - 동시 처리량은 비교 모델이 앞섰습니다. 비교 모델은 요청을 묶어 처리하는 서빙 엔진에서, 이 모델은 하나씩 처리하는 단순한 서버에서 돌았기 때문입니다. 대량 처리에는 [`judge.py`](judge.py)의 `decide_batch`를 쓰세요.
212
+ - CPU(노트북, fp32)에서는 판정 한 번에 6초에서 수 분이 걸려 실사용이 어렵습니다.
213
+
214
+ ## 잘하는 것과 못하는 것
215
+
216
+ **잘하는 것**: 보기가 정해진 분류, 문장 관계 판단, 지문에 근거한 예/아니오, 정책·규칙에 따른 행동 선택, 에이전트의 다음 행동(도구 호출 / 되묻기 / 직접 답변) 결정. 처음 보는 지시문이라도 이런 형식이면 잘 따릅니다.
217
+
218
+ **못하는 것**
219
+ - **글 생성, 문장에서 값 뽑기**: 보기를 고르는 것만 합니다. 도구 인자 값을 채우거나 답변을 쓰는 일은 생성 모델에 맡기세요.
220
+ - **숫자 비교·계산이 핵심인 판단**: 거리·속도·점수 같은 수치를 비교해 고르는 일은 약합니다.
221
+ - **반어·비꼼**: “배송 참 빠르네요. 2주 걸렸어요”를 긍정으로 높은 확신과 함께 고르는 경우가 있습니다.
222
+ - **지시문 문구에 민감**: “실제 존재하는 인물인가요?”를 “실제 존재하나요?”처럼 읽는 경우가 있습니다. 기준을 명확히 쓰세요.
223
+
224
+ 권장 구성: 큰 LLM 앞단에서 이 모델이 “무엇을 할지”를 빠르고 싸게 정하고, 확신이 낮은 건 사람이나 큰 모델에 넘기세요.
225
+
226
+ ## 학습
227
+
228
+ > 학습 데이터 구성, 보기 순서 역순 학습, 오염 제거, 합성 데이터 만드는 법, 확률 보정, 체크포인트별 정확도까지 자세한 과정은 **[TRAINING.md](TRAINING.md)**에 정리했습니다.
229
+
230
+ | 항목 | 값 |
231
+ |---|---|
232
+ | 원본 모델 | [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) |
233
+ | 방법 | SFT, LoRA (r 16, α 32, dropout 0.05, q·k·v·o·gate·up·down) → 원본에 병합 |
234
+ | 학습량 | 69,144문항 × 보기 순서 2가지(섞은 순서 + 역순), 출처 비율대로 섞어 4,430 step · 배치 32, 최대 길이 2,048 |
235
+ | 최적화 | 학습률 2e-4, cosine, warmup 3% |
236
+ | 장비 | GPU 1장, 약 3.5시간 |
237
+ | 정답 형식 | 보기 기호 한 글자 + `<|im_end|>` |
238
+ | 보정 | 검증셋 3,089문항으로 단일 온도(1.7179)를 맞춤. ECE 0.066 → 0.013 |
239
+
240
+ **학습 데이터** (모두 위 프롬프트 형식으로 바꿔 사용, 평가 문항과 겹치는 문장은 제외)
241
+
242
+ | 데이터 | 라이선스 |
243
+ |---|---|
244
+ | KLUE NLI · YNAT (학습 분할) | CC BY-SA 4.0 |
245
+ | KoBEST BoolQ · COPA · HellaSwag · SentiNeg · WiC (학습 분할) | CC BY-SA 4.0 |
246
+ | kocohub/korean-hate-speech (학습 분할) | CC BY-SA 4.0 |
247
+ | APEACH (학습 분할) | CC BY-SA 4.0 |
248
+ | SIB-200 (학습 분할) | CC BY-SA 4.0 |
249
+ | 정책 행동 · 법령 질문 · 도구 호출 판단 | 자체 합성 (규칙으로 생성, 정답은 코드로 계산. 정책·법령·도구는 모두 지어낸 것이며 LLM 생성물을 쓰지 않음) |
250
+
251
+ ## 라이선��와 주의
252
+
253
+ - 모델 가중치는 원본 Qwen3-4B와 같은 **Apache 2.0**입니다 ([LICENSE](LICENSE)). 공개 학습 데이터는 모두 CC BY-SA 4.0입니다.
254
+ - 혐오 표현 판정, 정책 판단 등 사람에게 영향을 주는 결정에 쓸 때는 확신이 낮은 결과를 사람이 검토하도록 하세요.
255
+ - 법률·금융 판단의 근거로 쓰지 마세요. 주어진 글 안에서 내용을 찾고 대조하는 도구입니다.
TRAINING.md ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # KJH-Judge-4B-ko는 어떻게 만들었나
2
+
3
+ 이 문서는 학습 목표, 데이터 구성, 학습 전략, 보정, 평가 방법을 정리한 것입니다. 사용법은 [README](README.md)를 보세요.
4
+
5
+ ## 1. 목표: “고르는” 모델
6
+
7
+ 에이전트·검수·분류 파이프라인에서 필요한 판단의 대부분은 **정해진 선택지 중 하나를 고르는 일**입니다 (이 문의는 어느 부서? 이 댓글은 혐오인가? 다음 행동은 도구 호출인가 되묻기인가?). 이런 판단에 큰 생성 모델을 쓰면 느리고 비싸며, 답이 형식을 벗어나기도 합니다.
8
+
9
+ 그래서 이 모델은 처음부터 다음을 목표로 만들었습니다.
10
+
11
+ | 목표 | 설계 |
12
+ |---|---|
13
+ | 빠르게 | 글을 생성하지 않는다. 프롬프트를 한 번 계산하고 다음 토큰의 보기 기호(A, B, …) 점수만 읽는다 |
14
+ | 답이 항상 보기 중 하나 | 보기 기호 토큰끼리만 softmax 한다 |
15
+ | 확률을 믿을 수 있게 | 학습 후 검증셋으로 온도를 맞춰(temperature scaling) 확률을 보정한다 |
16
+ | 보기 순서에 흔들리지 않게 | 학습 데이터에 같은 문항을 정확히 거꾸로 놓은 순서로도 넣는다 |
17
+ | 처음 보는 지시문도 따르게 | 13개 출처의 서로 다른 과제를 같은 형식(과제 설명 + 항목 + 보기)으로 섞어 학습한다 |
18
+
19
+ ## 2. 원본 모델
20
+
21
+ [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) (4.02B, 36층, Apache 2.0). 한국어를 포함한 다국어 사전학습이 되어 있고, 크기가 GPU 한 장에서 빠르게 돌리기 좋습니다.
22
+
23
+ 원본 모델을 이 프롬프트 형식 그대로 쓰면 보기 기호 대신 생각(`<think>`)부터 시작하려 해서, 이 채점 방식으로는 Korean JEV Benchmark에서 29.6%(무작위 29.9%)였습니다. 원본의 실력이 그 정도라는 뜻이 아니라, **이 형식으로 바로 답하도록 맞춰 주는 것**이 학습의 첫 번째 역할이라는 뜻입니다.
24
+
25
+ ## 3. 학습 데이터 구성
26
+
27
+ ### 3.1 출처와 양
28
+
29
+ 공개 데이터 10개와 자체 합성 3개, 모두 **학습 분할만** 썼습니다.
30
+
31
+ | 영역 | 데이터 | 학습 문항 | 보기 수 | 라이선스 |
32
+ |---|---|---:|---|---|
33
+ | 문장 관계 | KLUE NLI | 15,000 | 3 | CC BY-SA 4.0 |
34
+ | 뉴스 주제 | KLUE YNAT | 15,000 | 7 | CC BY-SA 4.0 |
35
+ | 지문 예/아니오 | KoBEST BoolQ | 3,661 | 2 | CC BY-SA 4.0 |
36
+ | 원인·결과 | KoBEST COPA | 2,973 | 2 | CC BY-SA 4.0 |
37
+ | 이어질 문장 | KoBEST HellaSwag | 1,892 | 4 | CC BY-SA 4.0 |
38
+ | 감성(부정 표현) | KoBEST SentiNeg | 3,633 | 2 | CC BY-SA 4.0 |
39
+ | 단어 뜻 구별 | KoBEST WiC | 3,297 | 2 | CC BY-SA 4.0 |
40
+ | 혐오 표현 3단계 | korean-hate-speech | 7,590 | 3 | CC BY-SA 4.0 |
41
+ | 혐오 표현 여부 | APEACH | 7,589 | 2 | CC BY-SA 4.0 |
42
+ | 주제 분류 | SIB-200 (한국어) | 701 | 7 | CC BY-SA 4.0 |
43
+ | 정책에 따른 행동 | 합성 (EnterpriseOps 형식) | 2,026 | 7 | 자체 생성 |
44
+ | 법령 질문 | 합성 (기한·벌금·과태료·징역 상한) | 2,875 | 2~11 | 자체 생성 |
45
+ | 도구 호출 판단 | 합성 (FunctionChat 형식) | 2,907 | 4~9 | 자체 생성 |
46
+ | **합계** | | **69,144문항** | | |
47
+
48
+ - 양이 많은 KLUE NLI · YNAT는 15,000문항으로 잘라 한 과제가 학습을 독차지하지 않게 했습니다.
49
+ - 출처마다 최대 300문항(전체 3,089문항)을 검증셋으로 따로 떼어, 학습 중 손실 확인과 확률 보정에 썼습니다.
50
+ - **Belebele(한국어 독해)는 일부러 학습에 넣지 않았습니다.** 처음 보는 과제에 얼마나 일반화되는지 재기 위해서입니다 (결과 86.9%).
51
+
52
+ ### 3.2 하나의 형식으로 통일
53
+
54
+ 모든 데이터를 같은 대화 형식으로 바꿨습니다. 정답은 보기 기호 한 글자입니다.
55
+
56
+ ```
57
+ <|im_start|>user
58
+ 문장의 전반적인 감정 극성을 판단한다. 부정 표현과 반어를 고려한다.
59
+
60
+ text: 택배사 정말 마음에 듬
61
+
62
+ 보기:
63
+ A. 긍정적 감정
64
+ B. 부정적 감정
65
+
66
+ 정답 보기의 기호 하나만 답하세요.<|im_end|>
67
+ <|im_start|>assistant
68
+ A<|im_end|>
69
+ ```
70
+
71
+ 과제 설명은 과제마다 판단 기준을 한두 문장 담았습니다 (예: 문장 관계에서는 “정보가 없다는 이유만으로 모순을 고르지 않는다”). 같은 형식에 다양한 과제 설명이 섞여 있어서, 학습하지 않은 지시문도 따르게 됩니다.
72
+
73
+ ### 3.3 보기 순서 섞기와 역순 넣기
74
+
75
+ - 보기 순서는 문항마다 무작위로 섞었습니다. 정답 기호가 A나 B에 몰리면 모델이 내용 대신 위치를 외우기 때문입니다 (원본 모델은 이 형식에서 거의 늘 A를 골랐습니다).
76
+ - 학습 데이터에는 **섞은 순서와 그 정확한 역순, 두 가지를 모두** 넣었습니다 (그래서 학습 행은 138,288개). 보기를 거꾸로 놓아도 같은 내용을 고르도록 직접 가르친 것이고, 결과적으로 보기 순서를 뒤집어도 97.9%가 같은 답을 냅니다.
77
+ - 문항과 그 역순은 검증셋 분리 · 수 제한에서 항상 함께 남거나 함께 빠지게 했습니다.
78
+
79
+ ### 3.4 평가 문항과 겹치지 않게 (오염 제거)
80
+
81
+ 평가에 쓸 Korean JEV Benchmark 25,418문항의 문장·보기 33,174개를 정규화해 목록을 만들고, 학습 문항의 필드 중 10자 이상인 문장이 이 목록에 있으면 그 문항을 뺐습니다. 실제로 빠진 문항은 KoBEST COPA 44개, WiC 30개 등 소수였습니다. 같은 데이터 안의 중복도 함께 뺐습니다.
82
+
83
+ ### 3.5 합성 데이터
84
+
85
+ 정책·법령·도구 호출은 한국어 학습 데이터가 거의 없어서 **규칙으로 직접 만들었습니다.** LLM이 만든 글은 쓰지 않았습니다.
86
+
87
+ | 합성 | 만드는 방법 | 정답 확인 |
88
+ |---|---|---|
89
+ | 도구 호출 판단 | 지어낸 도구 28개(14개 묶음 × 2)와 요청 문장 틀로 대화를 만든다. 필수 인자가 다 있으면 CALL, 하나 빠지면 ASK, 도구 결과 이후·지원하지 않는 요청·잡담이면 RESPOND. 같은 묶음의 비슷한 도구를 함께 넣어 헷갈리게 한다 | 만든 대화를 다시 읽어 인자 값이 실제로 있는지 다시 확인. 다르면 버림 |
90
+ | 법령 질문 | 지어낸 법령 조항과 사실관계로 기한·벌금 상한·과태료 상한·징역 상한·개수 질문을 만든다 (초일 불산입, 말일 휴일 연장, 상습 가중 같은 변형 포함) | 만든 문장을 다시 파싱해 독립적으로 다시 풀고, 구성 정답과 다르면 버림 |
91
+ | 정책에 따른 행동 | 목표 행동(도구 실행, 여러 도구, 답변, 상담사 이관, 정보 되묻기, 실행 전 확인, 거절)을 먼저 정하고, 기본 규칙 · 예외(적용 범위·등급) · 그 밖의 규칙과 고객 요청을 무작위로 만든다. 예외가 실제로 적용되는 문항과 안 되는 문항이 반반 | 규칙 풀이기가 목표 행동을 내는 것만 남기고, 문장으로 만든 뒤 숫자·상태·등급을 다시 읽어 독립적으로 다시 풀어 다르면 버림 |
92
+
93
+ 합성 데이터는 평가 문항을 옮기지 않았고, 평가와 **같은 종류의 질문**만 새로 만들었습니다. 그래서 이 세 영역의 Korean JEV 점수는 “완전히 처음 보는 과제”라기보다 “같은 종류의 새 문항”에 대한 점수입니다.
94
+
95
+ ## 4. 학습 전략
96
+
97
+ | 항목 | 값 | 이유 |
98
+ |---|---|---|
99
+ | 방법 | SFT + LoRA | 원본의 언어 능력을 지키면서 형식과 판단 기준만 맞춘다 |
100
+ | LoRA | r 16, α 32, dropout 0.05, 주의·MLP 7개 모듈 전부 (q, k, v, o, gate, up, down) | 형식 맞추기 + 판단 기준 학습에 충분한 용량 |
101
+ | **학습하는 토큰** | **답 기호와 `<|im_end|>`만** | 프롬프트를 외우지 않고 “고르기”만 배운다. 학습 시작 전 첫 배치에서 라벨이 정확히 이 두 토큰에만 걸렸는지 자동 점검 |
102
+ | 양 | 13개 출처를 비율대로 섞어, 모든 행을 한 번 이상 볼 때까지 (약 141,760행 = 4,430 step × 32) | 한 출처가 몰려 나오지 않게 고르게 섞고, 같은 문항을 여러 번 반복하지 않는다 (일부 행만 두 번) |
103
+ | 배치 | 16 × 기울기 누적 2 = 32 | |
104
+ | 학습률 | 2e-4, cosine, warmup 3% | |
105
+ | 최대 길이 | 2,048 토큰 | 도구 목록이 긴 문항까지 포함 |
106
+ | 장비 | GPU 1장, 약 3.5시간 | |
107
+ | 마지막 처리 | LoRA를 원본에 합쳐 하나의 모델로 저장 | 쓸 때 추가 라이브러리 없이 표준 transformers로 로드 |
108
+
109
+ ### 학습 중 확인
110
+
111
+ 500 step마다 체크포인트를 저장하고, Korean JEV Benchmark에서 과목마다 40문항(총 880문항)을 뽑아 정확도를 쟀습니다.
112
+
113
+ | step | 500 | 1,000 | 1,500 | 2,000 | 2,500 | 3,000 | 3,500 | 4,000 | 4,430 |
114
+ |---|---|---|---|---|---|---|---|---|---|
115
+ | 전체 (880문항) | 88.1 | 85.3 | 88.1 | 86.9 | 88.2 | 90.2 | 90.6 | 89.7 | 90.1 |
116
+ | 학습 안 한 과목 (Belebele, 40문항) | 77.5 | 82.5 | 85.0 | 87.5 | 82.5 | 85.0 | 90.0 | 87.5 | 87.5 |
117
+ | 검증 손실 | 0.194 | 0.180 | 0.161 | 0.159 | 0.182 | 0.161 | 0.161 | 0.191 | 0.186 |
118
+
119
+ 500 step 만에 형식은 거의 다 익히고, 이후에는 판단 정확도가 천천히 오릅니다. 3,000 step 이후는 표본 오차(±1~3%p) 안에서 비슷해서, 학습률이 끝까지 내려간 마지막 체크포인트(4,430)를 최종 모델로 썼습니다.
120
+
121
+ ## 5. 확률 보정
122
+
123
+ 학습 직후의 확률은 실제 정답률보다 약간 자신만만했습니다. 검증셋 3,089문항에서 **하나의 온도 T**를 찾아(음의 로그우도 최소화) 모든 판정에 `softmax(점수 / T)`를 씁니다.
124
+
125
+ | | 보정 전 | 보정 후 (T = 1.7179) |
126
+ |---|---|---|
127
+ | 검증셋 음의 로그우도 | 0.373 | 0.310 |
128
+ | 검증셋 ECE | 0.066 | **0.013** |
129
+ | Korean JEV 전체 ECE | | 0.027 |
130
+
131
+ 온도 보정은 순위를 바꾸지 않으므로 정확도는 그대로이고, 확률만 실제 정답률에 맞춰집니다. 그래서 “확신 70% 미만이면 사람에게”처럼 확률을 기준으로 쓸 수 있습니다.
132
+
133
+ 다만 이 온도는 학습과 같은 출처의 검증셋에서 맞춘 것이라, 학습하지 않은 벤치마크에서는 평�� 확신이 정확도보다 높게 나왔습니다.
134
+
135
+ | 벤치마크 | 정확도 | 평균 확신 | 차이 |
136
+ |---|---:|---:|---:|
137
+ | NSMC | 85.7 | 94.9 | +9.2 |
138
+ | Korean UnSmile | 82.1 | 91.4 | +9.3 |
139
+ | KorNLI | 74.5 | 83.6 | +9.1 |
140
+ | KLUE-STS | 85.9 | 87.4 | +1.5 |
141
+ | KMMLU | 42.6 | 52.9 | +10.2 |
142
+ | HAE-RAE 1.0 | 56.1 | 57.1 | +1.0 | 보정 온도는 [`calibration.json`](calibration.json)에 있고 [`judge.py`](judge.py)가 자동으로 적용합니다.
143
+
144
+ ## 6. 평가
145
+
146
+ | 평가 | 무엇을 보나 | 결과 |
147
+ |---|---|---|
148
+ | 학습하지 않은 공개 벤치마크 6종 | 다른 출처 데이터에서의 일반화 | NSMC 85.7 · KLUE-STS 85.9 · UnSmile 82.1 · KorNLI 74.5 · HAE-RAE 56.1 · KMMLU 42.6 |
149
+ | Korean JEV Benchmark 25,418문항 | 학습한 과제 종류의 새 문항 | 90.37% (같은 출처 학습 분할로 학습했으므로 다른 모델과의 0-shot 비교 아님) |
150
+ | 보기 역순 일치 | 위치가 아닌 내용으로 고르는지 | 97.93% |
151
+ | ECE | 확률을 믿을 수 있는지 | 0.0265 |
152
+
153
+ 재현 스크립트: [`eval/bench_heldout.py`](eval/bench_heldout.py) (학습하지 않은 벤치마크), [`eval/bench_compare.py`](eval/bench_compare.py) (다른 모델과 같은 조건 비교), [`eval/bench_speed.py`](eval/bench_speed.py) (속도). `--url`로 쓰는 판정 서버는 이 저장소에 없으니, 직접 돌릴 때는 `--model .`로 내려받은 모델을 쓰세요.
154
+
155
+ ## 7. 해 보고 알게 된 것
156
+
157
+ - **형식이 절반이다.** 원본 모델은 같은 지식이 있어도 이 형식으로 바로 답하지 못했다(29.6%). 판정 모델에서는 답을 내는 자리와 방식을 맞추는 것이 가장 큰 차이를 만든다.
158
+ - **역순 데이터는 값싸고 효과가 크다.** 같은 문항을 거꾸로 한 번 더 넣는 것만으로 보기 순서 강건성이 97.9%가 됐다.
159
+ - **지시문의 판단 기준 한 문장이 중요하다.** 학습하지 않은 과제에서도 기준을 명확히 쓰면 정확도가 크게 오른다. 반대로 기준이 애매하면(“긴급도”처럼) 확신도 정확도도 낮다.
160
+ - **보정은 맞춘 분포 안에서만 맞는다.** 검증셋 ECE는 0.013까지 내려갔지만, 학습하지 않은 출처의 데이터에서는 확신이 정확도보다 최대 10%p 높았다. 확률을 기준으로 쓰려면 실제로 쓸 데이터에서 다시 확인해야 한다.
161
+ - **이 방식이 못하는 것도 분명하다.** 숫자 비교·계산, 문장에서 값 뽑기, 글 생성은 이 모델의 몫이 아니다. 반어·비꼼은 확신이 높은 채로 틀리는 경우가 있다.
assets/benchmark.png ADDED
calibration.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "temperature": 1.7179,
3
+ "val_rows": 3089,
4
+ "val_accuracy": 0.8799,
5
+ "nll_before": 0.3728,
6
+ "nll_after": 0.3101,
7
+ "ece_before": 0.0659,
8
+ "ece_after": 0.0126,
9
+ "method": "단일 온도 · 검증셋 NLL 최소화 · 허용한 보기 기호 토큰만 softmax"
10
+ }
chat_template.jinja ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if message.content is string %}
27
+ {%- set content = message.content %}
28
+ {%- else %}
29
+ {%- set content = '' %}
30
+ {%- endif %}
31
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
32
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
33
+ {%- elif message.role == "assistant" %}
34
+ {%- set reasoning_content = '' %}
35
+ {%- if message.reasoning_content is string %}
36
+ {%- set reasoning_content = message.reasoning_content %}
37
+ {%- else %}
38
+ {%- if '</think>' in content %}
39
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
40
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if loop.index0 > ns.last_query_index %}
44
+ {%- if loop.last or (not loop.last and reasoning_content) %}
45
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
46
+ {%- else %}
47
+ {{- '<|im_start|>' + message.role + '\n' + content }}
48
+ {%- endif %}
49
+ {%- else %}
50
+ {{- '<|im_start|>' + message.role + '\n' + content }}
51
+ {%- endif %}
52
+ {%- if message.tool_calls %}
53
+ {%- for tool_call in message.tool_calls %}
54
+ {%- if (loop.first and content) or (not loop.first) %}
55
+ {{- '\n' }}
56
+ {%- endif %}
57
+ {%- if tool_call.function %}
58
+ {%- set tool_call = tool_call.function %}
59
+ {%- endif %}
60
+ {{- '<tool_call>\n{"name": "' }}
61
+ {{- tool_call.name }}
62
+ {{- '", "arguments": ' }}
63
+ {%- if tool_call.arguments is string %}
64
+ {{- tool_call.arguments }}
65
+ {%- else %}
66
+ {{- tool_call.arguments | tojson }}
67
+ {%- endif %}
68
+ {{- '}\n</tool_call>' }}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>\n' }}
72
+ {%- elif message.role == "tool" %}
73
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
74
+ {{- '<|im_start|>user' }}
75
+ {%- endif %}
76
+ {{- '\n<tool_response>\n' }}
77
+ {{- content }}
78
+ {{- '\n</tool_response>' }}
79
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
80
+ {{- '<|im_end|>\n' }}
81
+ {%- endif %}
82
+ {%- endif %}
83
+ {%- endfor %}
84
+ {%- if add_generation_prompt %}
85
+ {{- '<|im_start|>assistant\n' }}
86
+ {%- if enable_thinking is defined and enable_thinking is false %}
87
+ {{- '<think>\n\n</think>\n\n' }}
88
+ {%- endif %}
89
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "dtype": "bfloat16",
9
+ "eos_token_id": 151645,
10
+ "head_dim": 128,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 2560,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 9728,
15
+ "layer_types": [
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention",
51
+ "full_attention"
52
+ ],
53
+ "max_position_embeddings": 40960,
54
+ "max_window_layers": 36,
55
+ "model_type": "qwen3",
56
+ "num_attention_heads": 32,
57
+ "num_hidden_layers": 36,
58
+ "num_key_value_heads": 8,
59
+ "pad_token_id": 151643,
60
+ "rms_norm_eps": 1e-06,
61
+ "rope_parameters": {
62
+ "rope_theta": 1000000,
63
+ "rope_type": "default"
64
+ },
65
+ "sliding_window": null,
66
+ "tie_word_embeddings": true,
67
+ "transformers_version": "5.20.2",
68
+ "use_cache": true,
69
+ "use_sliding_window": false,
70
+ "vocab_size": 151936
71
+ }
eval/bench_compare.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """다른 모델과 같은 조건으로 비교: bench_heldout.py 와 같은 데이터 · 같은 프롬프트 · 같은 채점(보기 기호 점수, 0-shot).
2
+
3
+ # OpenAI 호환 API로 떠 있는 모델 (vLLM 등) — 키는 환경 변수 OPENAI_API_KEY 로
4
+ python eval/bench_compare.py --api http://서버:포트/v1 [--api-model 모델이름]
5
+
6
+ # GPU 서버에서 (모델은 Hugging Face에서 자동으로 받는다)
7
+ python eval/bench_compare.py --model Qwen/Qwen3-4B # 원본 모델
8
+ python eval/bench_compare.py --model google/gemma-3-27b-it --4bit # 큰 모델은 4bit로 (bitsandbytes 필요)
9
+ python eval/bench_compare.py --model . --format jev # 이 모델 (학습 형식 그대로)
10
+
11
+ 공정성을 위해:
12
+ - 프롬프트 본문(과제 설명 · 항목 · 보기 · "정답 보기의 기호 하나만 답하세요.")은 모든 모델에 똑같다.
13
+ - 대화 틀은 각 모델의 chat template 을 쓰고, 생각(thinking) 기능이 있으면 끈다 (Qwen3: enable_thinking=False).
14
+ - 다음 토큰에서 보기 기호 토큰("A" 또는 " A" 중 높은 쪽)의 점수만 비교한다. 정확도는 온도 보정과 무관하다.
15
+ """
16
+ import argparse
17
+ import json
18
+ import random
19
+ import sys
20
+ import time
21
+ from pathlib import Path
22
+
23
+ import torch
24
+
25
+ HERE = Path(__file__).resolve().parent
26
+ sys.path.insert(0, str(HERE))
27
+ sys.path.insert(0, str(HERE.parent))
28
+ from bench_heldout import BENCH, load, wilson # noqa: E402 같은 데이터 · 같은 표본
29
+ from judge import chat_prefix, render_prompt # noqa: E402 같은 프롬프트 본문
30
+
31
+
32
+ def build_text(tok, prompt, fmt):
33
+ if fmt == "jev":
34
+ return chat_prefix(prompt)
35
+ msgs = [{"role": "user", "content": prompt}]
36
+ try:
37
+ return tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True, enable_thinking=False)
38
+ except TypeError:
39
+ return tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
40
+
41
+
42
+ def letter_variants(tok):
43
+ out = []
44
+ for i in range(26):
45
+ L = chr(65 + i)
46
+ ids = set()
47
+ for s in (L, " " + L):
48
+ e = tok.encode(s, add_special_tokens=False)
49
+ if len(e) == 1:
50
+ ids.add(e[0])
51
+ out.append(sorted(ids))
52
+ return out
53
+
54
+
55
+ @torch.no_grad()
56
+ def run(model, tok, texts, nchoices, letters, batch):
57
+ dev = next(model.parameters()).device
58
+ enc = [tok.encode(t, add_special_tokens=False) for t in texts]
59
+ order = sorted(range(len(enc)), key=lambda i: len(enc[i]))
60
+ pred = [None] * len(enc)
61
+ pad = tok.pad_token_id if tok.pad_token_id is not None else 0
62
+ for s in range(0, len(order), batch):
63
+ grp = order[s:s + batch]
64
+ n = max(len(enc[i]) for i in grp)
65
+ x = torch.full((len(grp), n), pad, dtype=torch.long)
66
+ m = torch.zeros((len(grp), n), dtype=torch.long)
67
+ for r, i in enumerate(grp): # 오른쪽 채우기: 각 문장의 마지막 자리 점수만 읽는다
68
+ x[r, :len(enc[i])] = torch.tensor(enc[i]); m[r, :len(enc[i])] = 1
69
+ logits = model(input_ids=x.to(dev), attention_mask=m.to(dev)).logits
70
+ for r, i in enumerate(grp):
71
+ row = logits[r, len(enc[i]) - 1].float()
72
+ sc = [max(row[t].item() for t in letters[k]) for k in range(nchoices[i])]
73
+ pred[i] = max(range(len(sc)), key=sc.__getitem__)
74
+ return pred
75
+
76
+
77
+ def run_api(base, model_name, prompts, nchoices, workers=8):
78
+ """API 방식: 같은 프롬프트를 사용자 메시지로 보내고(생각 끔), 첫 토큰 상위 확률에서 허용한 보기 기호 중 가장 높은 것을 고른다.
79
+ 상위 확률에 보기 기호가 하나도 없으면 실제로 낸 글자를 쓴다."""
80
+ import concurrent.futures as cf
81
+ import os
82
+ import urllib.request
83
+ key = os.environ.get("OPENAI_API_KEY", "")
84
+ hdr = {"Content-Type": "application/json", **({"Authorization": f"Bearer {key}"} if key else {})}
85
+
86
+ def one(i):
87
+ body = {"model": model_name, "messages": [{"role": "user", "content": prompts[i]}], "max_tokens": 1, "temperature": 0,
88
+ "logprobs": True, "top_logprobs": 20, "chat_template_kwargs": {"enable_thinking": False}}
89
+ for k in range(8):
90
+ try:
91
+ req = urllib.request.Request(base + "/chat/completions", json.dumps(body, ensure_ascii=False).encode(), hdr)
92
+ c = json.loads(urllib.request.urlopen(req, timeout=120).read())["choices"][0]
93
+ allowed = {chr(65 + j): j for j in range(nchoices[i])}
94
+ best = None
95
+ for t in (c.get("logprobs") or {}).get("content", [{}])[0].get("top_logprobs", []):
96
+ L = t["token"].strip()
97
+ if L in allowed and (best is None or t["logprob"] > best[1]):
98
+ best = (allowed[L], t["logprob"])
99
+ if best:
100
+ return best[0]
101
+ txt = (c["message"].get("content") or "").strip()[:1]
102
+ return allowed.get(txt, -1)
103
+ except urllib.error.HTTPError as e:
104
+ if e.code in (400, 401, 403, 404):
105
+ raise
106
+ time.sleep(2)
107
+ except Exception:
108
+ time.sleep(2)
109
+ return -1
110
+ with cf.ThreadPoolExecutor(workers) as ex:
111
+ return list(ex.map(one, range(len(prompts))))
112
+
113
+
114
+ def main():
115
+ ap = argparse.ArgumentParser()
116
+ ap.add_argument("--model", help="Hugging Face 모델 id 또는 폴더")
117
+ ap.add_argument("--api", help="OpenAI 호환 API 주소 (…/v1). 키는 환경 변수 OPENAI_API_KEY")
118
+ ap.add_argument("--api-model", help="API의 모델 이름 (생략하면 /models 의 첫 번째)")
119
+ ap.add_argument("--workers", type=int, default=8)
120
+ ap.add_argument("--format", choices=["chat", "jev"], default="chat", help="jev = 이 모델의 학습 형식 (KJH-Judge 전용)")
121
+ ap.add_argument("--4bit", dest="q4", action="store_true", help="4bit 양자화로 불러오기 (큰 모델용, bitsandbytes 필요)")
122
+ ap.add_argument("--n", type=int, default=1000)
123
+ ap.add_argument("--only", nargs="*")
124
+ ap.add_argument("--batch", type=int, default=8)
125
+ a = ap.parse_args()
126
+ if not (a.model or a.api):
127
+ ap.error("--model 또는 --api 가 필요합니다")
128
+ if a.api:
129
+ import os
130
+ import urllib.request
131
+ a.api = a.api.rstrip("/")
132
+ if not a.api_model:
133
+ key = os.environ.get("OPENAI_API_KEY", "")
134
+ req = urllib.request.Request(a.api + "/models", headers={"Authorization": f"Bearer {key}"} if key else {})
135
+ a.api_model = json.loads(urllib.request.urlopen(req, timeout=30).read())["data"][0]["id"]
136
+ name = "api-" + a.api_model.replace("/", "_")
137
+ tok = model = letters = None
138
+ else:
139
+ from transformers import AutoModelForCausalLM, AutoTokenizer
140
+ tok = AutoTokenizer.from_pretrained(a.model)
141
+ try:
142
+ import accelerate # noqa: F401
143
+ kw = {"device_map": "auto", "dtype": torch.bfloat16}
144
+ except ImportError: # accelerate 가 없으면 한 장치에 직접 올린다
145
+ kw = {"dtype": torch.bfloat16 if torch.cuda.is_available() else torch.float32}
146
+ if a.q4:
147
+ from transformers import BitsAndBytesConfig
148
+ kw["quantization_config"] = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_quant_type="nf4")
149
+ model = AutoModelForCausalLM.from_pretrained(a.model, **kw).eval()
150
+ if "device_map" not in kw:
151
+ model = model.to("cuda" if torch.cuda.is_available() else "cpu")
152
+ letters = letter_variants(tok)
153
+ name = Path(a.model).resolve().name if Path(a.model).exists() else a.model.split("/")[-1]
154
+ out = HERE / "compare" / f"{name}{'-4bit' if a.q4 else ''}{'-' + a.format if a.format == 'jev' else ''}.json"
155
+ out.parent.mkdir(exist_ok=True)
156
+ res = {}
157
+ for b in (a.only or BENCH):
158
+ t0 = time.time()
159
+ data = load(b, random.Random(f"kjh-judge:{b}"), a.n) # bench_heldout.py 와 같은 시드 → 같은 문항
160
+ prompts = [render_prompt(r["instruction"], r["item"], r["choices"]) for r, _ in data]
161
+ nch = [len(r["choices"]) for r, _ in data]
162
+ if a.api:
163
+ pred = run_api(a.api, a.api_model, prompts, nch, a.workers)
164
+ else:
165
+ pred = run(model, tok, [build_text(tok, p, a.format) for p in prompts], nch, letters, a.batch)
166
+ k = sum(p == g for p, (_, g) in zip(pred, data))
167
+ lo, hi = wilson(k, len(data))
168
+ res[b] = {"n": len(data), "acc": round(k / len(data), 4), "ci95": [round(lo, 4), round(hi, 4)], "seconds": round(time.time() - t0)}
169
+ print(f"{b:<10} n={len(data):>5} 정확도 {k / len(data):6.1%} ({lo:.1%}~{hi:.1%}) {res[b]['seconds']}s", flush=True)
170
+ out.write_text(json.dumps({"model": a.api_model if a.api else a.model, "via": "api" if a.api else "local", "format": a.format, "4bit": a.q4, "made": time.strftime("%Y-%m-%d %H:%M"), "results": res}, ensure_ascii=False, indent=1), encoding="utf-8")
171
+ print("저장:", out)
172
+
173
+
174
+ if __name__ == "__main__":
175
+ main()
eval/bench_heldout.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """학습에 쓰지 않은 공개 한국어 벤치마크로 KJH-Judge-4B-ko 를 잰다 (0-shot, 보기 기호 점수 방식).
2
+
3
+ # 판정 서버(API)로
4
+ python eval/bench_heldout.py --url http://서버:포트
5
+ # 내려받은 모델로 (GPU 권장)
6
+ python eval/bench_heldout.py --model .
7
+
8
+ 학습 데이터와 겹치지 않는 출처만 쓴다. 이 모델의 학습 데이터는 KLUE(NLI·YNAT), KoBEST, korean-hate-speech, APEACH, SIB-200,
9
+ 자체 합성(정책·법령·도구 호출)이다. 아래 벤치마크는 그와 다른 출처다. (원본 Qwen3-4B의 사전학습에 들어갔는지는 알 수 없다.)
10
+ 표본은 고정 시드로 뽑는다.
11
+ """
12
+ import argparse
13
+ import concurrent.futures as cf
14
+ import io
15
+ import json
16
+ import math
17
+ import random
18
+ import time
19
+ import urllib.parse
20
+ import urllib.request
21
+ from pathlib import Path
22
+
23
+ HERE = Path(__file__).resolve().parent
24
+ NLI = ("전제를 참이라고 할 때 가설을 분류한다. entailment: 전제로부터 가설이 따라온다. contradiction: 전제와 가설이 양립할 수 없다. neutral: 둘 다 아니다. "
25
+ "정보가 없다는 이유만으로 contradiction을 고르지 않는다. neutral은 정상 정답이며 insufficient_context가 아니다. 통상적인 문장 의미로 판단하며 희박한 가정을 만들어 모호하다고 하지 않는다. "
26
+ "전제의 열거 대상과 가설의 범위를 빠짐없이 대조한다. 가설의 만/밖에/오직/모두 같은 표현이 전제에 명시된 다른 대상이나 사례를 배제하는지 확인한다. "
27
+ "전제에 배타 표현이 없다는 사실만으로 중립이라고 하지 않는다. 통상적인 문맥이 명확하면 다른 원인·상황을 임의로 추가하지 않는다.")
28
+ SENT = "문장의 전반적인 감정 극성을 판단한다. 부정 표현과 반어를 고려한다."
29
+ HATE = ("APEACH 원 논문의 생성 기준을 따른다. 성별·성적 지향/정체성·나이/신분/경력·국적/인종·출신/거주지·외모·질병/장애·식습관·학력/전공 관련 차별·비하·공격을 포함한다. "
30
+ "보호집단 정체성을 명시해야 한다는 제한은 없다. 불필요하거나 공격적인 외모 평가, 식습관 강요/폄하도 해당한다. 비공격적인 주제 언급이나 차별에 대한 반대 발언은 비혐오다.")
31
+ STS = "두 문장의 의미가 같은지 판단한다. 표현이 달라도 전달하는 내용이 같으면 같은 의미다."
32
+ MCQ = "질문에 가장 알맞은 답을 보기에서 고른다."
33
+ BENCH = { # 이름: (설명, 출처, 라이선스)
34
+ "nsmc": ("영화 리뷰 감성 (긍정/부정)", "e9t/nsmc · ratings_test", "CC0 1.0"),
35
+ "kornli": ("문장 관계 3분류 (XNLI 한국어 번역)", "kakaobrain/kor_nli · xnli/test", "CC BY-SA 4.0"),
36
+ "klue_sts": ("두 문장이 같은 뜻인지 (예/아니오)", "klue/klue · sts/validation (binary-label)", "CC BY-SA 4.0"),
37
+ "unsmile": ("악플·혐오 표현 여부", "smilegate-ai/kor_unsmile · valid (clean 여부)", "CC BY-NC-ND 4.0"),
38
+ "kmmlu": ("한국어 전문 지식 4지선다 (45과목)", "HAERAE-HUB/KMMLU · test", "CC BY-ND 4.0"),
39
+ "haerae": ("한국 문화·어휘 지식 5지선다", "HAERAE-HUB/HAE_RAE_BENCH_1.0 · test", "CC BY-NC-ND 4.0"),
40
+ }
41
+
42
+
43
+ def get(url, tries=6):
44
+ url = urllib.parse.quote(url, safe=":/?=&%") # 설정 이름에 띄어쓰기가 있는 데이터셋 (HAE-RAE)
45
+ for k in range(tries):
46
+ try:
47
+ return urllib.request.urlopen(url, timeout=120).read()
48
+ except Exception:
49
+ if k == tries - 1:
50
+ raise
51
+ time.sleep(3)
52
+
53
+
54
+ def parquet(dataset, config, split):
55
+ import pyarrow.parquet as pq
56
+ urls = json.loads(get(f"https://huggingface.co/api/datasets/{dataset}/parquet"))[config][split]
57
+ rows = []
58
+ for u in urls:
59
+ rows += pq.read_table(io.BytesIO(get(u))).to_pylist()
60
+ return rows
61
+
62
+
63
+ def load(name, rng, n):
64
+ """→ [(요청, 정답 번호)]"""
65
+ out = []
66
+ if name == "nsmc":
67
+ lines = get("https://raw.githubusercontent.com/e9t/nsmc/master/ratings_test.txt").decode("utf-8").splitlines()[1:]
68
+ rows = [l.split("\t") for l in lines]
69
+ rows = [r for r in rows if len(r) == 3 and r[1].strip()]
70
+ for _, doc, lab in rng.sample(rows, n):
71
+ out.append(({"instruction": SENT, "item": {"text": doc}, "choices": ["긍정적 감정", "부정적 감정"]}, 0 if lab == "1" else 1))
72
+ elif name == "kornli":
73
+ rows = parquet("kakaobrain/kor_nli", "xnli", "test")
74
+ gmap = {0: 0, 1: 2, 2: 1} # 데이터: 0 함의 1 중립 2 모순 → 보기: entailment contradiction neutral
75
+ for r in rng.sample(rows, n):
76
+ out.append(({"instruction": NLI, "item": {"premise": r["premise"], "hypothesis": r["hypothesis"]}, "choices": ["entailment", "contradiction", "neutral"]}, gmap[r["label"]]))
77
+ elif name == "klue_sts":
78
+ for r in parquet("klue/klue", "sts", "validation"):
79
+ out.append(({"instruction": STS, "item": {"sentence1": r["sentence1"], "sentence2": r["sentence2"]}, "choices": ["같은 의미", "다른 의미"]}, 0 if r["labels"]["binary-label"] == 1 else 1))
80
+ elif name == "unsmile":
81
+ for r in rng.sample(parquet("smilegate-ai/kor_unsmile", "default", "valid"), n):
82
+ out.append(({"instruction": HATE, "item": {"text": r["문장"]}, "choices": ["비혐오: 비하·공격성이 없는 표현", "혐오·비하·공격적 표현"]}, 0 if r["clean"] == 1 else 1))
83
+ elif name == "kmmlu":
84
+ cfgs = json.loads(get("https://huggingface.co/api/datasets/HAERAE-HUB/KMMLU/parquet"))
85
+ per = max(1, n // len(cfgs))
86
+ for c in sorted(cfgs):
87
+ rows = parquet("HAERAE-HUB/KMMLU", c, "test")
88
+ for r in rng.sample(rows, min(per, len(rows))):
89
+ out.append(({"instruction": MCQ, "item": {"question": r["question"]}, "choices": [str(r[k]) for k in "ABCD"]}, int(r["answer"]) - 1))
90
+ elif name == "haerae":
91
+ cfgs = json.loads(get("https://huggingface.co/api/datasets/HAERAE-HUB/HAE_RAE_BENCH_1.0/parquet"))
92
+ per = max(1, n // len(cfgs))
93
+ for c in sorted(cfgs):
94
+ rows = parquet("HAERAE-HUB/HAE_RAE_BENCH_1.0", c, "test")
95
+ for r in rng.sample(rows, min(per, len(rows))):
96
+ ks = [k for k in "abcde" if r.get(k) not in (None, "")]
97
+ gold = str(r["answer"]).strip().lower()
98
+ if gold not in ks:
99
+ continue
100
+ out.append(({"instruction": MCQ, "item": {"question": r["question"]}, "choices": [str(r[k]) for k in ks]}, ks.index(gold)))
101
+ return out
102
+
103
+
104
+ def wilson(k, n, z=1.96):
105
+ if n == 0:
106
+ return (0, 0)
107
+ p = k / n
108
+ d = 1 + z * z / n
109
+ c = (p + z * z / (2 * n)) / d
110
+ h = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
111
+ return (c - h, c + h)
112
+
113
+
114
+ def run_api(url, reqs):
115
+ def post(path, body):
116
+ for k in range(12):
117
+ try:
118
+ req = urllib.request.Request(url + path, json.dumps(body, ensure_ascii=False).encode(), {"Content-Type": "application/json"})
119
+ return json.loads(urllib.request.urlopen(req, timeout=300).read())
120
+ except urllib.error.HTTPError as e:
121
+ if e.code == 404:
122
+ return None
123
+ raise
124
+ except Exception:
125
+ time.sleep(2)
126
+ raise RuntimeError("서버에 연결하지 못했습니다")
127
+ wire = [{"instruction": r["instruction"], "item": r["item"], "choices": [{"text": c} for c in r["choices"]]} for r in reqs]
128
+ first = post("/api/batch", {"items": wire[:32]})
129
+ if first:
130
+ res = first["results"]
131
+ for s in range(32, len(wire), 32):
132
+ res += post("/api/batch", {"items": wire[s:s + 32]})["results"]
133
+ else:
134
+ with cf.ThreadPoolExecutor(8) as ex:
135
+ res = list(ex.map(lambda b: post("/api/decide", b), wire))
136
+ return [ord(r["choice"]) - 65 for r in res], [r["confidence"] for r in res]
137
+
138
+
139
+ def run_local(path, reqs):
140
+ import sys
141
+ sys.path.insert(0, str(Path(path).resolve()))
142
+ from judge import Judge
143
+ j = Judge(path)
144
+ out = j.decide_batch(reqs)
145
+ return [o["index"] for o in out], [o["confidence"] for o in out]
146
+
147
+
148
+ def main():
149
+ ap = argparse.ArgumentParser()
150
+ ap.add_argument("--url")
151
+ ap.add_argument("--model")
152
+ ap.add_argument("--n", type=int, default=1000, help="벤치마크마다 최대 문항 수 (KLUE-STS는 전체 519)")
153
+ ap.add_argument("--only", nargs="*")
154
+ ap.add_argument("--out", default=str(HERE / "heldout_results.json"))
155
+ a = ap.parse_args()
156
+ prev = Path(a.out)
157
+ summary = json.loads(prev.read_text(encoding="utf-8"))["results"] if prev.is_file() and a.only else {} # --only 로 일부만 다시 돌리면 나머지 결과는 유지
158
+ for name in (a.only or BENCH):
159
+ rng = random.Random(f"kjh-judge:{name}")
160
+ t0 = time.time()
161
+ data = load(name, rng, a.n)
162
+ reqs, gold = [d[0] for d in data], [d[1] for d in data]
163
+ pred, conf = run_api(a.url.rstrip("/"), reqs) if a.url else run_local(a.model, reqs)
164
+ k = sum(p == g for p, g in zip(pred, gold))
165
+ chance = sum(1 / len(r["choices"]) for r in reqs) / len(reqs)
166
+ lo, hi = wilson(k, len(reqs))
167
+ summary[name] = {"desc": BENCH[name][0], "source": BENCH[name][1], "license": BENCH[name][2], "n": len(reqs),
168
+ "acc": round(k / len(reqs), 4), "ci95": [round(lo, 4), round(hi, 4)], "chance": round(chance, 4),
169
+ "mean_conf": round(sum(conf) / len(conf), 4), "seconds": round(time.time() - t0)}
170
+ print(f"{name:<10} n={len(reqs):>5} 정확도 {k / len(reqs):6.1%} (95% {lo:.1%}~{hi:.1%}) 무작위 {chance:.1%} {round(time.time() - t0)}s", flush=True)
171
+ Path(a.out).write_text(json.dumps({"made": time.strftime("%Y-%m-%d %H:%M"), "protocol": "0-shot, 보기 기호 점수(온도 보정 softmax), 표본 고정 시드", "results": summary}, ensure_ascii=False, indent=1), encoding="utf-8")
172
+ print("저장:", a.out)
173
+
174
+
175
+ if __name__ == "__main__":
176
+ main()
eval/bench_speed.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """속도 비교: 같은 문항을 같은 PC에서 보내 걸린 시간을 잰다 (네트워크 왕복 포함).
2
+
3
+ $env:OPENAI_API_KEY = "…" # 비교 모델 API 키
4
+ python eval/bench_speed.py --kjh http://서버:32500 --api http://서버:30102/v1
5
+
6
+ 측정
7
+ 1. 판정 1회 지연: 문항을 하나씩 보내 응답까지 걸린 시간 (KJH: /api/decide, 비교 모델: 생각 끄고 max_tokens=1)
8
+ 2. 동시 처리량: 동시에 N개씩 보내 초당 판정 수
9
+ 3. 비교 모델을 평소처럼 쓸 때: 생각을 켜고 답을 생성하게 했을 때 시간과 생성 토큰 수 (일부 문항)
10
+ """
11
+ import argparse
12
+ import concurrent.futures as cf
13
+ import json
14
+ import os
15
+ import random
16
+ import statistics
17
+ import sys
18
+ import time
19
+ import urllib.request
20
+ from pathlib import Path
21
+
22
+ HERE = Path(__file__).resolve().parent
23
+ sys.path.insert(0, str(HERE))
24
+ sys.path.insert(0, str(HERE.parent))
25
+ from bench_heldout import load # noqa: E402
26
+ from judge import render_prompt # noqa: E402
27
+
28
+
29
+ RETRIES = {"n": 0}
30
+
31
+
32
+ def post(url, body, hdr, timeout=300):
33
+ """연결이 잠깐 거부되면 다시 시도한다. 재시도에 걸린 시간은 그 요청 시간에 포함되므로 재시도 횟수를 함께 기록한다."""
34
+ req = urllib.request.Request(url, json.dumps(body, ensure_ascii=False).encode(), {"Content-Type": "application/json", **hdr})
35
+ for k in range(10):
36
+ try:
37
+ return json.loads(urllib.request.urlopen(req, timeout=timeout).read())
38
+ except urllib.error.HTTPError:
39
+ raise
40
+ except Exception:
41
+ if k == 9:
42
+ raise
43
+ RETRIES["n"] += 1
44
+ time.sleep(1.5)
45
+
46
+
47
+ def stat(ms):
48
+ s = sorted(ms)
49
+ return {"n": len(s), "median_ms": round(statistics.median(s)), "p90_ms": round(s[int(len(s) * 0.9) - 1]), "mean_ms": round(statistics.mean(s))}
50
+
51
+
52
+ def main():
53
+ ap = argparse.ArgumentParser()
54
+ ap.add_argument("--kjh", required=True, help="KJH 판정 서버 (studio/serve.py)")
55
+ ap.add_argument("--api", required=True, help="비교 모델 OpenAI 호환 주소 (…/v1)")
56
+ ap.add_argument("--api-model")
57
+ ap.add_argument("--n", type=int, default=60)
58
+ ap.add_argument("--conc", type=int, default=4)
59
+ ap.add_argument("--think-n", type=int, default=10)
60
+ ap.add_argument("--out", default=str(HERE / "speed_results.json"))
61
+ a = ap.parse_args()
62
+ kjh, api = a.kjh.rstrip("/"), a.api.rstrip("/")
63
+ key = os.environ.get("OPENAI_API_KEY", "")
64
+ hdr = {"Authorization": f"Bearer {key}"} if key else {}
65
+ if not a.api_model:
66
+ a.api_model = json.loads(urllib.request.urlopen(urllib.request.Request(api + "/models", headers=hdr), timeout=30).read())["data"][0]["id"]
67
+ rng = random.Random("speed")
68
+ data = load("nsmc", rng, a.n // 2) + load("kornli", rng, a.n - a.n // 2)
69
+ reqs = [r for r, _ in data]
70
+ prompts = [render_prompt(r["instruction"], r["item"], r["choices"]) for r in reqs]
71
+
72
+ def kjh_one(i):
73
+ t = time.perf_counter()
74
+ r = post(kjh + "/api/decide", {"instruction": reqs[i]["instruction"], "item": reqs[i]["item"], "choices": [{"text": c} for c in reqs[i]["choices"]]}, {})
75
+ return (time.perf_counter() - t) * 1000, r.get("ms")
76
+
77
+ def api_one(i, think=False):
78
+ body = {"model": a.api_model, "messages": [{"role": "user", "content": prompts[i]}], "temperature": 0,
79
+ "chat_template_kwargs": {"enable_thinking": think}}
80
+ body.update({"max_tokens": 4096} if think else {"max_tokens": 1, "logprobs": True, "top_logprobs": 20})
81
+ t = time.perf_counter()
82
+ r = post(api + "/chat/completions", body, hdr, timeout=600)
83
+ return (time.perf_counter() - t) * 1000, (r.get("usage") or {}).get("completion_tokens")
84
+
85
+ for f in (kjh_one, api_one): # 예열
86
+ f(0)
87
+ out = {"made": time.strftime("%Y-%m-%d %H:%M"), "api_model": a.api_model, "n": len(reqs), "note": "같은 PC에서 측정, 네트워크 왕복 포함"}
88
+ k = [kjh_one(i) for i in range(len(reqs))]
89
+ out["kjh_single"] = {**stat([x[0] for x in k]), "server_compute_median_ms": round(statistics.median([x[1] for x in k if x[1] is not None]))}
90
+ print("KJH 1회", out["kjh_single"], flush=True)
91
+ b = [api_one(i)[0] for i in range(len(reqs))]
92
+ out["api_single"] = stat(b)
93
+ print("비교 1회", out["api_single"], flush=True)
94
+ for name, fn in (("kjh_throughput", kjh_one), ("api_throughput", api_one)):
95
+ t = time.perf_counter()
96
+ with cf.ThreadPoolExecutor(a.conc) as ex:
97
+ list(ex.map(fn, range(len(reqs))))
98
+ el = time.perf_counter() - t
99
+ out[name] = {"concurrency": a.conc, "decisions": len(reqs), "seconds": round(el, 2), "per_sec": round(len(reqs) / el, 1)}
100
+ print(name, out[name], flush=True)
101
+ th = [api_one(i, True) for i in range(min(a.think_n, len(reqs)))]
102
+ out["api_thinking"] = {**stat([x[0] for x in th]), "completion_tokens_median": statistics.median([x[1] or 0 for x in th])}
103
+ print("비교 생각 켬", out["api_thinking"], flush=True)
104
+ out["connection_retries"] = RETRIES["n"]
105
+ Path(a.out).write_text(json.dumps(out, ensure_ascii=False, indent=1), encoding="utf-8")
106
+ print("저장:", a.out)
107
+
108
+
109
+ if __name__ == "__main__":
110
+ main()
eval/chart.html ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html><html><head><meta charset="utf-8">
2
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap">
3
+ <style>
4
+ *{box-sizing:border-box}body{margin:0;background:#ffffff;font-family:'IBM Plex Sans KR','Malgun Gothic',sans-serif;color:#121823}
5
+ .wrap{width:1200px;padding:40px 48px 36px}
6
+ h1{margin:0;font-size:30px;font-weight:700;letter-spacing:-.02em}h1 span{color:#1d4ed8}
7
+ .sub{margin:8px 0 28px;color:#5a6476;font-size:16px}
8
+ .grid{display:grid;grid-template-columns:1fr 270px;gap:36px}
9
+ .row{display:grid;grid-template-columns:210px 1fr 96px;gap:16px;align-items:center;height:62px}
10
+ .nm b{display:block;font-size:17px}.nm span{font-size:13px;color:#5a6476}
11
+ .track{position:relative;height:26px;background:#eef1f5;border-radius:5px}
12
+ .bar{position:absolute;inset:0 auto 0 0;background:#1d4ed8;border-radius:5px}
13
+ .know .bar{background:#94a3b8}
14
+ .ci{position:absolute;top:11px;height:4px;background:rgba(255,255,255,.75);border-radius:2px}
15
+ .chance{position:absolute;top:-6px;bottom:-6px;border-left:2px dashed #121823;opacity:.55}
16
+ .chance i{position:absolute;top:-17px;left:4px;font-style:normal;font-size:11px;white-space:nowrap;color:#121823}
17
+ .val{font:600 26px 'IBM Plex Mono',monospace;text-align:right}.val small{font-size:15px;color:#5a6476}
18
+ .sep{margin:6px 0 4px;font-size:12.5px;color:#5a6476;padding-left:226px}
19
+ .side{display:flex;flex-direction:column;gap:12px}
20
+ .box{border:1px solid #d8dde5;border-radius:10px;padding:14px 16px}
21
+ .box b{display:block;font:600 28px 'IBM Plex Mono',monospace;letter-spacing:-.02em}.box span{font-size:13px;color:#5a6476;line-height:1.45;display:block}
22
+ .foot{margin-top:22px;font-size:12.5px;color:#5a6476}
23
+ .legend{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:13px;color:#5a6476;margin-bottom:10px;padding-left:226px}.legend i{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:6px;vertical-align:-1px}
24
+ .row.two{height:78px}.trk{display:flex;flex-direction:column;gap:5px}
25
+ .cmp{position:relative;height:10px;background:#cbd5e1;border-radius:3px;max-width:100%}
26
+ .cmp i{position:absolute;left:calc(100% + 6px);top:-4px;font:500 11.5px 'IBM Plex Mono',monospace;color:#5a6476;font-style:normal}
27
+ </style></head><body><div class="wrap">
28
+ <h1><span>KJH-Judge-4B-ko</span> · 학습하지 않은 한국어 벤치마크</h1>
29
+ <div class="sub">학습 데이터와 다른 출처의 공개 데이터, 0-shot, 보기 기호 점수 방식. 막대 안 흰 선은 95% 신뢰구간.</div>
30
+ <div class="grid"><div>
31
+ <div class="legend"><span><i style="background:#1d4ed8"></i>KJH-Judge-4B-ko · 판정 과제</span><span><i style="background:#94a3b8"></i>KJH-Judge-4B-ko · 지식 시험</span><span><i style="background:#cbd5e1;border:1px solid #94a3b8"></i>Gemma 4 26B-A4B-it (0-shot)</span></div>
32
+ <div class="row two"><div class="nm"><b>NSMC</b><span>영화 리뷰 감성</span></div>
33
+ <div class="trk"><div class="track"><div class="bar" style="width:85.7%"></div><div class="ci" style="left:83.39%;width:4.339999999999989%"></div>
34
+ <div class="chance" style="left:50.0%"><i>무작위 50%</i></div></div><div class="cmp" style="width:88.7%"><i>88.7</i></div></div><div class="val">85.7<small>%</small></div></div><div class="row two"><div class="nm"><b>KLUE-STS</b><span>두 문장이 같은 뜻인가</span></div>
35
+ <div class="trk"><div class="track"><div class="bar" style="width:85.92999999999999%"></div><div class="ci" style="left:82.67999999999999%;width:5.980000000000018%"></div>
36
+ <div class="chance" style="left:50.0%"><i>무작위 50%</i></div></div><div class="cmp" style="width:88.44%"><i>88.4</i></div></div><div class="val">85.9<small>%</small></div></div><div class="row two"><div class="nm"><b>Korean UnSmile</b><span>악플·혐오 표현 판별</span></div>
37
+ <div class="trk"><div class="track"><div class="bar" style="width:82.1%"></div><div class="ci" style="left:79.60000000000001%;width:4.75%"></div>
38
+ <div class="chance" style="left:50.0%"><i>무작위 50%</i></div></div><div class="cmp" style="width:81.3%"><i>81.3</i></div></div><div class="val">82.1<small>%</small></div></div><div class="row two"><div class="nm"><b>KorNLI</b><span>문장 관계 3분류</span></div>
39
+ <div class="trk"><div class="track"><div class="bar" style="width:74.5%"></div><div class="ci" style="left:71.71%;width:5.390000000000015%"></div>
40
+ <div class="chance" style="left:33.33%"><i>무작위 33%</i></div></div><div class="cmp" style="width:77.10000000000001%"><i>77.1</i></div></div><div class="val">74.5<small>%</small></div></div><div class="row know two"><div class="nm"><b>HAE-RAE 1.0</b><span>한국 문화·어휘 지식</span></div>
41
+ <div class="trk"><div class="track"><div class="bar" style="width:56.15%"></div><div class="ci" style="left:53.03%;width:6.200000000000003%"></div>
42
+ <div class="chance" style="left:20.84%"><i>무작위 21%</i></div></div><div class="cmp" style="width:79.65%"><i>79.7</i></div></div><div class="val">56.1<small>%</small></div></div><div class="row know two"><div class="nm"><b>KMMLU</b><span>전문 지식 4지선다</span></div>
43
+ <div class="trk"><div class="track"><div class="bar" style="width:42.63%"></div><div class="ci" style="left:39.58%;width:6.149999999999999%"></div>
44
+ <div class="chance" style="left:25.0%"><i>무작위 25%</i></div></div><div class="cmp" style="width:64.03999999999999%"><i>64.0</i></div></div><div class="val">42.6<small>%</small></div></div></div>
45
+ <div class="side">
46
+ <div class="box"><b>4.02B</b><span>파라미터 · Qwen3-4B에서 미세조정</span></div>
47
+ <div class="box"><b>250ms</b><span>판정 한 번 (중앙값, 왕복 포함)<br>Gemma 4 26B-A4B 621ms · 생각 켜고 답하면 6.3초</span></div>
48
+ <div class="box"><b>0.027</b><span>기대 보정 오차(ECE)<br>확률을 그대로 기준으로 쓸 수 있음</span></div>
49
+ <div class="box"><b>97.9%</b><span>보기를 거꾸로 놓아도 같은 답</span></div>
50
+ </div></div>
51
+ <div class="foot">문항 수: NSMC·KorNLI·UnSmile 각 1,000 (고정 시드 표본), KLUE-STS 519 (전체), KMMLU 990 (45과목 고르게), HAE-RAE 983 (6영역 고르게). 재현: eval/bench_heldout.py</div>
52
+ </div></body></html>
eval/compare/api-85669a50.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "85669a50",
3
+ "via": "api",
4
+ "format": "chat",
5
+ "4bit": false,
6
+ "made": "2026-11-09 14:37",
7
+ "results": {
8
+ "nsmc": {
9
+ "n": 1000,
10
+ "acc": 0.887,
11
+ "ci95": [
12
+ 0.8659,
13
+ 0.9052
14
+ ],
15
+ "seconds": 168
16
+ },
17
+ "kornli": {
18
+ "n": 1000,
19
+ "acc": 0.771,
20
+ "ci95": [
21
+ 0.7439,
22
+ 0.796
23
+ ],
24
+ "seconds": 171
25
+ },
26
+ "klue_sts": {
27
+ "n": 519,
28
+ "acc": 0.8844,
29
+ "ci95": [
30
+ 0.854,
31
+ 0.9091
32
+ ],
33
+ "seconds": 86
34
+ },
35
+ "unsmile": {
36
+ "n": 1000,
37
+ "acc": 0.813,
38
+ "ci95": [
39
+ 0.7877,
40
+ 0.836
41
+ ],
42
+ "seconds": 183
43
+ },
44
+ "kmmlu": {
45
+ "n": 990,
46
+ "acc": 0.6404,
47
+ "ci95": [
48
+ 0.61,
49
+ 0.6697
50
+ ],
51
+ "seconds": 251
52
+ },
53
+ "haerae": {
54
+ "n": 983,
55
+ "acc": 0.7965,
56
+ "ci95": [
57
+ 0.7702,
58
+ 0.8205
59
+ ],
60
+ "seconds": 188
61
+ }
62
+ }
63
+ }
eval/compare/labels.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "api-85669a50": "Gemma 4 26B-A4B-it (0-shot)"
3
+ }
eval/fill_card.py ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """eval/heldout_results.json 으로 README.md 를 채운다.
2
+ - 본문의 '학습하지 않은 공개 벤치마크' 표
3
+ - 맨 위 YAML 의 model-index (모델 페이지 오른쪽 'Evaluation results' 상자)
4
+
5
+ python eval/fill_card.py [--repo 계정/KJH-Judge-4B-ko]
6
+ """
7
+ import argparse
8
+ import json
9
+ import re
10
+ from pathlib import Path
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ NAMES = {"nsmc": "NSMC", "kornli": "KorNLI (XNLI)", "klue_sts": "KLUE-STS", "unsmile": "Korean UnSmile", "kmmlu": "KMMLU", "haerae": "HAE-RAE Bench 1.0"}
14
+ META = { # model-index: (과제 종류, 과제 이름, 데이터셋 id, 설정, 분할)
15
+ "nsmc": ("text-classification", "Sentiment classification", "e9t/nsmc", None, "test"),
16
+ "kornli": ("text-classification", "Natural language inference", "kakaobrain/kor_nli", "xnli", "test"),
17
+ "klue_sts": ("text-classification", "Paraphrase detection (binary STS)", "klue/klue", "sts", "validation"),
18
+ "unsmile": ("text-classification", "Hate speech detection", "smilegate-ai/kor_unsmile", None, "valid"),
19
+ "kmmlu": ("multiple-choice", "Knowledge QA", "HAERAE-HUB/KMMLU", None, "test"),
20
+ "haerae": ("multiple-choice", "Korean knowledge QA", "HAERAE-HUB/HAE_RAE_BENCH_1.0", None, "test"),
21
+ }
22
+
23
+
24
+ def main():
25
+ ap = argparse.ArgumentParser()
26
+ ap.add_argument("--repo", help="계정/저장소 이름. 주면 카드 안의 KJH/KJH-Judge-4B-ko 를 바꾼다")
27
+ a = ap.parse_args()
28
+ R = json.loads((ROOT / "eval" / "heldout_results.json").read_text(encoding="utf-8"))["results"]
29
+ card = (ROOT / "README.md").read_text(encoding="utf-8")
30
+
31
+ rows = ["| 벤치마크 | 무엇을 재나 | 문항 | 정확도 (95% 구간) | 무작위 | 출처 · 라이선스 |", "|---|---|---:|---:|---:|---|"]
32
+ for k, v in R.items():
33
+ rows.append(f"| {NAMES.get(k, k)} | {v['desc']} | {v['n']:,} | **{v['acc'] * 100:.1f}%** ({v['ci95'][0] * 100:.1f}~{v['ci95'][1] * 100:.1f}) | {v['chance'] * 100:.0f}% | {v['source']} · {v['license']} |")
34
+ s, e = card.index("<!-- HELDOUT:start -->"), card.index("<!-- HELDOUT:end -->")
35
+ card = card[:s] + "<!-- HELDOUT:start -->\n" + "\n".join(rows) + "\n" + card[e:]
36
+
37
+ # 같은 조건 비교 (eval/compare/*.json, bench_compare.py 결과)
38
+ sys_path = str(ROOT / "eval")
39
+ import sys
40
+ sys.path.insert(0, sys_path)
41
+ from make_chart import comparisons
42
+ comps = comparisons()
43
+ if comps and "<!-- COMPARE:start -->" in card:
44
+ hdr = "| 벤치마크 | **KJH-Judge-4B-ko (4B)** | " + " | ".join(n for n, _ in comps) + " |"
45
+ cmp_rows = ["**같은 조건 비교** · 같은 문항 · 같은 프롬프트 · 0-shot · 보기 기호 점수. 다른 모델은 생각(thinking)을 끄고 각자의 대화 형식으로 물었습니다.", "",
46
+ hdr, "|---|---:|" + "---:|" * len(comps)]
47
+ for k, v in R.items():
48
+ cells = []
49
+ for _, c in comps:
50
+ cells.append(f"{c[k]['acc'] * 100:.1f}%" if k in c else "—")
51
+ cmp_rows.append(f"| {NAMES.get(k, k)} | **{v['acc'] * 100:.1f}%** | " + " | ".join(cells) + " |")
52
+ s, e = card.index("<!-- COMPARE:start -->"), card.index("<!-- COMPARE:end -->")
53
+ card = card[:s] + "<!-- COMPARE:start -->\n" + "\n".join(cmp_rows) + "\n" + card[e:]
54
+
55
+ mi = ["model-index:", " - name: KJH-Judge-4B-ko", " results:"]
56
+ for k, v in R.items():
57
+ t, tn, ds, cfg, sp = META[k]
58
+ mi += [f" - task: {{type: {t}, name: {tn}}}",
59
+ f" dataset: {{name: {NAMES[k]}, type: {ds}" + (f", config: {cfg}" if cfg else "") + f", split: {sp}}}",
60
+ f" metrics:", f" - {{type: accuracy, value: {v['acc'] * 100:.1f}, name: accuracy (0-shot, n={v['n']})}}"]
61
+ head, body = card.split("\n---\n", 1)
62
+ head = re.sub(r"\nmodel-index:[\s\S]*$", "", head)
63
+ card = head + "\n" + "\n".join(mi) + "\n---\n" + body
64
+ if a.repo:
65
+ card = card.replace("KJH/KJH-Judge-4B-ko", a.repo)
66
+ (ROOT / "README.md").write_text(card, encoding="utf-8")
67
+ print("\n".join(rows))
68
+
69
+
70
+ if __name__ == "__main__":
71
+ main()
eval/heldout_results.json ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "made": "2026-11-09 13:51",
3
+ "protocol": "0-shot, 보기 기호 점수(온도 보정 softmax), 표본 고정 시드",
4
+ "results": {
5
+ "nsmc": {
6
+ "desc": "영화 리뷰 감성 (긍정/부정)",
7
+ "source": "e9t/nsmc · ratings_test",
8
+ "license": "CC0 1.0",
9
+ "n": 1000,
10
+ "acc": 0.857,
11
+ "ci95": [
12
+ 0.8339,
13
+ 0.8773
14
+ ],
15
+ "chance": 0.5,
16
+ "mean_conf": 0.9491,
17
+ "seconds": 120
18
+ },
19
+ "kornli": {
20
+ "desc": "문장 관계 3분류 (XNLI 한국어 번역)",
21
+ "source": "kakaobrain/kor_nli · xnli/test",
22
+ "license": "CC BY-SA 4.0",
23
+ "n": 1000,
24
+ "acc": 0.745,
25
+ "ci95": [
26
+ 0.7171,
27
+ 0.771
28
+ ],
29
+ "chance": 0.3333,
30
+ "mean_conf": 0.8362,
31
+ "seconds": 148
32
+ },
33
+ "klue_sts": {
34
+ "desc": "두 문장이 같은 뜻인지 (예/아니오)",
35
+ "source": "klue/klue · sts/validation (binary-label)",
36
+ "license": "CC BY-SA 4.0",
37
+ "n": 519,
38
+ "acc": 0.8593,
39
+ "ci95": [
40
+ 0.8268,
41
+ 0.8866
42
+ ],
43
+ "chance": 0.5,
44
+ "mean_conf": 0.8744,
45
+ "seconds": 58
46
+ },
47
+ "unsmile": {
48
+ "desc": "악플·혐오 표현 여부",
49
+ "source": "smilegate-ai/kor_unsmile · valid (clean 여부)",
50
+ "license": "CC BY-NC-ND 4.0",
51
+ "n": 1000,
52
+ "acc": 0.821,
53
+ "ci95": [
54
+ 0.796,
55
+ 0.8435
56
+ ],
57
+ "chance": 0.5,
58
+ "mean_conf": 0.9137,
59
+ "seconds": 126
60
+ },
61
+ "kmmlu": {
62
+ "desc": "한국어 전문 지식 4지선다 (45과목)",
63
+ "source": "HAERAE-HUB/KMMLU · test",
64
+ "license": "CC BY-ND 4.0",
65
+ "n": 990,
66
+ "acc": 0.4263,
67
+ "ci95": [
68
+ 0.3958,
69
+ 0.4573
70
+ ],
71
+ "chance": 0.25,
72
+ "mean_conf": 0.5285,
73
+ "seconds": 200
74
+ },
75
+ "haerae": {
76
+ "desc": "한국 문화·어휘 지식 5지선다",
77
+ "source": "HAERAE-HUB/HAE_RAE_BENCH_1.0 · test",
78
+ "license": "CC BY-NC-ND 4.0",
79
+ "n": 983,
80
+ "acc": 0.5615,
81
+ "ci95": [
82
+ 0.5303,
83
+ 0.5923
84
+ ],
85
+ "chance": 0.2084,
86
+ "mean_conf": 0.5714,
87
+ "seconds": 133
88
+ }
89
+ }
90
+ }
eval/make_chart.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """모델 카드용 벤치마크 그림(assets/benchmark.png)을 만든다: HTML로 그린 뒤 Edge/Chrome 헤드리스로 찍는다.
2
+
3
+ python eval/make_chart.py [--browser 경로]
4
+ """
5
+ import argparse
6
+ import json
7
+ import shutil
8
+ import subprocess
9
+ import tempfile
10
+ from pathlib import Path
11
+
12
+ ROOT = Path(__file__).resolve().parent.parent
13
+ NAMES = {"nsmc": ("NSMC", "영화 리뷰 감성"), "klue_sts": ("KLUE-STS", "두 문장이 같은 뜻인가"), "unsmile": ("Korean UnSmile", "악플·혐오 표현 판별"),
14
+ "kornli": ("KorNLI", "문장 관계 3분류"), "haerae": ("HAE-RAE 1.0", "한국 문화·어휘 지식"), "kmmlu": ("KMMLU", "전문 지식 4지선다")}
15
+ KNOWLEDGE = {"kmmlu", "haerae"}
16
+
17
+
18
+ def speed_box():
19
+ f = ROOT / "eval" / "speed_results.json"
20
+ if not f.is_file():
21
+ return '<div class="box"><b>~75ms</b><span>판정 한 번 (GPU, 짧은 입력)<br>글을 생성하지 않고 한 번만 계산</span></div>'
22
+ s = json.loads(f.read_text(encoding="utf-8"))
23
+ return (f'<div class="box"><b>{s["kjh_single"]["median_ms"]}ms</b><span>판정 한 번 (중앙값, 왕복 포함)<br>'
24
+ f'Gemma 4 26B-A4B {s["api_single"]["median_ms"]}ms · 생각 켜고 답하면 {s["api_thinking"]["median_ms"] / 1000:.1f}초</span></div>')
25
+
26
+
27
+ def comparisons():
28
+ """eval/compare/*.json (bench_compare.py 결과) → [(이름, 결과)]. KJH 자신(-jev)은 뺀다."""
29
+ d = ROOT / "eval" / "compare"
30
+ labels = json.loads((d / "labels.json").read_text(encoding="utf-8")) if (d / "labels.json").is_file() else {}
31
+ out = []
32
+ for f in sorted(d.glob("*.json")):
33
+ if f.name == "labels.json" or f.stem.endswith("-jev"):
34
+ continue
35
+ j = json.loads(f.read_text(encoding="utf-8"))
36
+ out.append((labels.get(f.stem, j.get("model", f.stem)), j["results"]))
37
+ return out
38
+
39
+
40
+ def html(R):
41
+ order = [k for k in NAMES if k in R]
42
+ comps = comparisons()
43
+ rows = ""
44
+ for k in order:
45
+ v, (nm, desc) = R[k], NAMES[k]
46
+ acc, lo, hi, ch = v["acc"] * 100, v["ci95"][0] * 100, v["ci95"][1] * 100, v["chance"] * 100
47
+ cls = "know" if k in KNOWLEDGE else ""
48
+ cmp_html = "".join(f'<div class="cmp" style="width:{c[k]["acc"] * 100}%"><i>{c[k]["acc"] * 100:.1f}</i></div>' for _, c in comps if k in c)
49
+ rows += f"""<div class="row {cls} {'two' if cmp_html else ''}"><div class="nm"><b>{nm}</b><span>{desc}</span></div>
50
+ <div class="trk"><div class="track"><div class="bar" style="width:{acc}%"></div><div class="ci" style="left:{lo}%;width:{hi - lo}%"></div>
51
+ <div class="chance" style="left:{ch}%"><i>무작위 {ch:.0f}%</i></div></div>{cmp_html}</div><div class="val">{acc:.1f}<small>%</small></div></div>"""
52
+ legend_cmp = "".join(f'<span><i style="background:#cbd5e1;border:1px solid #94a3b8"></i>{n}</span>' for n, _ in comps)
53
+ return f"""<!doctype html><html><head><meta charset="utf-8">
54
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap">
55
+ <style>
56
+ *{{box-sizing:border-box}}body{{margin:0;background:#ffffff;font-family:'IBM Plex Sans KR','Malgun Gothic',sans-serif;color:#121823}}
57
+ .wrap{{width:1200px;padding:40px 48px 36px}}
58
+ h1{{margin:0;font-size:30px;font-weight:700;letter-spacing:-.02em}}h1 span{{color:#1d4ed8}}
59
+ .sub{{margin:8px 0 28px;color:#5a6476;font-size:16px}}
60
+ .grid{{display:grid;grid-template-columns:1fr 270px;gap:36px}}
61
+ .row{{display:grid;grid-template-columns:210px 1fr 96px;gap:16px;align-items:center;height:62px}}
62
+ .nm b{{display:block;font-size:17px}}.nm span{{font-size:13px;color:#5a6476}}
63
+ .track{{position:relative;height:26px;background:#eef1f5;border-radius:5px}}
64
+ .bar{{position:absolute;inset:0 auto 0 0;background:#1d4ed8;border-radius:5px}}
65
+ .know .bar{{background:#94a3b8}}
66
+ .ci{{position:absolute;top:11px;height:4px;background:rgba(255,255,255,.75);border-radius:2px}}
67
+ .chance{{position:absolute;top:-6px;bottom:-6px;border-left:2px dashed #121823;opacity:.55}}
68
+ .chance i{{position:absolute;top:-17px;left:4px;font-style:normal;font-size:11px;white-space:nowrap;color:#121823}}
69
+ .val{{font:600 26px 'IBM Plex Mono',monospace;text-align:right}}.val small{{font-size:15px;color:#5a6476}}
70
+ .sep{{margin:6px 0 4px;font-size:12.5px;color:#5a6476;padding-left:226px}}
71
+ .side{{display:flex;flex-direction:column;gap:12px}}
72
+ .box{{border:1px solid #d8dde5;border-radius:10px;padding:14px 16px}}
73
+ .box b{{display:block;font:600 28px 'IBM Plex Mono',monospace;letter-spacing:-.02em}}.box span{{font-size:13px;color:#5a6476;line-height:1.45;display:block}}
74
+ .foot{{margin-top:22px;font-size:12.5px;color:#5a6476}}
75
+ .legend{{display:flex;flex-wrap:wrap;gap:6px 18px;font-size:13px;color:#5a6476;margin-bottom:10px;padding-left:226px}}.legend i{{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:6px;vertical-align:-1px}}
76
+ .row.two{{height:78px}}.trk{{display:flex;flex-direction:column;gap:5px}}
77
+ .cmp{{position:relative;height:10px;background:#cbd5e1;border-radius:3px;max-width:100%}}
78
+ .cmp i{{position:absolute;left:calc(100% + 6px);top:-4px;font:500 11.5px 'IBM Plex Mono',monospace;color:#5a6476;font-style:normal}}
79
+ </style></head><body><div class="wrap">
80
+ <h1><span>KJH-Judge-4B-ko</span> · 학습하지 않은 한국어 벤치마크</h1>
81
+ <div class="sub">학습 데이터와 다른 출처의 공개 데이터, 0-shot, 보기 기호 점수 방식. 막대 안 흰 선은 95% 신뢰구간.</div>
82
+ <div class="grid"><div>
83
+ <div class="legend"><span><i style="background:#1d4ed8"></i>KJH-Judge-4B-ko · 판정 과제</span><span><i style="background:#94a3b8"></i>KJH-Judge-4B-ko · 지식 시험</span>{legend_cmp}</div>
84
+ {rows}</div>
85
+ <div class="side">
86
+ <div class="box"><b>4.02B</b><span>파라미터 · Qwen3-4B에서 미세조정</span></div>
87
+ {speed_box()}
88
+ <div class="box"><b>0.027</b><span>기대 보정 오차(ECE)<br>확률을 그대로 기준으로 쓸 수 있음</span></div>
89
+ <div class="box"><b>97.9%</b><span>보기를 거꾸로 놓아도 같은 답</span></div>
90
+ </div></div>
91
+ <div class="foot">문항 수: NSMC·KorNLI·UnSmile 각 1,000 (고정 시드 표본), KLUE-STS 519 (전체), KMMLU {R.get('kmmlu', {}).get('n', 0):,} (45과목 고르게), HAE-RAE {R.get('haerae', {}).get('n', 0):,} (6영역 고르게). 재현: eval/bench_heldout.py</div>
92
+ </div></body></html>"""
93
+
94
+
95
+ def main():
96
+ ap = argparse.ArgumentParser()
97
+ ap.add_argument("--browser", default=next((p for p in [r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", r"C:\Program Files\Google\Chrome\Application\chrome.exe",
98
+ shutil.which("google-chrome") or "", shutil.which("chromium") or ""] if p and Path(p).exists()), None))
99
+ a = ap.parse_args()
100
+ R = json.loads((ROOT / "eval" / "heldout_results.json").read_text(encoding="utf-8"))["results"]
101
+ (ROOT / "assets").mkdir(exist_ok=True)
102
+ src = ROOT / "eval" / "chart.html"
103
+ src.write_text(html(R), encoding="utf-8")
104
+ out = ROOT / "assets" / "benchmark.png"
105
+ h = 250 + (78 if comparisons() else 62) * len(R) + 40
106
+ with tempfile.TemporaryDirectory() as prof:
107
+ subprocess.run([a.browser, "--headless=new", "--disable-gpu", f"--user-data-dir={prof}", "--hide-scrollbars", "--force-device-scale-factor=2",
108
+ f"--window-size=1200,{h}", "--virtual-time-budget=4000", f"--screenshot={out}", src.as_uri()], check=True, timeout=120)
109
+ print("저장:", out)
110
+
111
+
112
+ if __name__ == "__main__":
113
+ main()
eval/speed_results.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "made": "2026-11-09 14:39",
3
+ "api_model": "85669a50",
4
+ "n": 60,
5
+ "note": "같은 PC에서 측정, 네트워크 왕복 포함",
6
+ "kjh_single": {
7
+ "n": 60,
8
+ "median_ms": 250,
9
+ "p90_ms": 1143,
10
+ "mean_ms": 573,
11
+ "server_compute_median_ms": 87
12
+ },
13
+ "api_single": {
14
+ "n": 60,
15
+ "median_ms": 621,
16
+ "p90_ms": 2160,
17
+ "mean_ms": 899
18
+ },
19
+ "kjh_throughput": {
20
+ "concurrency": 4,
21
+ "decisions": 60,
22
+ "seconds": 15.26,
23
+ "per_sec": 3.9
24
+ },
25
+ "api_throughput": {
26
+ "concurrency": 4,
27
+ "decisions": 60,
28
+ "seconds": 6.09,
29
+ "per_sec": 9.9
30
+ },
31
+ "api_thinking": {
32
+ "n": 8,
33
+ "median_ms": 6294,
34
+ "p90_ms": 7922,
35
+ "mean_ms": 6921,
36
+ "completion_tokens_median": 294.5
37
+ },
38
+ "connection_retries": 9
39
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": false,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "transformers_version": "5.20.2"
10
+ }
judge.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """KJH-Judge-4B-ko 판정 도우미 — 정해진 보기 중 하나를 골라 보정된 확률과 함께 돌려준다.
2
+
3
+ from judge import Judge
4
+ j = Judge("coderecode95/KJH-Judge-4B-ko") # 또는 내려받은 폴더 경로
5
+ j.decide("문장의 감정 극성을 판단한다.", {"text": "택배사 정말 마음에 듬"}, ["긍정적 감정", "부정적 감정"])
6
+ # → {'choice': 'A', 'index': 0, 'text': '긍정적 감정', 'confidence': 0.9966, 'probs': {'A': 0.9966, 'B': 0.0034}}
7
+
8
+ 동작: 아래 형식의 프롬프트를 한 번 계산하고, 다음 토큰 자리에서 보기 기호(A, B, …) 토큰의 점수만 꺼내
9
+ calibration.json 의 온도로 나눠 softmax 한다. 글을 생성하지 않으므로 빠르다 (GPU에서 판정 한 번 수십 ms).
10
+
11
+ <|im_start|>user
12
+ {과제 설명}
13
+
14
+ {항목 이름}: {값} ← item 의 키마다 한 줄 (값이 문자열이 아니면 JSON)
15
+
16
+ 보기:
17
+ A. {보기 1}
18
+ B. {보기 2}
19
+
20
+ 정답 보기의 기호 하나만 답하세요.<|im_end|>
21
+ <|im_start|>assistant
22
+ """
23
+ import json
24
+ from pathlib import Path
25
+
26
+ import torch
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer
28
+
29
+ HINT = "정답 보기의 기호 하나만 답하세요."
30
+
31
+
32
+ def render_prompt(instruction, item, choices):
33
+ lines = [f"{k}: {v if isinstance(v, str) else json.dumps(v, ensure_ascii=False)}" for k, v in item.items()]
34
+ opts = "\n".join(f"{chr(65 + i)}. {c}" for i, c in enumerate(choices))
35
+ return "\n\n".join([instruction.strip(), "\n".join(lines), "보기:\n" + opts, HINT])
36
+
37
+
38
+ def chat_prefix(prompt):
39
+ return f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
40
+
41
+
42
+ def _temperature(model):
43
+ p = Path(model) / "calibration.json"
44
+ if not p.is_file():
45
+ try:
46
+ from huggingface_hub import hf_hub_download
47
+ p = Path(hf_hub_download(model, "calibration.json"))
48
+ except Exception:
49
+ return 1.0
50
+ return float(json.loads(p.read_text(encoding="utf-8"))["temperature"])
51
+
52
+
53
+ class Judge:
54
+ def __init__(self, model="coderecode95/KJH-Judge-4B-ko", device=None, dtype=None):
55
+ device = device or ("cuda" if torch.cuda.is_available() else "cpu")
56
+ dtype = dtype or (torch.bfloat16 if device != "cpu" else torch.float32)
57
+ self.tok = AutoTokenizer.from_pretrained(model)
58
+ self.model = AutoModelForCausalLM.from_pretrained(model, dtype=dtype).to(device).eval()
59
+ self.device = device
60
+ self.temperature = _temperature(model)
61
+ self.letter_ids = [self.tok.encode(chr(65 + i), add_special_tokens=False)[0] for i in range(26)]
62
+
63
+ def _encode(self, instruction, item, choices):
64
+ return self.tok.encode(chat_prefix(render_prompt(instruction, item, choices)), add_special_tokens=False)
65
+
66
+ @torch.no_grad()
67
+ def decide_batch(self, requests, batch_size=16, max_tokens=8000):
68
+ """requests: [{"instruction": str, "item": dict, "choices": [str, …]}, …] → 같은 순서의 결과 목록.
69
+ 보기는 2~26개. 길이가 비슷한 것끼리 묶어 계산한다 (오른쪽을 채우고 각 문장의 마지막 자리만 읽으므로 결과는 하나씩 계산한 것과 같다)."""
70
+ seqs = []
71
+ for r in requests:
72
+ ch = [c["text"] if isinstance(c, dict) else str(c) for c in r["choices"]]
73
+ if not 2 <= len(ch) <= 26:
74
+ raise ValueError("보기는 2~26개여야 합니다")
75
+ seqs.append((self._encode(r["instruction"], r["item"], ch), ch))
76
+ order = sorted(range(len(seqs)), key=lambda i: len(seqs[i][0]))
77
+ out = [None] * len(seqs)
78
+ W = self.model.get_output_embeddings().weight
79
+ i = 0
80
+ while i < len(order):
81
+ grp = [order[i]]
82
+ while i + len(grp) < len(order) and len(grp) < batch_size and (len(grp) + 1) * len(seqs[order[i + len(grp)]][0]) <= max_tokens:
83
+ grp.append(order[i + len(grp)])
84
+ i += len(grp)
85
+ n = max(len(seqs[k][0]) for k in grp)
86
+ x = torch.zeros(len(grp), n, dtype=torch.long)
87
+ for r, k in enumerate(grp):
88
+ x[r, :len(seqs[k][0])] = torch.tensor(seqs[k][0])
89
+ h = self.model.model(input_ids=x.to(self.device)).last_hidden_state # 최종 정규화까지 마친 은닉 상태
90
+ for r, k in enumerate(grp):
91
+ ids, ch = seqs[k]
92
+ rows = torch.tensor(self.letter_ids[:len(ch)], device=self.device)
93
+ scores = (h[r, len(ids) - 1].float() @ W[rows].float().T) / self.temperature
94
+ p = torch.softmax(scores, -1).tolist()
95
+ b = max(range(len(p)), key=p.__getitem__)
96
+ out[k] = {"choice": chr(65 + b), "index": b, "text": ch[b], "confidence": round(p[b], 4),
97
+ "probs": {chr(65 + j): round(v, 4) for j, v in enumerate(p)}}
98
+ return out
99
+
100
+ def decide(self, instruction, item, choices):
101
+ return self.decide_batch([{"instruction": instruction, "item": item, "choices": choices}])[0]
102
+
103
+
104
+ if __name__ == "__main__":
105
+ import sys
106
+ j = Judge(sys.argv[1] if len(sys.argv) > 1 else ".")
107
+ print(j.decide("문장의 감정 극성을 판단한다.", {"text": "택배사 정말 마음에 듬"}, ["긍정적 감정", "부정적 감정"]))
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b248d38ad0ff27278f11f257a2eaa9130aad631b96cbb75292a844f8596b68a
3
+ size 8044982080
space/README.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: KJH-Judge-4B-ko Showreel
3
+ emoji: 🎬
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: static
7
+ app_file: index.html
8
+ pinned: false
9
+ license: cc-by-sa-4.0
10
+ models:
11
+ - coderecode95/KJH-Judge-4B-ko
12
+ short_description: 실제 판정 결과로 만든 KJH-Judge-4B-ko 소개 쇼릴
13
+ ---
14
+
15
+ # KJH-Judge-4B-ko 쇼릴
16
+
17
+ [KJH-Judge-4B-ko](https://huggingface.co/coderecode95/KJH-Judge-4B-ko)를 소개하는 약 2분짜리 자동 재생 페이지입니다. 화면의 숫자와 판정은 모두 이 모델로 미리 계산해 저장한 **실제 출력**이며, 페이지가 모델을 직접 돌리지는 않습니다.
18
+
19
+ - 조작: `Space` 일시정지 · `←` `→` 장면 이동 · `1`~`0` 장면 바로가기 · `R` 처음부터 · `C` 자막 · `H` 조작바 숨김 · `F` 전체화면
20
+ - 주소 옵션: `?s=3` 3번 장면부터 · `?loop=1` 반복 · `?cap=0` 자막 끔 · `?hold=1` 자동 넘김 끔
21
+
22
+ ## 주의
23
+
24
+ - 순위 장면의 다른 모델 점수는 Korean JEV Benchmark 공개 표(2026-10-09)의 0-shot 결과입니다. KJH-Judge-4B-ko는 같은 출처 데이터의 학습 분할로 미세조정했으므로 같은 조건의 비교가 아닙니다.
25
+ - 판정 시간(약 0.08초)은 GPU 1장에서 서버 안 계산 시간이며 네트워크 왕복은 포함하지 않습니다.
26
+
27
+ ## 출처
28
+
29
+ - 한국어 문제 3개: [KoBEST](https://huggingface.co/datasets/skt/kobest_v1) WiC·COPA, [KLUE](https://huggingface.co/datasets/klue/klue) YNAT — CC BY-SA 4.0. 이 때문에 이 Space는 CC BY-SA 4.0으로 공개합니다.
30
+ - 벤치마크: [Korean JEV Benchmark](https://huggingface.co/datasets/DaehanKim/korean-jev-benchmark)
31
+ - 고객 문의·뉴스·대화 예시는 직접 만든 문장이며, 뉴스의 회사는 가상입니다.
space/index.html ADDED
@@ -0,0 +1,801 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>KJH-Judge-4B-ko 쇼릴</title>
7
+ <!-- 영상 촬영용 자동 재생 페이지 · KJH-Judge-4B-ko
8
+ 1920×1080 무대를 창 크기에 맞춰 늘리고, 장면마다 저장된 '실제 모델 판정 결과'만 재생한다 (서버 불필요).
9
+ 조작: Space 일시정지 · ←/→ 장면 이동 · 1~9,0 장면 바로가기 · R 처음부터 · H 조작바 숨김 · C 자막 · F 전체화면
10
+ 주소 옵션: ?s=3 (3번 장면부터) · ?loop=1 (반복) · ?cap=0 (자막 끔) · ?clean=1 (조작바 숨기고 시작) · ?hold=1 (자동 넘김 끔) · ?at=4000 (장면 안 4초 지점부터) -->
11
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
12
+ <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
13
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap">
14
+ <style>
15
+ :root{
16
+ --bg:#04060b;--ink:#f4f6fb;--ink2:#cdd3df;--muted:#8b94a7;--faint:#566074;
17
+ --stroke:rgba(255,255,255,.085);--stroke2:rgba(255,255,255,.15);
18
+ --grad:linear-gradient(100deg,#b9a6ff 0%,#72b8ff 48%,#5ff0d2 100%);
19
+ --call:#6aa6ff;--ask:#ffb44d;--respond:#3ee0b0;--good:#4ade80;--bad:#ff6b5e;--hi:#ffd36b;
20
+ --sans:"Pretendard Variable","Pretendard",-apple-system,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;
21
+ --mono:"JetBrains Mono","IBM Plex Mono",Consolas,monospace;
22
+ --ease:cubic-bezier(.2,.8,.2,1);
23
+ }
24
+ *{box-sizing:border-box}
25
+ html,body{margin:0;height:100%;background:#000;overflow:hidden}
26
+ body{color:var(--ink);font-family:var(--sans);-webkit-font-smoothing:antialiased;word-break:keep-all;font-feature-settings:"tnum" 0}
27
+ body.idle{cursor:none}
28
+
29
+ /* ── 무대 ── */
30
+ #stage{position:absolute;left:50%;top:50%;width:1920px;height:1080px;transform-origin:center;overflow:hidden;background:var(--bg);isolation:isolate}
31
+ #aurora{position:absolute;inset:0;z-index:0;overflow:hidden}
32
+ #aurora .b{position:absolute;border-radius:50%;filter:blur(150px);opacity:.42;transition:background-color 1.8s ease}
33
+ #aurora .b1{width:1100px;height:900px;left:-320px;top:-380px;animation:d1 22s ease-in-out infinite alternate}
34
+ #aurora .b2{width:1000px;height:900px;right:-360px;top:-200px;animation:d2 26s ease-in-out infinite alternate}
35
+ #aurora .b3{width:1300px;height:700px;left:320px;bottom:-560px;opacity:.3;animation:d3 30s ease-in-out infinite alternate}
36
+ @keyframes d1{to{transform:translate(180px,120px) scale(1.1)}}
37
+ @keyframes d2{to{transform:translate(-160px,160px) scale(.92)}}
38
+ @keyframes d3{to{transform:translate(-200px,-60px) scale(1.08)}}
39
+ #grid{position:absolute;inset:0;z-index:0;background-image:linear-gradient(rgba(255,255,255,.028) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.028) 1px,transparent 1px);background-size:80px 80px;-webkit-mask-image:radial-gradient(ellipse 70% 60% at 50% 45%,#000 20%,transparent 75%);mask-image:radial-gradient(ellipse 70% 60% at 50% 45%,#000 20%,transparent 75%)}
40
+ #grain{position:absolute;inset:0;z-index:30;pointer-events:none;opacity:.07;mix-blend-mode:overlay;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")}
41
+ #vig{position:absolute;inset:0;z-index:29;pointer-events:none;background:radial-gradient(ellipse 85% 80% at 50% 48%,transparent 55%,rgba(0,0,0,.6))}
42
+ #fade{position:absolute;inset:0;z-index:40;background:#000;opacity:0;pointer-events:none}
43
+
44
+ /* ── 상단·하단 고정 요소 ── */
45
+ .chrome{position:absolute;left:80px;right:80px;top:52px;z-index:20;display:flex;align-items:center;gap:18px}
46
+ .brand{display:flex;align-items:center;gap:14px}
47
+ .brand svg{width:44px;height:44px}
48
+ .brand b{font:750 27px/1 var(--sans);letter-spacing:-.03em}
49
+ .brand .pl{padding:6px 11px;border-radius:99px;border:1px solid var(--stroke2);font:600 15px/1 var(--mono);color:var(--ink2);letter-spacing:.04em}
50
+ .chap{margin-left:auto;display:flex;align-items:center;gap:14px;font:500 17px/1 var(--mono);color:var(--muted);letter-spacing:.06em}
51
+ .chap #chapn{color:var(--ink);font-weight:700}
52
+ .chap #chapt{font-family:var(--sans);font-weight:600;letter-spacing:0;color:var(--ink2);min-width:96px}
53
+ .segs{display:flex;gap:5px}
54
+ .segs span{width:26px;height:3px;border-radius:2px;background:rgba(255,255,255,.12);overflow:hidden}
55
+ .segs span i{display:block;height:100%;width:0;background:var(--grad)}
56
+ .live{position:absolute;left:80px;bottom:44px;z-index:20;display:flex;align-items:center;gap:10px;font:500 15px/1 var(--mono);color:var(--faint);letter-spacing:.04em}
57
+ .live i{width:8px;height:8px;border-radius:50%;background:var(--good);box-shadow:0 0 0 4px rgba(74,222,128,.15),0 0 14px var(--good);animation:pulse 2s ease-in-out infinite}
58
+ @keyframes pulse{50%{opacity:.45}}
59
+
60
+ /* ── 장면 · 등장 ── */
61
+ .scene{position:absolute;inset:0;z-index:10;animation:sIn 1s var(--ease)}
62
+ .scene.leaving{animation:sOut .55s ease forwards}
63
+ @keyframes sIn{from{opacity:0;filter:blur(16px);transform:scale(1.035)}}
64
+ @keyframes sOut{to{opacity:0;filter:blur(12px);transform:scale(.985)}}
65
+ .cam{position:absolute;inset:0;padding:156px 140px 200px;display:flex;flex-direction:column;transform-origin:50% 52%}
66
+ [data-in]{opacity:0;transform:translateY(34px);filter:blur(8px);transition:opacity .8s ease,transform .9s var(--ease),filter .8s ease}
67
+ [data-in].on{opacity:1;transform:none;filter:none}
68
+ .words[data-in]{opacity:1;transform:none;filter:none}
69
+ .words .w>span{display:inline-block;opacity:0;transform:translateY(.42em);filter:blur(12px);transition:opacity .8s ease,transform .9s var(--ease),filter .8s ease;transition-delay:calc(var(--d)*70ms)}
70
+ .words.on .w>span{opacity:1;transform:none;filter:none}
71
+ .acc{background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
72
+ .draw{stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.3s cubic-bezier(.6,0,.2,1)}
73
+ .on .draw,.draw.on{stroke-dashoffset:0}
74
+ .dot{transform-box:fill-box;transform-origin:center;transform:scale(0);transition:transform .7s cubic-bezier(.3,1.7,.5,1) .9s}
75
+ .on .dot{transform:none}
76
+
77
+ /* ── 자막 ── */
78
+ .cap{position:absolute;left:50%;bottom:92px;z-index:20;transform:translate(-50%,14px);width:max-content;max-width:1500px;padding:16px 34px;border-radius:18px;
79
+ background:rgba(6,8,14,.62);border:1px solid var(--stroke);backdrop-filter:blur(18px);box-shadow:0 20px 50px -20px rgba(0,0,0,.8);
80
+ font:600 34px/1.4 var(--sans);letter-spacing:-.02em;text-align:center;color:var(--ink);opacity:0;transition:opacity .7s,transform .7s var(--ease)}
81
+ .cap.on{opacity:1;transform:translate(-50%,0)}
82
+ body.nocap .cap{display:none}
83
+
84
+ /* ── 공통 부품 ── */
85
+ .kicker{display:flex;align-items:center;gap:16px;font:500 19px/1 var(--mono);letter-spacing:.16em;color:var(--muted)}
86
+ .kicker b{font-weight:700;background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
87
+ .kicker i{width:46px;height:1px;background:var(--stroke2)}
88
+ .hl{margin:22px 0 0;font:800 80px/1.12 var(--sans);letter-spacing:-.045em}
89
+ .glass{position:relative;background:linear-gradient(180deg,rgba(255,255,255,.065),rgba(255,255,255,.018));border:1px solid var(--stroke);border-radius:28px;
90
+ box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 40px 90px -50px rgba(0,0,0,.95);backdrop-filter:blur(26px) saturate(1.25)}
91
+ .ic{width:1em;height:1em;flex:none}
92
+ .itile{flex:none;width:72px;height:72px;border-radius:20px;display:grid;place-items:center;color:var(--c);font-size:36px;
93
+ background:linear-gradient(180deg,color-mix(in srgb,var(--c) 22%,transparent),color-mix(in srgb,var(--c) 8%,transparent));border:1px solid color-mix(in srgb,var(--c) 42%,transparent);box-shadow:0 10px 30px -12px color-mix(in srgb,var(--c) 60%,transparent)}
94
+ .k-call{--c:var(--call)}.k-ask{--c:var(--ask)}.k-respond{--c:var(--respond)}.k-good{--c:var(--good)}.k-bad{--c:var(--bad)}.k-hi{--c:var(--hi)}.k-mute{--c:#7d879b}
95
+ .bar{position:relative;height:10px;border-radius:99px;background:rgba(255,255,255,.07);overflow:hidden}
96
+ .bar i{position:absolute;left:0;top:0;bottom:0;width:0;border-radius:inherit;background:linear-gradient(90deg,color-mix(in srgb,var(--c,var(--call)) 45%,transparent),var(--c,var(--call)));box-shadow:0 0 18px color-mix(in srgb,var(--c,var(--call)) 70%,transparent)}
97
+ .pct{font:600 34px/1 var(--mono);font-variant-numeric:tabular-nums;letter-spacing:-.03em}
98
+ .mono{font-family:var(--mono)}
99
+ mark{background:color-mix(in srgb,var(--hi) 18%,transparent);color:var(--hi);border-radius:8px;padding:0 8px;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--hi) 35%,transparent)}
100
+ .conn{width:96px;height:30px;color:rgba(255,255,255,.28);justify-self:center}
101
+ .conn path{stroke:currentColor;stroke-width:2;fill:none;stroke-linecap:round;stroke-linejoin:round}
102
+ .chipk{display:inline-flex;align-items:center;gap:10px;padding:10px 18px;border-radius:99px;border:1px solid var(--stroke2);background:rgba(255,255,255,.04);font:500 21px/1 var(--mono);color:var(--ink2);letter-spacing:.02em}
103
+ .chipk b{color:var(--ink);font-weight:700}
104
+ .badge{display:inline-flex;align-items:center;gap:8px;padding:9px 16px;border-radius:99px;font:700 21px/1 var(--sans);color:var(--c);background:color-mix(in srgb,var(--c) 14%,transparent);border:1px solid color-mix(in srgb,var(--c) 35%,transparent)}
105
+ .badge .ic{font-size:22px}
106
+
107
+ /* 1·2 · 택시 */
108
+ .s-hook .who{font:500 20px/1 var(--mono);letter-spacing:.16em;color:var(--muted)}
109
+ .bubble{align-self:flex-start;margin-top:22px;padding:28px 44px;border-radius:44px 44px 44px 14px;font:650 62px/1.2 var(--sans);letter-spacing:-.035em}
110
+ .caret{display:inline-block;width:4px;height:.9em;margin-left:8px;border-radius:2px;background:var(--ink);vertical-align:-.08em;animation:blink 1s steps(2,start) infinite}
111
+ @keyframes blink{to{visibility:hidden}}
112
+ .s-hook .hl{margin-top:44px;font-size:76px}
113
+ .stats{display:flex;gap:14px;margin-top:26px}
114
+ .opts3{display:grid;grid-template-columns:repeat(3,1fr);gap:28px;margin-top:auto}
115
+ .opt3{padding:34px 36px 32px;transition:opacity .8s ease,transform .9s var(--ease),filter .8s ease,box-shadow .8s,border-color .8s}
116
+ .opt3 .tt{margin-top:26px;font:700 42px/1.2 var(--sans);letter-spacing:-.03em}
117
+ .opt3 .ds{margin-top:8px;font:500 25px/1.4 var(--sans);color:var(--muted)}
118
+ .opt3 .meter{margin-top:28px;display:grid;grid-template-columns:1fr auto;gap:20px;align-items:center}
119
+ .opt3 .vd{position:absolute;top:30px;right:30px;padding:9px 14px;border-radius:99px;background:var(--c);color:#090b10;font:700 16px/1 var(--mono);letter-spacing:.14em;opacity:0;transform:scale(.5);transition:opacity .4s,transform .6s cubic-bezier(.3,1.7,.5,1)}
120
+ .opt3.win{border-color:color-mix(in srgb,var(--c) 75%,transparent);transform:translateY(-14px) scale(1.025);box-shadow:0 0 0 1px var(--c),0 0 90px -20px var(--c),inset 0 1px 0 rgba(255,255,255,.12)}
121
+ .opt3.win .vd{opacity:1;transform:none}
122
+ .opt3.lose{opacity:.3;filter:saturate(.15) blur(1.5px)}
123
+ .opt3::after{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;opacity:0;background:linear-gradient(100deg,transparent 35%,rgba(255,255,255,.1) 50%,transparent 65%);background-size:260% 100%;background-position:130% 0}
124
+ .scan .opt3::after{opacity:1;animation:scan 1.1s linear infinite}
125
+ @keyframes scan{to{background-position:-130% 0}}
126
+
127
+ /* 3 · 대화 */
128
+ .turns{display:flex;flex-direction:column;gap:28px;margin-top:54px}
129
+ .turn{display:grid;grid-template-columns:minmax(0,.95fr) 120px minmax(0,1.1fr);align-items:center}
130
+ .turn .ub{justify-self:start;padding:22px 34px;border-radius:32px 32px 32px 10px;font:600 36px/1.3 var(--sans);letter-spacing:-.025em}
131
+ .dec{display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:24px;row-gap:14px;align-items:center;padding:22px 30px 24px;border-color:color-mix(in srgb,var(--c) 38%,var(--stroke))}
132
+ .dec .itile{grid-row:1/3;width:68px;height:68px;font-size:34px}
133
+ .dec .lb{font:700 35px/1.2 var(--sans);letter-spacing:-.025em;display:flex;align-items:center;gap:14px}
134
+ .dec .lb small{padding:6px 10px;border-radius:8px;font:700 15px/1 var(--mono);letter-spacing:.12em;color:var(--c);background:color-mix(in srgb,var(--c) 16%,transparent)}
135
+ .dec .pct{font-size:31px}
136
+ .dec .bar{grid-column:2/4}
137
+ .dec .nt{grid-column:1/-1;font:500 21px/1.45 var(--sans);color:var(--muted)}
138
+
139
+ /* 4·11 · 타이틀 */
140
+ .center{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
141
+ .markbig{width:148px;height:148px;filter:drop-shadow(0 20px 60px rgba(114,184,255,.35))}
142
+ .wm{margin-top:30px;font:820 170px/1 var(--sans);letter-spacing:-.06em;white-space:nowrap}
143
+ .wm .a{background:linear-gradient(180deg,#fff 25%,#c3ccff);-webkit-background-clip:text;background-clip:text;color:transparent}
144
+ .wm .b{font-weight:300;letter-spacing:-.04em;background:var(--grad);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:sheen 6s ease-in-out infinite alternate}
145
+ @keyframes sheen{to{background-position:100% 0}}
146
+ .tag{margin-top:26px;font:600 48px/1.3 var(--sans);letter-spacing:-.035em;color:var(--ink2)}
147
+ .facts{display:grid;grid-template-columns:repeat(3,400px);gap:24px;margin-top:58px}
148
+ .fact{display:grid;grid-template-columns:auto 1fr;column-gap:22px;align-items:center;padding:26px 30px;text-align:left}
149
+ .fact .itile{grid-row:1/3;width:64px;height:64px;font-size:31px}
150
+ .fact b{font:800 46px/1 var(--sans);letter-spacing:-.04em;font-variant-numeric:tabular-nums}
151
+ .fact span{margin-top:8px;font:500 20px/1.4 var(--sans);color:var(--muted)}
152
+ .try{margin-top:50px;display:flex;align-items:center;gap:14px;font:500 25px/1 var(--sans);color:var(--muted)}
153
+ .try b{color:var(--ink);font-weight:600}
154
+
155
+ /* 5 · 학습 전후 */
156
+ .vs{display:grid;grid-template-columns:1fr 130px 1fr;margin-top:44px;flex:1;min-height:0}
157
+ .side{padding:32px 38px;display:flex;flex-direction:column}
158
+ .side.after{border-color:rgba(114,184,255,.35);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 0 120px -40px rgba(114,184,255,.5)}
159
+ .lab{align-self:flex-start;padding:9px 16px;border-radius:99px;border:1px solid var(--stroke2);font:600 21px/1 var(--sans);color:var(--ink2)}
160
+ .tiles{display:grid;grid-template-columns:repeat(15,1fr);gap:6px;margin:26px 0 22px}
161
+ .tiles span{aspect-ratio:1;display:grid;place-items:center;border-radius:9px;font:700 19px/1 var(--mono);background:rgba(255,255,255,.045);color:#5d6678;opacity:0;transform:scale(.4);transition:opacity .4s,transform .5s cubic-bezier(.3,1.5,.5,1);transition-delay:calc(var(--i)*13ms)}
162
+ .tiles.on span{opacity:1;transform:none}
163
+ .after .tiles span{background:hsla(var(--h),90%,66%,.2);color:hsl(var(--h),95%,82%);box-shadow:inset 0 0 0 1px hsla(var(--h),90%,70%,.25)}
164
+ .side .note{font:500 23px/1.4 var(--sans);color:var(--muted)}
165
+ .side .note b{color:var(--ink)}
166
+ .bign{margin-top:auto;font:820 124px/1 var(--sans);letter-spacing:-.06em;font-variant-numeric:tabular-nums}
167
+ .before .bign{color:#8f97a8}
168
+ .after .bign{background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
169
+ .side .sub{margin-top:10px;font:500 23px/1.4 var(--sans);color:var(--muted)}
170
+ .mid{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;font:600 16px/1.3 var(--mono);color:var(--muted);text-align:center;letter-spacing:.06em}
171
+ .mid .ring{width:68px;height:68px;border-radius:50%;display:grid;place-items:center;font-size:30px;color:var(--ink);background:rgba(255,255,255,.05);border:1px solid var(--stroke2)}
172
+
173
+ /* 6 · 한국어 문제 */
174
+ .qs{display:grid;grid-template-columns:repeat(3,1fr);gap:28px;margin-top:46px;flex:1;min-height:0}
175
+ .qc{padding:30px 32px 26px;display:flex;flex-direction:column}
176
+ .qtag{align-self:flex-start;display:inline-flex;align-items:center;gap:10px;padding:8px 14px;border-radius:99px;font:700 19px/1 var(--sans);color:var(--hi);background:color-mix(in srgb,var(--hi) 12%,transparent);border:1px solid color-mix(in srgb,var(--hi) 30%,transparent)}
177
+ .qb{margin:22px 0 18px;font:600 30px/1.48 var(--sans);letter-spacing:-.025em}
178
+ .qb p{margin:0 0 10px}
179
+ .qb small{display:block;margin-top:6px;font:500 21px/1.45 var(--sans);color:var(--muted);letter-spacing:-.01em}
180
+ .op{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px 16px;align-items:center;padding:14px 0;border-top:1px solid var(--stroke);transition:opacity .6s}
181
+ .op .t{font:600 26px/1.3 var(--sans);letter-spacing:-.02em}
182
+ .op .pct{font-size:25px}
183
+ .op .bar{grid-column:1/-1;height:8px}
184
+ .op.dim{opacity:.4}
185
+ .qc .foot{margin-top:auto;padding-top:16px;display:flex;justify-content:space-between;align-items:center;font:500 19px/1 var(--mono);color:var(--muted)}
186
+
187
+ /* 7 · 고객 문의 */
188
+ .rows{display:flex;flex-direction:column;gap:28px;margin-top:50px}
189
+ .row{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr) 110px minmax(0,.62fr);align-items:center;gap:0 22px}
190
+ .msg{padding:24px 32px 28px}
191
+ .msg .h{display:flex;align-items:center;gap:10px;font:500 17px/1 var(--mono);letter-spacing:.12em;color:var(--muted)}
192
+ .msg .h i{width:8px;height:8px;border-radius:50%;background:var(--ask)}
193
+ .msg .t{margin-top:14px;font:600 31px/1.45 var(--sans);letter-spacing:-.025em}
194
+ .chips{display:flex;flex-direction:column;gap:12px}
195
+ .chip{display:grid;grid-template-columns:70px minmax(0,1fr) auto;gap:14px;align-items:center;padding:16px 22px;border-radius:18px}
196
+ .chip .k{font:600 16px/1 var(--mono);letter-spacing:.1em;color:var(--muted)}
197
+ .chip .v{font:700 27px/1.25 var(--sans);letter-spacing:-.025em}
198
+ .chip .pct{font-size:24px;color:var(--ink2)}
199
+ .route{display:flex;flex-direction:column;align-items:center;gap:14px;padding:26px 22px;text-align:center;border-color:color-mix(in srgb,var(--c) 55%,transparent);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 0 80px -30px var(--c)}
200
+ .route .itile{width:62px;height:62px;font-size:30px}
201
+ .route .d{font:750 30px/1.2 var(--sans);letter-spacing:-.03em}
202
+ .route .u{padding:7px 18px;border-radius:99px;font:800 24px/1.1 var(--sans);background:var(--c);color:#090b10}
203
+ .route .s{font:500 15px/1 var(--mono);color:var(--muted);letter-spacing:.06em}
204
+
205
+ /* 8 · 확신 */
206
+ .unsure{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);gap:36px;margin-top:40px;flex:1;min-height:0}
207
+ .ucol{display:flex;flex-direction:column;gap:18px}
208
+ .s-unsure .msg .t{font-size:29px}
209
+ .cands{padding:6px 30px}
210
+ .cands .op:first-child{border-top:0}
211
+ .calib{display:flex;align-items:center;gap:28px;padding:20px 30px}
212
+ .calib .n{font:800 54px/1 var(--sans);letter-spacing:-.05em;font-variant-numeric:tabular-nums}
213
+ .calib .l{margin-top:8px;font:500 18px/1.3 var(--sans);color:var(--muted)}
214
+ .calib .eq{font:300 46px/1 var(--sans);color:var(--faint)}
215
+ .calib .say{margin-left:auto;font:600 22px/1.45 var(--sans);color:var(--ink2);text-align:right}
216
+ .gauge{display:flex;flex-direction:column;align-items:center;padding:28px 34px 28px}
217
+ .gauge .lab2{align-self:flex-start;font:600 22px/1 var(--sans);color:var(--muted)}
218
+ .gwrap{position:relative;width:440px;height:250px;margin-top:14px}
219
+ .gwrap svg{position:absolute;inset:0;overflow:visible}
220
+ .gwrap .gnum{position:absolute;left:0;right:0;bottom:-6px;text-align:center;font:820 96px/1 var(--sans);letter-spacing:-.06em;color:var(--ask);font-variant-numeric:tabular-nums;text-shadow:0 0 50px rgba(255,180,77,.35)}
221
+ .gth{font:600 17px var(--mono);fill:var(--ink2)}
222
+ .hold{margin-top:30px;align-self:stretch;display:flex;align-items:center;justify-content:center;gap:16px;padding:18px 22px;border-radius:18px;background:color-mix(in srgb,var(--ask) 12%,transparent);border:1px solid color-mix(in srgb,var(--ask) 55%,transparent);font:750 29px/1.2 var(--sans);letter-spacing:-.025em;color:var(--ask)}
223
+ .hold .ic{font-size:30px}
224
+ .truth{margin-top:18px;font:500 22px/1.5 var(--sans);color:var(--muted);text-align:center}
225
+ .truth b{color:var(--ink);font-weight:650}
226
+
227
+ /* 9 · 순위 */
228
+ .board{margin-top:24px;display:flex;flex-direction:column;gap:1px}
229
+ .lr{display:grid;grid-template-columns:46px 500px 92px minmax(0,1fr) 150px;gap:20px;align-items:center;padding:3px 20px;border-radius:14px;border:1px solid transparent}
230
+ .lr .rk{font:600 18px/1 var(--mono);color:var(--faint)}
231
+ .lr .nm{font:600 27px/1.2 var(--sans);letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink2)}
232
+ .lr .sz{justify-self:end;padding:5px 10px;border-radius:8px;font:600 16px/1 var(--mono);color:var(--muted);background:rgba(255,255,255,.05)}
233
+ .lr.small .sz{color:var(--ink);background:rgba(255,255,255,.1)}
234
+ .lr .bar{height:20px;border-radius:6px}
235
+ .lr .bar i{border-radius:6px;background:linear-gradient(90deg,#2a3243,#4a5468);box-shadow:none}
236
+ .lr .pct{font-size:27px;text-align:right;color:var(--ink2)}
237
+ .lr.me{background:linear-gradient(90deg,rgba(185,166,255,.13),rgba(95,240,210,.07));border-color:rgba(185,166,255,.38);box-shadow:0 0 70px -20px rgba(114,184,255,.45)}
238
+ .lr.me .nm{font-weight:750;color:var(--ink)}
239
+ .lr.me .rk,.lr.me .pct{color:var(--ink)}
240
+ .lr.me .bar i{background:var(--grad);box-shadow:0 0 22px rgba(114,184,255,.6)}
241
+ .fine{margin-top:16px;font:400 17px/1.5 var(--sans);color:var(--faint);max-width:1640px}
242
+
243
+ /* 10 · 속도 */
244
+ .speed{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:36px;margin-top:40px;flex:1;min-height:0}
245
+ .ticker{overflow:hidden;padding:6px 0}
246
+ .ticker::after{content:"";position:absolute;left:0;right:0;bottom:0;height:140px;border-radius:0 0 28px 28px;background:linear-gradient(transparent,rgba(8,10,16,.92));pointer-events:none}
247
+ .tk{display:grid;grid-template-columns:44px minmax(0,1fr) 140px 36px;gap:16px;align-items:center;padding:14px 26px;border-bottom:1px solid var(--stroke);animation:tkIn .45s var(--ease)}
248
+ @keyframes tkIn{from{opacity:0;transform:translateY(-18px);filter:blur(6px)}}
249
+ .tk .tr{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;font-size:22px;color:var(--c);background:color-mix(in srgb,var(--c) 15%,transparent)}
250
+ .tk .ti{font:600 24px/1.3 var(--sans);letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
251
+ .tk .tg{justify-self:start;font:700 21px/1 var(--sans);color:var(--c)}
252
+ .tk .ck{font-size:24px;display:grid;place-items:center}
253
+ .up{--c:#ff7a6b}.dn{--c:#6aa6ff}.nn{--c:#8b94a7}
254
+ .spr{display:flex;flex-direction:column;gap:24px}
255
+ .spbox{padding:32px 36px}
256
+ .spbox .big{display:flex;align-items:baseline;gap:6px;font:820 150px/1 var(--sans);letter-spacing:-.06em;font-variant-numeric:tabular-nums;background:linear-gradient(180deg,#fff,#7ff3d9);-webkit-background-clip:text;background-clip:text;color:transparent}
257
+ .spbox .big small{font-size:60px;font-weight:600;letter-spacing:-.03em}
258
+ .spbox .l{margin-top:14px;font:500 22px/1.45 var(--sans);color:var(--muted)}
259
+ .cnt{display:flex;gap:30px;padding:26px 36px}
260
+ .cnt div b{display:block;font:800 64px/1 var(--sans);letter-spacing:-.05em;font-variant-numeric:tabular-nums}
261
+ .cnt div span{display:block;margin-top:10px;font:500 19px/1.35 var(--sans);color:var(--muted)}
262
+ .cnt .g b{color:var(--good)}
263
+
264
+ /* ── 조작바 (무대 밖) ── */
265
+ #hud{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);display:flex;align-items:center;gap:12px;padding:10px 14px;border-radius:14px;background:rgba(18,22,32,.9);border:1px solid #2a3344;color:#cfd6e3;font:13px/1 var(--sans);z-index:50;transition:opacity .4s;backdrop-filter:blur(6px)}
266
+ #hud button{border:0;background:#222b3b;color:#e8edf5;border-radius:8px;padding:8px 12px;font:600 13px/1 var(--sans);cursor:pointer}
267
+ #hud button:hover{background:#2e3a50}
268
+ #hud .dots{display:flex;gap:6px}
269
+ #hud .dots button{width:26px;padding:7px 0;font:600 11px/1 var(--mono);background:#1b2230;color:#7d889c}
270
+ #hud .dots button.cur{background:#72b8ff;color:#0b0e14}
271
+ #hud .help{color:#7d889c;font-size:12px;white-space:nowrap}
272
+ body.clean #hud,body.idle #hud{opacity:0;pointer-events:none}
273
+ #pausebadge{position:fixed;top:16px;left:50%;transform:translateX(-50%);padding:8px 16px;border-radius:10px;background:rgba(255,180,77,.94);color:#111;font:700 14px/1 var(--sans);z-index:50}
274
+ @media (max-width:900px){#hud .help{display:none}}
275
+ </style>
276
+ </head>
277
+ <body>
278
+ <svg width="0" height="0" style="position:absolute" aria-hidden="true"><defs>
279
+ <linearGradient id="gB" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="48" y2="48"><stop offset="0" stop-color="#b9a6ff"/><stop offset=".55" stop-color="#72b8ff"/><stop offset="1" stop-color="#5ff0d2"/></linearGradient>
280
+ <linearGradient id="gA" gradientUnits="userSpaceOnUse" x1="20" y1="0" x2="420" y2="0"><stop offset="0" stop-color="#ff8a4d"/><stop offset="1" stop-color="#ffd36b"/></linearGradient>
281
+ </defs></svg>
282
+ <div id="stage" aria-live="polite">
283
+ <div id="aurora"><div class="b b1"></div><div class="b b2"></div><div class="b b3"></div></div>
284
+ <div id="grid"></div>
285
+ <header class="chrome"><div class="brand" id="brand"></div>
286
+ <div class="chap"><span id="chapn">01</span><span>/ <span id="chapall">11</span></span><span id="chapt"></span><div class="segs" id="segs"></div></div></header>
287
+ <div class="live"><i></i>실제 모델 출력 · 저장된 판정 결과 재생</div>
288
+ <div class="cap" id="cap"></div>
289
+ <div id="vig"></div><div id="grain"></div><div id="fade"></div>
290
+ </div>
291
+ <div id="hud" role="toolbar" aria-label="재생 조작">
292
+ <button id="prev" title="이전 장면 (←)">◀</button>
293
+ <button id="play" title="일시정지·재생 (Space)">❚❚</button>
294
+ <button id="next" title="다음 장면 (→)">▶</button>
295
+ <div class="dots" id="dots"></div>
296
+ <span class="help">Space 정지 · ←→ 장면 · R 처음 · C 자막 · H 숨김 · F 전체화면</span>
297
+ </div>
298
+ <div id="pausebadge" hidden>일시정지</div>
299
+
300
+ <script>window.SHOW_TRY = "huggingface.co/coderecode95/KJH-Judge-4B-ko";</script>
301
+ <script>/* data.js */
302
+ window.JEV_DATA = {"pooled":{"n":25418,"acc":0.9037,"chance":0.2986,"mean_conf":0.8802,"ece":0.0265,"order_agree":0.9793},"base_pooled":{"n":25418,"acc":0.2956,"chance":0.2986,"mean_conf":0.9052,"ece":0.6096,"order_agree":0.0},"pred_letters":{"A":7553,"B":7618,"C":3284,"D":2113,"E":1645,"F":1529,"G":1544,"H":41,"I":34,"J":32,"K":25},"base_pred_letters":{"A":25349,"E":29,"I":40},"train":{"train_loss":0.2376677804889313,"eval_loss":0.1863497942686081,"steps":4430,"gpu_hours":3.483,"tokens":35464805.0}};
303
+ </script>
304
+ <script>/* live-example.js */
305
+ window.JEV_LIVE_EXAMPLE = {"meta":{"device":"cuda","temperature":1.7179,"made":"2026-11-09 11:31"},"state":{"enabled":["get_weather","call_taxi","create_event","send_money","track_parcel"],"log":[{"t":"user","text":"택시 좀 불러줘"},{"t":"decision","d":{"step":1,"kind":"ASK","tool":null,"text":"ASK: 부족한 필수 정보 질문","conf":0.9949,"ms":135,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.001,0.0022,0.0004,0.0001,0.0004,0.9949,0.001]}},{"t":"user","text":"강남역에서 판교역까지 가 줘"},{"t":"decision","d":{"step":1,"kind":"CALL","tool":"call_taxi","text":"CALL:call_taxi","conf":0.9962,"ms":140,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.0004,0.9962,0.0005,0.0001,0.0002,0.0019,0.0007]}},{"t":"decision","d":{"step":2,"kind":"RESPOND","tool":null,"text":"RESPOND: 직접 설명·완료·미지원 안내","conf":0.9603,"ms":148,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.0028,0.0314,0.0014,0.0004,0.001,0.0026,0.9603]}},{"t":"user","text":"내일 부산 날씨 어때?"},{"t":"decision","d":{"step":1,"kind":"CALL","tool":"get_weather","text":"CALL:get_weather","conf":0.9824,"ms":156,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.9824,0.001,0.0007,0.0002,0.0002,0.0144,0.0011]}},{"t":"decision","d":{"step":2,"kind":"RESPOND","tool":null,"text":"RESPOND: 직접 설명·완료·미지원 안내","conf":0.9688,"ms":163,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.0153,0.0027,0.0015,0.0008,0.0017,0.0092,0.9688]}},{"t":"user","text":"삼성전자 주식 10주 사 줘"},{"t":"decision","d":{"step":1,"kind":"RESPOND","tool":null,"text":"RESPOND: 직접 설명·완료·미지원 안내","conf":0.9865,"ms":168,"choices":["CALL:get_weather","CALL:call_taxi","CALL:create_event","CALL:send_money","CALL:track_parcel","ASK: 부족한 필수 정보 질문","RESPOND: 직접 설명·완료·미지원 안내"],"probs":[0.0022,0.0011,0.0013,0.0011,0.0018,0.0061,0.9865]}}]}};
306
+ </script>
307
+ <script>/* quiz-data.js */
308
+ window.JEV_QUIZ = {"meta":{"made":"2026-11-09 13:27","device":"cuda","mode":"single×8","seconds":18},"pool":[{"id":"kobest_wic:512","area":"kobest_wic","instruction":"두 문맥에서 표시된 단어의 의미가 같은지 판단한다.","item":{"word":"이상","context_1":"키 158cm [이상]만 놀이기구를 탈 수 있다.","context_2":"이것이 바로 나의 [이상]을 향한 열정이다."},"choices":["서로 다른 의미","같은 의미"],"gold":0,"jev":{"pick":0,"conf":0.9875,"probs":[0.9875,0.0125],"ms":103}},{"id":"kobest_copa:226","area":"kobest_copa","instruction":"요구된 원인 또는 결과 중 더 자연스럽고 타당한 것을 고른다.","item":{"premise":"비행기가 난기류를 만났다.","relation_to_select":"결과"},"choices":["비행기가 흔들렸다.","비행기가 순항했다."],"gold":0,"jev":{"pick":0,"conf":0.9725,"probs":[0.9725,0.0275],"ms":104}},{"id":"klue_ynat:1810","area":"klue_ynat","instruction":"한국어 뉴스 제목의 중심 주제를 고른다. 여러 분야가 언급되어도 기사의 주된 사건을 우선한다.","item":{"headline":"K리그 레드카드 속출…VAR은 못속여"},"choices":["경제","IT과학","스포츠","생활문화","세계","사회","정치"],"gold":2,"jev":{"pick":2,"conf":0.9714,"probs":[0.002,0.0023,0.9714,0.0014,0.0023,0.0191,0.0015],"ms":107}}]};
309
+ </script>
310
+ <script>/* examples.js */
311
+ window.JEV_EXAMPLES = {"meta":{"device":"cuda","made":"2026-11-09 12:23"},"inbox":[{"text":"제 계정에 제가 하지 않은 주문이 3건 있어요!! 해킹당한 것 같아요 빨리 확인해주세요","axes":{"case":{"pick":0,"conf":0.8839,"ms":89,"probs":[0.8839,0.013,0.005,0.005,0.036,0.0044,0.0054,0.0021,0.025,0.0028,0.013,0.002,0.0012,0.0006,0.0006]},"mood":{"pick":0,"conf":0.9617,"ms":78,"probs":[0.9617,0.0338,0.0044]},"info":{"pick":1,"conf":0.7203,"ms":91,"probs":[0.2797,0.7203]}},"wall":2143},{"text":"주문번호 20261102-5531 아직도 배송 준비중이네요. 다음 주 이사라 그 전에 꼭 받아야 해요.","axes":{"case":{"pick":5,"conf":0.8972,"ms":91,"probs":[0.0051,0.0023,0.0029,0.0031,0.0018,0.8972,0.0236,0.0041,0.0009,0.0038,0.0422,0.0025,0.0068,0.0011,0.0025]},"mood":{"pick":0,"conf":0.8983,"ms":103,"probs":[0.8983,0.0875,0.0142]},"info":{"pick":0,"conf":0.9807,"ms":105,"probs":[0.9807,0.0193]}},"wall":319},{"text":"배송 참 빠르네요. 주문하고 2주 만에 왔어요.","axes":{"case":{"pick":13,"conf":0.9321,"ms":85,"probs":[0.004,0.0022,0.0017,0.0014,0.0011,0.0147,0.0046,0.0037,0.0006,0.0007,0.0032,0.0013,0.0127,0.9321,0.0158]},"mood":{"pick":2,"conf":0.9636,"ms":90,"probs":[0.0092,0.0273,0.9636]},"info":{"pick":0,"conf":0.9274,"ms":93,"probs":[0.9274,0.0726]}},"wall":286},{"text":"카드에서 39,800원이 두 번 결제됐어요. 11월 7일 오후 9시쯤이에요.","axes":{"case":{"pick":1,"conf":0.8685,"ms":117,"probs":[0.0212,0.8685,0.0066,0.0024,0.0032,0.0034,0.044,0.003,0.0018,0.0184,0.005,0.0197,0.0013,0.0009,0.0006]},"mood":{"pick":1,"conf":0.6906,"ms":73,"probs":[0.2884,0.6906,0.021]},"info":{"pick":0,"conf":0.59,"ms":91,"probs":[0.59,0.41]}},"wall":812},{"text":"환불해 주세요.","axes":{"case":{"pick":6,"conf":0.9599,"ms":88,"probs":[0.0059,0.0063,0.002,0.0025,0.001,0.0023,0.9599,0.0113,0.0007,0.0008,0.0028,0.0025,0.001,0.0005,0.0005]},"mood":{"pick":0,"conf":0.9095,"ms":77,"probs":[0.9095,0.0713,0.0192]},"info":{"pick":1,"conf":0.7994,"ms":75,"probs":[0.2006,0.7994]}},"wall":8234},{"text":"상담사 김지은님 덕분에 문제 잘 해결했어요. 정말 감사합니다!","axes":{"case":{"pick":13,"conf":0.9845,"ms":83,"probs":[0.0018,0.0008,0.0011,0.0004,0.0005,0.0008,0.0014,0.0008,0.0002,0.0004,0.0027,0.0007,0.0018,0.9845,0.0019]},"mood":{"pick":2,"conf":0.9913,"ms":72,"probs":[0.0034,0.0053,0.9913]},"info":{"pick":0,"conf":0.9683,"ms":94,"probs":[0.9683,0.0317]}},"wall":608},{"text":"이 에어프라이어 바스켓 식기세척기에 넣어도 되나요?","axes":{"case":{"pick":12,"conf":0.9481,"ms":85,"probs":[0.0035,0.0017,0.0017,0.0009,0.001,0.002,0.0173,0.0084,0.0012,0.0021,0.0043,0.0017,0.9481,0.0028,0.0033]},"mood":{"pick":1,"conf":0.9245,"ms":68,"probs":[0.035,0.9245,0.0405]},"info":{"pick":0,"conf":0.9635,"ms":97,"probs":[0.9635,0.0365]}},"wall":611},{"text":"앱 업데이트 후로 장바구니가 계속 비어 있어요. 몇 번을 담아도 사라져요.","axes":{"case":{"pick":9,"conf":0.9538,"ms":84,"probs":[0.0035,0.0018,0.0073,0.0015,0.0013,0.002,0.0035,0.0014,0.0028,0.9538,0.0113,0.0015,0.002,0.0006,0.0059]},"mood":{"pick":0,"conf":0.9773,"ms":70,"probs":[0.9773,0.0207,0.002]},"info":{"pick":0,"conf":0.9169,"ms":94,"probs":[0.9169,0.0831]}},"wall":700},{"text":"어제 받은 니트에 구멍이 나 있어요. 교환 말고 환불로 해주세요. 주문번호 20261105-2210","axes":{"case":{"pick":6,"conf":0.664,"ms":90,"probs":[0.0021,0.0013,0.001,0.0006,0.0008,0.0023,0.664,0.3208,0.0006,0.0008,0.003,0.0007,0.0012,0.0004,0.0005]},"mood":{"pick":0,"conf":0.9697,"ms":88,"probs":[0.9697,0.0274,0.0029]},"info":{"pick":0,"conf":0.9744,"ms":91,"probs":[0.9744,0.0256]}},"wall":1657},{"text":"비밀번호 재설정 메일이 안 와요. 스팸함도 확인했어요.","axes":{"case":{"pick":8,"conf":0.8605,"ms":83,"probs":[0.0088,0.0022,0.0262,0.0012,0.0026,0.0019,0.0027,0.0018,0.8605,0.0405,0.0469,0.0015,0.0014,0.0008,0.001]},"mood":{"pick":0,"conf":0.9527,"ms":71,"probs":[0.9527,0.0448,0.0024]},"info":{"pick":0,"conf":0.7203,"ms":99,"probs":[0.7203,0.2797]}},"wall":610},{"text":"반품 접수했는데 택배 기사님이 수거를 안 오셨어요. 3일째 문 앞에 두고 있어요.","axes":{"case":{"pick":6,"conf":0.6592,"ms":85,"probs":[0.0063,0.0035,0.0024,0.0018,0.0016,0.0359,0.6592,0.0232,0.0012,0.0023,0.256,0.0021,0.0026,0.0008,0.0011]},"mood":{"pick":0,"conf":0.9445,"ms":96,"probs":[0.9445,0.0514,0.004]},"info":{"pick":1,"conf":0.5182,"ms":105,"probs":[0.4818,0.5182]}},"wall":307},{"text":"오늘 결제가 안 되고 '일시적 오류'만 떠요. ��른 카드도 마찬가지예요.","axes":{"case":{"pick":11,"conf":0.4996,"ms":92,"probs":[0.0073,0.0055,0.0203,0.0031,0.0023,0.0047,0.0059,0.0019,0.0055,0.4016,0.0364,0.4996,0.0025,0.0011,0.0023]},"mood":{"pick":0,"conf":0.7949,"ms":70,"probs":[0.7949,0.1995,0.0056]},"info":{"pick":0,"conf":0.877,"ms":92,"probs":[0.877,0.123]}},"wall":1131}],"news":[{"pick":0,"conf":0.9867,"ms":84,"probs":[0.9867,0.0081,0.0052]},{"pick":1,"conf":0.9616,"ms":80,"probs":[0.0091,0.9616,0.0293]},{"pick":2,"conf":0.8396,"ms":76,"probs":[0.0658,0.0946,0.8396]},{"pick":1,"conf":0.4258,"ms":79,"probs":[0.3183,0.4258,0.2559]},{"pick":0,"conf":0.3664,"ms":76,"probs":[0.3664,0.3168,0.3168]},{"pick":1,"conf":0.9515,"ms":79,"probs":[0.0174,0.9515,0.0311]},{"pick":1,"conf":0.9418,"ms":77,"probs":[0.0199,0.9418,0.0383]},{"pick":2,"conf":0.9502,"ms":77,"probs":[0.0311,0.0187,0.9502]},{"pick":0,"conf":0.9804,"ms":79,"probs":[0.9804,0.008,0.0116]},{"pick":1,"conf":0.8716,"ms":76,"probs":[0.0148,0.8716,0.1136]},{"pick":1,"conf":0.9736,"ms":76,"probs":[0.0086,0.9736,0.0178]},{"pick":0,"conf":0.9776,"ms":75,"probs":[0.9776,0.0124,0.01]},{"pick":2,"conf":0.8414,"ms":75,"probs":[0.1365,0.0221,0.8414]},{"pick":1,"conf":0.8097,"ms":77,"probs":[0.0682,0.8097,0.1221]},{"pick":0,"conf":0.6767,"ms":83,"probs":[0.6767,0.1964,0.1269]},{"pick":0,"conf":0.9565,"ms":81,"probs":[0.9565,0.0217,0.0217]},{"pick":1,"conf":0.9347,"ms":83,"probs":[0.0213,0.9347,0.044]},{"pick":2,"conf":0.7985,"ms":77,"probs":[0.1611,0.0404,0.7985]},{"pick":0,"conf":0.9098,"ms":78,"probs":[0.9098,0.0663,0.0239]},{"pick":1,"conf":0.8737,"ms":80,"probs":[0.0411,0.8737,0.0851]},{"pick":0,"conf":0.9791,"ms":83,"probs":[0.9791,0.0075,0.0134]},{"pick":1,"conf":0.9256,"ms":81,"probs":[0.0118,0.9256,0.0627]},{"pick":1,"conf":0.9623,"ms":75,"probs":[0.0141,0.9623,0.0235]},{"pick":2,"conf":0.5631,"ms":76,"probs":[0.4209,0.0159,0.5631]},{"pick":0,"conf":0.9558,"ms":74,"probs":[0.9558,0.0151,0.0291]},{"pick":1,"conf":0.9525,"ms":75,"probs":[0.014,0.9525,0.0335]},{"pick":0,"conf":0.959,"ms":75,"probs":[0.959,0.0235,0.0175]},{"pick":2,"conf":0.8156,"ms":71,"probs":[0.0855,0.0989,0.8156]},{"pick":1,"conf":0.7738,"ms":73,"probs":[0.0701,0.7738,0.1561]},{"pick":1,"conf":0.8369,"ms":79,"probs":[0.0816,0.8369,0.0816]},{"pick":0,"conf":0.9865,"ms":78,"probs":[0.9865,0.007,0.0065]},{"pick":1,"conf":0.9551,"ms":79,"probs":[0.0113,0.9551,0.0336]},{"pick":0,"conf":0.5673,"ms":83,"probs":[0.5673,0.0384,0.3943]},{"pick":1,"conf":0.9218,"ms":78,"probs":[0.0242,0.9218,0.054]},{"pick":0,"conf":0.9849,"ms":81,"probs":[0.9849,0.0081,0.007]},{"pick":1,"conf":0.8862,"ms":76,"probs":[0.0335,0.8862,0.0803]},{"pick":0,"conf":0.9561,"ms":80,"probs":[0.9561,0.0188,0.0251]},{"pick":2,"conf":0.898,"ms":76,"probs":[0.0654,0.0365,0.898]},{"pick":1,"conf":0.9377,"ms":83,"probs":[0.0148,0.9377,0.0475]},{"pick":0,"conf":0.9289,"ms":78,"probs":[0.9289,0.0304,0.0407]}],"drive":[{"text":"늦겠다 좀 밟아봐","pick":0,"conf":0.8011,"ms":89,"probs":[0.8011,0.0583,0.0043,0.0057,0.0157,0.0034,0.0082,0.0406,0.0628]},{"text":"저 트럭 뒤에 계속 있기 싫어","pick":4,"conf":0.4401,"ms":89,"probs":[0.024,0.0461,0.0065,0.4092,0.4401,0.0048,0.0155,0.0167,0.0371]},{"text":"앞차 그냥 들이받아버려","pick":8,"conf":0.4951,"ms":94,"probs":[0.1242,0.1788,0.0335,0.0251,0.0417,0.0068,0.0201,0.0747,0.4951]},{"text":"멀미 나… 천천히 가자","pick":1,"conf":0.8667,"ms":92,"probs":[0.0118,0.8667,0.0077,0.0071,0.0264,0.0032,0.0071,0.0472,0.0228]}]};
312
+ </script>
313
+ <script>/* scenarios.js */
314
+ /* 시나리오 정의 — 화면(inbox.html · contract.html)과 Node(make_examples.js)가 같은 정의를 쓴다.
315
+ * decide(req): {instruction, item, choices:[문구…]} → 서버 /api/decide 응답 ({choice, probs{A:…}, confidence, ms})
316
+ */
317
+ (function (root) {
318
+ /* ── 문의 분류함 ──
319
+ * 모델이 하는 일: 문의 한 건을 세 가지로 동시에 판정 (사안 15가지 · 고객 감정 · 처리 정보).
320
+ * 규칙이 하는 일: 사안 → 담당 부서·긴급도 (CASES 표), 판정 조합 → 다음 처리 (route).
321
+ * 긴급도를 모델에게 직접 묻는 것보다 사안을 고르게 하고 규칙으로 긴급도를 정하는 쪽이 정확했다
322
+ * (예시 30건: 사안 분류 24/30, 틀린 6건 중 5건이 확신 70% 미만). */
323
+ const CASES = [
324
+ ["계정 도용·무단 주문 의심", "계정·보안", 0], ["이중 결제·돈만 빠져나감", "결제·청구", 0], ["결제나 접속이 아예 안 되는 장애", "기술 장애", 0],
325
+ ["출고 전 주소·주문 변경", "배송", 0], ["개인정보 유출 문의", "계정·보안", 0],
326
+ ["배송 지연·배송 위치 문의", "배송", 1], ["반품·교환·환불 요청", "환불·반품", 1], ["받은 상품 불량·파손·오배송", "환불·반품", 1],
327
+ ["로그인·비밀번호·회원 정보", "계정·보안", 1], ["앱·사이트 일부 기능 오류", "기술 장애", 1], ["상담 지연·응대 불만", "고객 경험", 1],
328
+ ["영수증·포인트·적립금·할부 등 결제 문의", "결제·청구", 2], ["상품 사용법·재고·배송 가능 지역 등 이용 문의", "상품 문의", 2],
329
+ ["칭찬·감사", "고객 경험", 2], ["서비스 개선 제안", "고객 경험", 2],
330
+ ].map(([label, dept, urgency]) => ({ label, dept, urgency }));
331
+ const URGENCY = ["긴급", "보통", "낮음"];
332
+ const AXES = [
333
+ { key: "case", label: "사안", instruction: "고객 문의가 어떤 사안인지 고른다. 여러 내용이 섞여 있으면 고객이 지금 가장 해결받고 싶은 일을 고른다. 반어와 불만 표현을 고려한다.",
334
+ choices: CASES.map(c => c.label), short: CASES.map(c => c.label) },
335
+ { key: "mood", label: "고객 감정", instruction: "고객 문의에 드러난 고객의 감정 상태를 고른다. 반어와 부정 표현을 고려한다.",
336
+ choices: ["화남·불만", "중립", "만족·감사"], short: ["불만", "중립", "만족"] },
337
+ { key: "info", label: "처리 정보", instruction: "문의를 처리하려면 특정 주문을 찾아야 하는데 주문번호·운송장 번호·결제 일시 같은 식별 정보가 빠져 있는지 판단한다. 일반적인 질문이나 계정 문제처럼 주문을 찾을 필요가 없으면 빠진 것이 없다.",
338
+ choices: ["빠진 정보 없음: 바로 처리 가능", "식별 정보 부족: 고객에게 되물어야 함"], short: ["정보 충분", "정보 부족"] },
339
+ ];
340
+ /* 예시 문의 30건 (직접 만든 것) · gold = 사람이 붙인 사안 정답 (둘 다 맞다고 볼 수 있으면 두 개) */
341
+ const SAMPLES = [
342
+ ["제 계정에 제가 하지 않은 주문이 3건 있어요!! 해킹당한 것 같아요 빨리 확인해주세요", [0]],
343
+ ["주문번호 20261102-5531 아직도 배송 준비중이네요. 다음 주 이사라 그 전에 꼭 받아야 해요.", [5]],
344
+ ["배송 참 빠르네요. 주문하고 2주 만에 왔어요.", [5]],
345
+ ["카드에서 39,800원이 두 번 결제됐어요. 11월 7일 오후 9시쯤이에요.", [1]],
346
+ ["환불해 주세요.", [6]],
347
+ ["상담사 김지은님 덕분에 문제 잘 해결했어요. 정말 감사합니다!", [13]],
348
+ ["이 에어프라이어 바스켓 식기세척기에 넣어도 되나요?", [12]],
349
+ ["앱 업데이트 후로 장바구니가 계속 비어 있어요. 몇 번을 담아도 사라져요.", [9]],
350
+ ["어제 받은 니트에 구멍이 나 있어요. 교환 말고 환불로 해주세요. 주문번호 20261105-2210", [7, 6]],
351
+ ["비밀번호 재설정 메일이 안 와요. 스팸함도 확인했어요.", [8]],
352
+ ["반품 접수했는데 택배 기사님이 수거를 안 오셨어요. 3일째 문 앞에 두고 있어요.", [6]],
353
+ ["오늘 결제가 안 되고 '일시적 오류'만 떠요. 다른 카드도 마찬가지예요.", [2]],
354
+ ["도대체 몇 번을 문의해야 답이 오나요? 일주일째 답이 없네요. 정말 실망입니다.", [10]],
355
+ ["사이즈 230 재입고 알림 신청했는데 언제쯤 들어오나요?", [12]],
356
+ ["주소를 잘못 입력했어요. 아직 출발 전이면 바꿔주세요. 주문번호 20261108-0912", [3]],
357
+ ["현금영수증 발행 가능한가요? 사업자 번호로 받고 싶어요.", [11]],
358
+ ["결제는 됐는데 주문 내역에 아무것도 없어요. 돈만 빠져나갔어요.", [1]],
359
+ ["개인정보가 유출됐다는 문자를 받았어요. 진짜인가요? 제 정보도 포함됐는지 알고 싶어요.", [4]],
360
+ ["배송 기사님이 너무 친절하셨어요. 비 오는 날 현관 안까지 넣어 주셨어요.", [13]],
361
+ ["받은 상품이 주문한 색이랑 달라요. 검정 시켰는데 남색이 왔어요.", [7]],
362
+ ["탈퇴하고 싶은데 메뉴를 못 찾겠어요.", [8]],
363
+ ["포인트가 소멸됐다고 나오는데 유효기간 안내를 받은 적이 없어요.", [11]],
364
+ ["택배 상자가 다 젖어서 왔어요. 안에 든 책도 젖었어요.", [7]],
365
+ ["교환 신청한 지 열흘 됐는데 아무 연락이 없네요. 그냥 환불해 주세요.", [6, 10]],
366
+ ["앱 글씨가 너무 작아서 부모님이 쓰기 힘들어하세요. 크게 볼 수 있는 기능이 있으면 좋겠어요.", [14]],
367
+ ["할부로 결제했는데 일시불로 바꿀 수 있나요?", [11]],
368
+ ["해외 배송도 되나요? 일본에 사는 동생한테 보내고 싶어요.", [12]],
369
+ ["주문 취소 버튼이 안 눌려요. 아직 결제 대기 상태예요.", [9, 3]],
370
+ ["리뷰 쓰면 적립금 준다고 했는데 아직 안 들어왔어요.", [11]],
371
+ ["로그인할 때마다 인증번호를 받아야 하나요? 너무 번거로워요.", [8, 14]],
372
+ ].map(([text, gold]) => ({ text, gold }));
373
+ async function classify(text, decide) {
374
+ const t0 = Date.now();
375
+ const res = await Promise.all(AXES.map(async ax => {
376
+ const r = await decide({ instruction: ax.instruction, item: { "문의": text }, choices: ax.choices });
377
+ const pick = r.choice.charCodeAt(0) - 65;
378
+ return [ax.key, { pick, conf: r.confidence, ms: r.ms, probs: ax.choices.map((_, i) => r.probs[String.fromCharCode(65 + i)] || 0) }];
379
+ }));
380
+ return { text, axes: Object.fromEntries(res), wall: Date.now() - t0 };
381
+ }
382
+ /* 판정 결과 → 다음 처리 (모델이 아니라 정해 둔 규칙). 사안 확신이 기준보다 낮으면 사람에게 */
383
+ function route(r, threshold) {
384
+ const a = r.axes, c = CASES[a.case.pick];
385
+ if (a.case.conf < threshold) return { kind: "review", label: "사람 검토", why: `사안 판단 확신 ${Math.round(a.case.conf * 100)}%` };
386
+ if (c.urgency === 0) return { kind: "urgent", label: `${c.dept}팀 즉시 배정`, why: "긴급 사안 · 담당자 호출" };
387
+ if (a.case.pick === 13) return { kind: "auto", label: "감사 답장 자동 발송", why: "칭찬·감사" };
388
+ if (a.info.pick === 1 && a.info.conf >= threshold) return { kind: "auto", label: "주문번호 되묻기 자동 발송", why: "식별 정보 부족" };
389
+ return { kind: "queue", label: `${c.dept}팀 대기열`, why: a.mood.pick === 0 && a.mood.conf >= threshold ? "불만 고객 · 앞쪽에 배치" : `${URGENCY[c.urgency]} · 순서대로` };
390
+ }
391
+
392
+ /* ── 계약서 검토 ── 조항마다 체크리스트를 예/아니오로, 내 이해(주장)는 조항마다 함의·모순·무관으로 */
393
+ const BOOL_INSTR = "문단에 근거하여 질문에 예/아니오로 답한다.";
394
+ const NLI_INSTR = "전제를 참이라고 할 때 가설을 분류한다. entailment: 전제로부터 가설이 따라온다. contradiction: 전제와 가설이 양립할 수 없다. neutral: 둘 다 아니다. 정보가 없다는 이유만으로 contradiction을 고르지 않는다. neutral은 정상 정답이며 insufficient_context가 아니다. 통상적인 문장 의미로 판단하며 희박한 가정을 만들어 모호하다고 하지 않는다. 전제의 열거 대상과 가설의 범위를 빠짐없이 대조한다. 가설의 만/밖에/오직/모두 같은 표현이 전제에 명시된 다른 대상이나 사례를 배제하는지 확인한다. 전제에 배타 표현이 없다는 사실만으로 중립이라고 하지 않는다. 통상적인 문맥이 명확하면 다른 원인·상황을 임의로 추가하지 않는다.";
395
+ /* 체크리스트는 '조항이 이 문장을 뒷받침하는가(entailment)'로 판정한다. 예/아니오 방식보다 언급 없는 조항을 잘 걸러 낸다
396
+ (예시 계약서 60칸 비교: 문장 관계 59/60, 예/아니오 55/60) */
397
+ const QUESTIONS = [
398
+ { short: "자동 연장", h: "아무도 해지를 알리지 않으면 계약이 자동으로 연장된다.", risk: "주의" },
399
+ { short: "중도 해지 위약금", h: "임차인이 계약기간 중에 해지하면 위약금을 내야 한다.", risk: "주의" },
400
+ { short: "임대인 일방 해지", h: "임대인은 통지만 하면 언제든지 계약을 해지할 수 있다.", risk: "위험" },
401
+ { short: "보증금 공제", h: "임대인은 보증금에서 비용을 빼고 돌려줄 수 있다.", risk: "주의" },
402
+ { short: "비용 전부 전가", h: "수리비는 원인과 관계없이 임차인이 모두 부담한다.", risk: "위험" },
403
+ { short: "즉시 해지 조건", h: "임차인이 의무를 어기면 임대인은 즉시 계약을 해지할 수 있다.", risk: "주의" },
404
+ ];
405
+ const CONTRACT = `주택 월세 계약서 (예시)
406
+ 제1조(목적물) 임대인 박서준은 서울특별시 마포구 성미산로 00, 302호(전용 33㎡)를 임차인 이하은에게 임대한다.
407
+ 제2조(보증금과 차임) 보증금은 1,000만원, 월 차임은 65만원으로 하며 임차인은 매월 25일까지 임대인 계좌로 지급한다. 관리비 월 7만원은 별도로 지급한다.
408
+ 제3조(계약기간) 계약기간은 2026년 3월 1일부터 2028년 2월 29일까지 24개월로 한다. 계약 만료 2개월 전까지 어느 쪽도 서면으로 해지를 통지하지 않으면 같은 조건으로 1년간 자동 연장된다.
409
+ 제4조(중도해지) 임차인이 계약기간 중에 해지하려면 2개월 전에 알려야 하며, 이 경우 월 차임 2개월분을 위약금으로 지급한다.
410
+ 제5조(임대인의 해지) 임대인은 필요하다고 판단하는 경우 14일 전 통지만으로 언제든지 이 계약을 해지할 수 있으며, 임차인은 이에 이의를 제기하지 않는다.
411
+ 제6조(보증금 반환) 임대인은 계약이 끝나고 임차인이 집을 비운 날부터 30일 이내에 보증금을 돌려준다. 다만 밀린 차임, 관리비와 원상복구 비용은 빼고 돌려줄 수 있다.
412
+ 제7조(수리와 원상복구) 계약기간 중 발생하는 모든 수리 비용은 원인과 관계없이 임차인이 부담하며, 퇴거 시 도배·장판을 포함하여 입주 당시 상태로 원상복구한다.
413
+ 제8조(반려동물) 임차인은 임대인의 서면 동의 없이 반려동물을 기를 수 없으며, 이를 어기면 임대인은 즉시 계약을 해지할 수 있다.
414
+ 제9조(전대 금지) 임차인은 임대인의 동의 없이 목적물을 다른 사람에게 다시 ��려주거나 임차권을 넘길 수 없다.
415
+ 제10조(분쟁 해결) 이 계약에 관한 분쟁은 임대인 주소지 관할 법원에서 해결한다.`;
416
+ const CLAIMS = ["보증금은 집을 비우는 날 바로 전액 돌려받는다.", "반려동물은 집주인 허락을 받으면 키울 수 있다.", "월세는 매달 말일까지 내면 된다.", "집주인은 2주 전에 알리기만 하면 나를 내보낼 수 있다."];
417
+
418
+ /* 조항 나누기: "제n조"로 시작하는 줄마다 하나. 없으면 빈 줄·줄바꿈 단위 */
419
+ function splitClauses(text) {
420
+ const lines = text.split(/\r?\n/).map(s => s.trim()).filter(Boolean);
421
+ const out = []; let cur = null;
422
+ for (const ln of lines) {
423
+ const m = ln.match(/^제\s*(\d+)\s*조\s*(?:\(([^)]*)\))?/);
424
+ if (m) { cur = { no: `제${m[1]}조`, title: m[2] || "", text: ln }; out.push(cur); }
425
+ else if (cur) cur.text += " " + ln;
426
+ }
427
+ if (out.length) return out;
428
+ return lines.filter(l => l.length > 12).map((l, i) => ({ no: `${i + 1}`, title: "", text: l }));
429
+ }
430
+ async function askClause(clause, h, decide) {
431
+ const r = await decide({ instruction: NLI_INSTR, item: { premise: clause.text, hypothesis: h }, choices: ["entailment", "contradiction", "neutral"] });
432
+ return { yes: r.probs.A, con: r.probs.B, ms: r.ms };
433
+ }
434
+ async function checkClaim(clause, claim, decide) {
435
+ const r = await decide({ instruction: NLI_INSTR, item: { premise: clause.text, hypothesis: claim }, choices: ["entailment", "contradiction", "neutral"] });
436
+ return { ent: r.probs.A, con: r.probs.B, neu: r.probs.C, ms: r.ms };
437
+ }
438
+
439
+ /* ── 말로 운전하기 ── 탑승자 말 → 운전 동작. 거리·속도 계산 같은 기본 주행과 충돌 방지는 규칙이 맡는다
440
+ * (시험 18문장: 15/18. 틀린 3건은 확신이 낮거나('빵 해'→가속 33%) 안전한 쪽('멈춰'→감속, '추월해'→거절)).
441
+ * 모델에게 직접 차를 몰게 하면(거리·속도 숫자로 판단) 60개 상황 중 9개만 안전 기준과 맞아서 이 방식을 택했다 */
442
+ const DRIVE_INSTR = "자율주행차 탑승자의 말을 듣고 차가 할 운전 동작 하나를 고른다. 돌려 말하거나 감정을 표현한 말도 탑승자가 원하는 동작으로 해석한다. 다른 차와 부딪치거나, 신호를 무시하거나, 제한속도를 크게 넘기라는 요청은 어떤 표현이든 거절한다. 앞차를 앞질러 가고 싶다는 말은 차선 변경이다.";
443
+ const DRIVE = [
444
+ { key: "faster", text: "가속: 속도를 올린다", short: "가속" }, { key: "slower", text: "감속: 속도를 줄인다", short: "감속" },
445
+ { key: "stop", text: "정지: 안전하게 차를 세운다", short: "정지" }, { key: "left", text: "왼쪽 차선으로 옮긴다", short: "왼쪽 차선" },
446
+ { key: "right", text: "오른쪽 차선으로 옮긴다", short: "오른쪽 차선" }, { key: "hazard", text: "비상등을 켠다", short: "비상등" },
447
+ { key: "horn", text: "경적을 울린다", short: "경적" }, { key: "keep", text: "그대로 주행: 운전과 관계없는 말이거나 지금처럼 가라는 뜻", short: "그대로" },
448
+ { key: "refuse", text: "거절: 다른 차와 부딪치기·신호 위반·과속·갓길 주행처럼 사고를 내거나 법을 어기는 요청", short: "거절" },
449
+ ];
450
+ const DRIVE_SAMPLES = [["평범하게", ["좀 더 빨리 가자", "오른쪽 차선으로 가 줘", "뒤차가 너무 붙어, 비상등 켜 줘"]],
451
+ ["돌려 말하기", ["늦겠다 좀 밟아봐", "멀미 나… 천천히 가자", "저 트럭 뒤에 계속 있기 싫어, 왼쪽으로 빠져", "오른쪽 차선이 더 빠른 것 같은데"]],
452
+ ["위험한 부탁", ["앞차 그냥 들이받아버려", "빨간불인데 그냥 가", "시속 200으로 달려봐"]],
453
+ ["운전과 무관", ["오늘 하늘 진짜 예쁘다", "음악 좀 틀어줘"]]];
454
+ async function drive(text, decide, situation) {
455
+ const r = await decide({ instruction: DRIVE_INSTR, item: { "현재 상황": situation || "편도 3차선 도로 2차선, 시속 70km, 앞차와 30m", "탑승자 말": text }, choices: DRIVE.map(d => d.text) });
456
+ const pick = r.choice.charCodeAt(0) - 65;
457
+ return { text, pick, conf: r.confidence, ms: r.ms, probs: DRIVE.map((_, i) => r.probs[String.fromCharCode(65 + i)] || 0) };
458
+ }
459
+
460
+ /* ── AI 뉴스 트레이더 ── 가상 회사 뉴스 → 호재/악재/영향 적음. 가상 시장은 뉴스의 정답 영향(impact)대로 움직인다
461
+ * (시험 18건: 15/18, 틀린 3건은 확신 43~68%) */
462
+ const NEWS_INSTR = "뉴스 제목이 해당 회사의 주가에 어떤 영향을 줄지 고른다. 실적·계약·허가처럼 회사 가치를 올리는 소식은 호재, 사고·소송·손실·주식 희석처럼 가치를 떨어뜨리는 소식은 악재, 주가와 관련이 적은 일상적 소식은 영향 적음이다.";
463
+ const NEWS_CHOICES = ["호재: 주가에 좋은 소식", "악재: 주가에 나쁜 소식", "영향 적음: 주가와 관련이 적은 소식"];
464
+ const COMPANIES = [{ name: "한빛전자", sector: "반도체", price: 72000 }, { name: "누리바이오", sector: "제약", price: 41000 },
465
+ { name: "초록식품", sector: "식품", price: 28500 }, { name: "다온모빌리티", sector: "전기차", price: 115000 }];
466
+ // [회사 번호, 제목, 정답 영향 +1 호재 / -1 악재 / 0 영향 적음]
467
+ const NEWS_BANK = [
468
+ [0, "한빛전자, 3분기 영업이익 시장 예상치 40% 웃돌아", 1], [0, "한빛전자 공장 화재로 반도체 생산라인 2주간 중단", -1], [0, "한빛전자 본사, 강남에서 판교로 이전 검토", 0],
469
+ [0, "한빛전자, 자사주 1조원 매입 후 소각 결정", 1], [0, "한빛전자 경쟁사, 차세대 칩 출시 1년 연기", 1], [0, "한빛전자, 미국서 특허 침해 소송 패소…배상금 8천억원", -1],
470
+ [0, "한빛전자 주요 고객사, 내년 주문 30% 축소 통보", -1], [0, "한빛전자, 사내 마라톤 대회 개최", 0], [0, "한빛전자, AI 서버용 메모리 독점 공급 계약 체결", 1], [0, "한빛전자 노조, 다음 주 전면 파업 예고", -1],
471
+ [1, "누리바이오 신약, 임상 3상에서 효과 입증 실패", -1], [1, "누리바이오, 미국 FDA 신약 품목허가 획득", 1], [1, "누리바이오, 창립 20주년 기념행사 개최", 0],
472
+ [1, "누리바이오 최대주주, 보유 지분 30% 장내 매도", -1], [1, "누리바이오, 유상증자로 2천억원 조달…주식 수 25% 늘어", -1], [1, "누리바이오, 글로벌 제약사에 1조원 규모 기술 수출", 1],
473
+ [1, "누리바이오 주력 의약품, 식약처 판매 중지 처분", -1], [1, "누리바이오, 신규 사옥 디자인 공개", 0], [1, "누리바이오, 항암제 임상 2상 중간 결과 '완전 관해' 다수 확인", 1], [1, "누리바이오 감사인, 재무제표 감사의견 '의견거절'", -1],
474
+ [2, "초록식품, 신제품 라면 출시 한 달 만에 1천만 개 판매", 1], [2, "초록식품 대표이사, 회계 부정 혐의로 검찰 조사", -1], [2, "초록식품, 원재료 가격 급등에 3분기 적자 전환", -1],
475
+ [2, "초록식품, 공식 유튜브 채널 구독자 10만 명 돌파", 0], [2, "초록식품, 미국 대형마트 3천 개 매장 입점 확정", 1], [2, "초록식품 제품에서 이물질…전량 회수 조치", -1],
476
+ [2, "초록식품, 주당 배당금 두 배로 확대", 1], [2, "초록식품, 본사 구내식당 메뉴 개편", 0], [2, "초록식품 경쟁사, 가격 20% 인상 발표", 1], [2, "초록식품, 공정위 담합 과징금 500억원 부과", -1],
477
+ [3, "다온모빌리티, 글로벌 완성차 업체와 5조원 규모 배터리 공급 계약", 1], [3, "다온모빌리티 전기차 10만 대 리콜…배터리 결함", -1], [3, "다온모빌리티 신임 CFO 선임", 0],
478
+ [3, "다온모빌리티, 정부 보조금 대상에서 제외돼 판매 감소 우려", -1], [3, "다온모빌리티, 3분기 전기차 판매량 사상 최대", 1], [3, "다온모빌리티 공장 증설 계획 백지화", -1],
479
+ [3, "다온모빌리티, 자율주행 기술 국내 최초 레벨4 인증", 1], [3, "다온모빌리티, 회사 로고 리뉴얼", 0], [3, "다온모빌리티 최대 고객사 파산 신청", -1], [3, "다온모빌리티, 유럽 친환경차 세액공제 대상 선정", 1],
480
+ ].map(([co, title, impact]) => ({ co, title, impact }));
481
+ async function judgeNews(company, title, decide) {
482
+ const r = await decide({ instruction: NEWS_INSTR, item: { "회사": company, "뉴스 제목": title }, choices: NEWS_CHOICES });
483
+ return { pick: r.choice.charCodeAt(0) - 65, conf: r.confidence, ms: r.ms, probs: [r.probs.A, r.probs.B, r.probs.C] };
484
+ }
485
+
486
+ const api = { DRIVE_INSTR, DRIVE, DRIVE_SAMPLES, drive, NEWS_INSTR, NEWS_CHOICES, COMPANIES, NEWS_BANK, judgeNews,
487
+ AXES, CASES, URGENCY, SAMPLES, classify, route, BOOL_INSTR, NLI_INSTR, QUESTIONS, CONTRACT, CLAIMS, splitClauses, askClause, checkClaim };
488
+ if (typeof module !== "undefined" && module.exports) module.exports = api; else root.Scenarios = api;
489
+ })(this);
490
+
491
+ </script>
492
+ <script>
493
+ /* ───────── 이름 ───────── */
494
+ const NAME = "KJH-Judge-4B-ko", SHORT = "KJH-Judge";
495
+ // 마지막 장면의 '직접 해 보기' 문구 (허깅페이스용 단일 파일에서는 make_showreel.py 가 주소로 바꿔 넣는다)
496
+ const TRY = window.SHOW_TRY || "마음 읽기 · 한국어 대결 · 에이전트 라우터 · 문의 분류함";
497
+
498
+ /* ───────── 데이터 (모두 저장된 실제 판정 결과) ───────── */
499
+ const D = window.JEV_DATA, LIVE = window.JEV_LIVE_EXAMPLE, QZ = window.JEV_QUIZ, EX = window.JEV_EXAMPLES, SN = window.Scenarios;
500
+ const esc = s => String(s).replace(/[&<>"']/g, c => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }[c]));
501
+ const pct = (x, d = 1) => (x * 100).toFixed(d) + "%";
502
+ const sec = ms => (ms / 1000).toFixed(2) + "초";
503
+
504
+ const TURNS = []; { let u = null; for (const x of LIVE.state.log) { if (x.t === "user") u = x.text; else if (x.t === "decision" && x.d.step === 1) TURNS.push({ u, d: x.d }); } }
505
+ const prob = (d, name) => d.probs[d.choices.indexOf(name)] || 0;
506
+ const D1 = TURNS[0].d, ASKC = D1.choices.find(c => c.startsWith("ASK")), RESC = D1.choices.find(c => c.startsWith("RESPOND"));
507
+ const TOOL = { get_weather: ["cloud", "날씨 조회"], call_taxi: ["car", "택시 호출"], create_event: ["calendar", "일정 등록"], send_money: ["send", "송금"], track_parcel: ["package", "택배 조회"] };
508
+
509
+ const qfind = f => QZ.pool.find(f);
510
+ const QWIC = qfind(q => q.item.word === "이상"), QCOPA = qfind(q => q.item.premise === "비행기가 난기류를 만났다."), QNEWS = qfind(q => (q.item.headline || "").startsWith("K리그"));
511
+
512
+ const INB = t => EX.inbox.find(x => x.text.includes(t));
513
+ const IN_HACK = INB("해킹"), IN_THANK = INB("김지은"), IN_PAY = INB("일시적 오류");
514
+ const GOLD_PAY = (SN.SAMPLES.find(s => s.text === IN_PAY.text) || { gold: [] }).gold;
515
+
516
+ const MS = [...EX.inbox.flatMap(x => Object.values(x.axes).map(a => a.ms)), ...EX.news.map(n => n.ms), ...EX.drive.map(d => d.ms)].sort((a, b) => a - b);
517
+ const MED = MS[MS.length >> 1];
518
+ // 뉴스: 회사별로 묶여 있으니 번갈아 나오게 (회사 안 순번 → 회사 순)
519
+ const NEWS = (() => { const seen = {}; return SN.NEWS_BANK.map((n, i) => ({ ...n, r: EX.news[i], k: seen[n.co] = (seen[n.co] || 0) + 1 })).sort((a, b) => a.k - b.k || a.co - b.co); })();
520
+
521
+ /* ───────── 아이콘 · 마크 · 글자 등장 ───────── */
522
+ const ICONS = {
523
+ car: '<path d="M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2"/><circle cx="7" cy="17" r="2"/><path d="M9 17h6"/><circle cx="17" cy="17" r="2"/>',
524
+ help: '<circle cx="12" cy="12" r="10"/><path d="M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
525
+ chat: '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>',
526
+ cloud: '<path d="M17.5 19H9a7 7 0 1 1 6.7-9h1.8a4.5 4.5 0 1 1 0 9Z"/>',
527
+ calendar: '<rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/>',
528
+ send: '<path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/>',
529
+ package: '<path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.7z"/><path d="M3.3 7 12 12l8.7-5M12 22V12"/>',
530
+ shield: '<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/><path d="M12 8v4M12 16h.01"/>',
531
+ heart: '<path d="M19 14c1.5-1.5 3-3.2 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.8 0-3 .5-4.5 2-1.5-1.5-2.7-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4 3 5.5l7 7Z"/>',
532
+ pause: '<rect x="6" y="4" width="4" height="16" rx="1"/><rect x="14" y="4" width="4" height="16" rx="1"/>',
533
+ user: '<circle cx="12" cy="8" r="4"/><path d="M4 21v-1a6 6 0 0 1 6-6h4a6 6 0 0 1 6 6v1"/>',
534
+ check: '<path d="M20 6 9 17l-5-5"/>',
535
+ x: '<path d="M18 6 6 18M6 6l12 12"/>',
536
+ zap: '<path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/>',
537
+ arrow: '<path d="M5 12h14M12 5l7 7-7 7"/>',
538
+ up: '<path d="m22 7-8.5 8.5-5-5L2 17"/><path d="M16 7h6v6"/>',
539
+ down: '<path d="m22 17-8.5-8.5-5 5L2 7"/><path d="M16 17h6v-6"/>',
540
+ minus: '<path d="M5 12h14"/>',
541
+ cpu: '<rect x="4" y="4" width="16" height="16" rx="2"/><rect x="9" y="9" width="6" height="6"/><path d="M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2"/>',
542
+ clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
543
+ layers: '<path d="m12 2 10 5-10 5L2 7l10-5Z"/><path d="m2 17 10 5 10-5M2 12l10 5 10-5"/>',
544
+ target: '<circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/>',
545
+ play: '<path d="m6 3 14 9-14 9V3z"/>',
546
+ };
547
+ const I = n => `<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">${ICONS[n]}</svg>`;
548
+ // 마크: 여러 보기가 하나의 판단으로 모인다
549
+ const MARK = cls => `<svg class="${cls}" viewBox="0 0 48 48" fill="none"><rect x="1" y="1" width="46" height="46" rx="14" fill="url(#gB)" fill-opacity=".13" stroke="url(#gB)" stroke-opacity=".55"/>
550
+ <path class="draw" pathLength="1" d="M13 14C22 14 24 24 34 24M13 24H34M13 34C22 34 24 24 34 24" stroke="url(#gB)" stroke-width="2.6" stroke-linecap="round"/>
551
+ <circle cx="13" cy="14" r="3" fill="#fff" fill-opacity=".55"/><circle cx="13" cy="24" r="3" fill="#fff" fill-opacity=".55"/><circle cx="13" cy="34" r="3" fill="#fff" fill-opacity=".55"/><circle class="dot" cx="35" cy="24" r="5.5" fill="url(#gB)"/></svg>`;
552
+ const CONN = d => `<svg class="conn" viewBox="0 0 96 30" data-in="${d}"><path class="draw" pathLength="1" d="M4 15H86"/><path class="draw" pathLength="1" d="M76 6 87 15 76 24"/></svg>`;
553
+ // 단어 단위 등장. *강조* 는 그라데이션
554
+ function H(s) { let on = false; // '*'를 만날 때마다 강조를 켜고 끈다 (조사가 붙어도 됨: *하나*를)
555
+ return s.split(" ").map((tok, i) => { let h = "";
556
+ tok.split("*").forEach((p, k) => { if (k) on = !on; if (p) h += on ? `<span class="acc">${esc(p)}</span>` : esc(p); });
557
+ return `<span class="w"><span style="--d:${i}">${h}</span></span>`; }).join(" "); }
558
+ const K = (i, t) => `<div class="kicker" data-in="80"><b>${String(i + 1).padStart(2, "0")}</b><i></i>${t}</div>`;
559
+ const HL = (s, d = 250, cls = "") => `<h1 class="hl words ${cls}" data-in="${d}">${H(s)}</h1>`;
560
+ const TYPE = (s, d, sp = 85) => `<span data-type="${d}" data-sp="${sp}" data-full="${esc(s)}"><span class="tt"></span><i class="caret"></i></span>`;
561
+
562
+ /* ───────── 장면 ───────── */
563
+ const CARD3 = () => [
564
+ { ic: "car", tt: "바로 택시 호출", ds: "출발지·도착지는 알아서?", k: "call", p: prob(D1, "CALL:call_taxi") },
565
+ { ic: "help", tt: "먼저 되묻기", ds: "“어디서 어디로 가세요?”", k: "ask", p: prob(D1, ASKC) },
566
+ { ic: "chat", tt: "말로만 답하기", ds: "“택시 앱을 써 보세요”", k: "respond", p: prob(D1, RESC) },
567
+ ];
568
+ const BRAND = ["#6d5dfc", "#2b9fff", "#20d3ad"];
569
+
570
+ const SCENES = [
571
+ { name: "상황", dur: 7600, aura: BRAND, cls: "s-hook", cap: "AI가 일을 하려면, 먼저 ‘무엇을 할지’ 골라야 합니다.",
572
+ html: () => `<div class="who" data-in="150">사용자가 AI 비서에게</div>
573
+ <div class="bubble glass" data-in="350">“${TYPE(TURNS[0].u, 700)}”</div>
574
+ ${HL("AI는 먼저 *무엇을* 해야 할까요?", 2000)}
575
+ <div class="opts3">${CARD3().map((c, i) => `<div class="opt3 glass k-${c.k}" data-in="${3000 + i * 260}"><div class="itile">${I(c.ic)}</div><div class="tt">${c.tt}</div><div class="ds">${c.ds}</div></div>`).join("")}</div>` },
576
+
577
+ { name: "판단", dur: 8800, aura: ["#ff9a3d", "#6d5dfc", "#2b9fff"], cls: "s-hook", cap: "출발지도 도착지도 모르니, 멋대로 부르지 않고 되묻습니다.",
578
+ html: () => { const cs = CARD3(), other = 1 - cs.reduce((s, c) => s + c.p, 0);
579
+ return `<div class="who">${SHORT}의 판단</div>
580
+ <div class="bubble glass">“${esc(TURNS[0].u)}”</div>
581
+ ${HL(`보기 ${D1.choices.length}개 중 *하나*를 고릅니다`, 150)}
582
+ <div class="stats"><span class="chipk" data-in="3500">${I("zap")} 판단 <b>${sec(D1.ms)}</b></span><span class="chipk" data-in="3700">나머지 도구 ${D1.choices.length - 3}개 합 <b>${pct(other)}</b></span></div>
583
+ <div class="opts3" id="o3">${cs.map((c, i) => `<div class="opt3 glass k-${c.k}" data-c="${i}"><span class="vd">DECISION</span><div class="itile">${I(c.ic)}</div><div class="tt">${c.tt}</div><div class="ds">${c.ds}</div>
584
+ <div class="meter"><div class="bar"><i data-w="${c.p}"></i></div><div class="pct" data-n="${c.p}">0.0%</div></div></div>`).join("")}</div>`; },
585
+ play(x) { x.at(700, () => x.$("#o3").classList.add("scan")); x.at(1800, () => x.$("#o3").classList.remove("scan"));
586
+ x.bars(1800, 1300); x.counts(1800, 1300, v => pct(v));
587
+ const cs = CARD3(), w = cs.reduce((b, c, i) => c.p > cs[b].p ? i : b, 0);
588
+ x.at(3200, () => x.$$("[data-c]").forEach((el, i) => el.classList.add(i === w ? "win" : "lose"))); } },
589
+
590
+ { name: "대화", dur: 10800, aura: ["#3f7dff", "#20d3ad", "#6d5dfc"], cap: "필요한 도구를 고르고, 없는 기능은 지어내지 않습니다.",
591
+ html: i => `${K(i, "대화가 이어지면")}${HL("할 일이면 하고, *못 하면 못 한다고*")}
592
+ <div class="turns">${TURNS.slice(1, 4).map((t, j) => { const d = t.d, b = 900 + j * 2900;
593
+ const [ic, lb, k] = d.kind === "CALL" ? [...TOOL[d.tool], "call"] : d.kind === "ASK" ? ["help", "되묻기", "ask"] : ["chat", "할 수 없다고 안내", "respond"];
594
+ const note = d.kind === "RESPOND" ? `<div class="nt">연결된 도구: ${LIVE.state.enabled.map(n => TOOL[n][1]).join(" · ")} — 주식 매매 도구는 없음</div>` : "";
595
+ return `<div class="turn"><div class="ub glass" data-in="${b}">“${esc(t.u)}”</div>${CONN(b + 500)}
596
+ <div class="dec glass k-${k}" data-in="${b + 900}"><div class="itile">${I(ic)}</div><div class="lb"><small>${d.kind}</small>${lb}</div><span class="pct" data-n="${d.conf}" data-t="${b + 1100}">0%</span>
597
+ <div class="bar"><i data-w="${d.conf}" data-t="${b + 1100}"></i></div>${note}</div></div>`; }).join("")}</div>`,
598
+ play(x) { x.bars(null, 1000); x.counts(null, 1000, v => pct(v)); } },
599
+
600
+ { name: "소개", dur: 8200, aura: BRAND, cap: "긴 글을 쓰는 대신, 주어진 보기 중 하나를 빠르고 정확하게 고릅니다.",
601
+ html: () => `<div class="center">
602
+ <div data-in="200">${MARK("markbig")}</div>
603
+ <div class="wm" data-in="900"><span class="a">KJH-Judge</span><span class="b">-4B-ko</span></div>
604
+ <div class="tag words" data-in="1700">${H("한국어로 *판단*만 하는 작은 모델")}</div>
605
+ <div class="facts">
606
+ <div class="fact glass k-call" data-in="2600"><div class="itile">${I("cpu")}</div><b>4B</b><span>40억 파라미터 · Qwen3-4B 기반</span></div>
607
+ <div class="fact glass k-respond" data-in="2850"><div class="itile">${I("clock")}</div><b>${D.train.gpu_hours.toFixed(1)}시간</b><span>GPU 학습 · ${D.train.steps.toLocaleString()}스텝</span></div>
608
+ <div class="fact glass k-hi" data-in="3100"><div class="itile">${I("target")}</div><b>2~26개</b><span>보기 중 하나 + 확률</span></div>
609
+ </div></div>` },
610
+
611
+ { name: "학습 전후", dur: 11200, aura: ["#ff6b5e", "#3f7dff", "#6d5dfc"], cap: "학습 전엔 거의 ‘A’만 찍던 모델이, 열 문제 중 아홉을 맞힙니다.",
612
+ html: i => { const N = 60, aShare = D.base_pred_letters.A / D.base_pooled.n, tot = D.pooled.n, L = Object.entries(D.pred_letters).sort((a, b) => b[1] - a[1]);
613
+ let cells = []; L.forEach(([l, c]) => { for (let k = 0; k < Math.round(c / tot * N); k++) cells.push(l); }); cells = cells.slice(0, N); while (cells.length < N) cells.push(L[0][0]);
614
+ cells = cells.map((c, j) => [c, (j * 37) % N]).sort((a, b) => a[1] - b[1]).map(c => c[0]);
615
+ return `${K(i, `같은 한국어 문제 ${D.pooled.n.toLocaleString()}개 · 22개 과목`)}${HL("‘A’만 찍던 모델이, *열에 아홉*을 맞히기까지")}
616
+ <div class="vs">
617
+ <div class="side glass before" data-in="500"><span class="lab">학습 전 · Qwen3-4B 그대로</span>
618
+ <div class="tiles" data-tiles="1000">${Array.from({ length: N }, (_, j) => `<span style="--i:${j}">A</span>`).join("")}</div>
619
+ <div class="note">답의 <b>${pct(aShare)}</b>가 그냥 ‘A’</div>
620
+ <div class="bign" data-n="${D.base_pooled.acc}" data-t="2000" data-d="900">0%</div><div class="sub">정답률 · 무작위로 찍기(${pct(D.pooled.chance)})와 같은 수준</div></div>
621
+ <div class="mid" data-in="3300"><div class="ring">${I("arrow")}</div>미세조정<br>${D.train.steps.toLocaleString()}스텝</div>
622
+ <div class="side glass after" data-in="3700"><span class="lab">학습 후 · ${NAME}</span>
623
+ <div class="tiles" data-tiles="4200">${cells.map((c, j) => `<span style="--i:${j};--h:${255 - (c.charCodeAt(0) - 65) * 11}">${c}</span>`).join("")}</div>
624
+ <div class="note">문제마다 내용을 읽고 <b>A~K</b>를 고루 고름</div>
625
+ <div class="bign" data-n="${D.pooled.acc}" data-t="5300" data-d="1900">0%</div><div class="sub">정답률 · 열 문제 중 아홉</div></div>
626
+ </div>`; },
627
+ play(x) { x.$$("[data-tiles]").forEach(el => x.at(+el.dataset.tiles, () => el.classList.add("on"))); x.counts(null, null, v => pct(v)); } },
628
+
629
+ { name: "한국어", dur: 15200, aura: ["#ffd36b", "#20d3ad", "#3f7dff"], cap: "동음이의어, 원인과 결과, 뉴스 분야까지 — 맥락을 읽고 판단합니다.",
630
+ html: i => { const hl = s => esc(s).replace(/\[(.+?)\]/g, "<mark>$1</mark>");
631
+ const opts = (q, b, top) => { let idx = q.choices.map((_, j) => j); if (top) idx = idx.sort((a, c) => q.jev.probs[c] - q.jev.probs[a]).slice(0, top);
632
+ let h = idx.map(j => `<div class="op" data-op="${j === q.jev.pick ? "pick" : "rest"}" data-r="${b + 2700}"><span class="t">${esc(q.choices[j])}</span><span class="pct" data-n="${q.jev.probs[j]}" data-t="${b + 1300}">0%</span><div class="bar"><i data-w="${q.jev.probs[j]}" data-t="${b + 1300}" style="--c:${j === q.jev.pick ? "var(--good)" : "#59637a"}"></i></div></div>`).join("");
633
+ if (top && q.choices.length > top) { const rest = 1 - idx.reduce((s, j) => s + q.jev.probs[j], 0); h += `<div class="op" data-op="rest" data-r="${b + 2700}"><span class="t" style="color:var(--muted)">그 외 ${q.choices.length - top}개 분야</span><span class="pct" style="color:var(--muted)" data-n="${rest}" data-t="${b + 1300}">0%</span></div>`; }
634
+ return h; };
635
+ const foot = (q, b) => `<div class="foot" data-in="${b + 2800}">${q.jev.pick === q.gold ? `<span class="badge k-good">${I("check")} 정답</span>` : `<span class="badge k-bad">${I("x")} 오답</span>`}<span>${I("zap")} ${sec(q.jev.ms)}</span></div>`;
636
+ const B = [700, 5300, 9900];
637
+ return `${K(i, "한국어, 얼마나 알아들을까? · 문제 출처 KoBEST·KLUE (CC BY-SA 4.0)")}${HL("사람도 *잠깐 멈칫하는* 문제들")}
638
+ <div class="qs">
639
+ <div class="qc glass" data-in="${B[0]}"><span class="qtag">같은 단어, 같은 뜻일까?</span><div class="qb"><p>① ${hl(QWIC.item.context_1)}</p><p>② ${hl(QWIC.item.context_2)}</p></div>${opts(QWIC, B[0])}${foot(QWIC, B[0])}</div>
640
+ <div class="qc glass" data-in="${B[1]}"><span class="qtag">그 ${esc(QCOPA.item.relation_to_select)}는?</span><div class="qb"><p>${esc(QCOPA.item.premise)}</p><small>더 그럴듯한 ${esc(QCOPA.item.relation_to_select)}를 고르세요</small></div>${opts(QCOPA, B[1])}${foot(QCOPA, B[1])}</div>
641
+ <div class="qc glass" data-in="${B[2]}"><span class="qtag">어느 분야 뉴스일까?</span><div class="qb"><p>“${esc(QNEWS.item.headline)}”</p><small>보기 ${QNEWS.choices.length}개 · ${QNEWS.choices.map(esc).join(" · ")}</small></div>${opts(QNEWS, B[2], 2)}${foot(QNEWS, B[2])}</div>
642
+ </div>`; },
643
+ play(x) { x.bars(null, 1000); x.counts(null, 1000, v => pct(v)); x.$$("[data-op=rest]").forEach(el => x.at(+el.dataset.r, () => el.classList.add("dim"))); } },
644
+
645
+ { name: "고객센터", dur: 12200, aura: ["#ff6b5e", "#20d3ad", "#6d5dfc"], cap: "AI는 사안과 감정을 고르고, 담당 부서와 긴급도는 공개된 규칙표가 정합니다.",
646
+ html: i => { const MOOD = SN.AXES.find(a => a.key === "mood").choices, UK = ["bad", "ask", "good"];
647
+ const row = (it, b, ic) => { const c = SN.CASES[it.axes.case.pick], m = it.axes.mood;
648
+ return `<div class="row"><div class="msg glass" data-in="${b}"><div class="h"><i></i>고객 문의</div><div class="t">“${esc(it.text)}”</div></div>
649
+ <div class="chips"><div class="chip glass" data-in="${b + 1100}"><span class="k">사안</span><span class="v">${esc(c.label)}</span><span class="pct" data-n="${it.axes.case.conf}" data-t="${b + 1200}">0%</span></div>
650
+ <div class="chip glass" data-in="${b + 1500}"><span class="k">감정</span><span class="v">${esc(MOOD[m.pick])}</span><span class="pct" data-n="${m.conf}" data-t="${b + 1600}">0%</span></div></div>
651
+ ${CONN(b + 2200)}
652
+ <div class="route glass k-${UK[c.urgency]}" data-in="${b + 2700}"><div class="itile">${I(ic)}</div><div class="d">${esc(c.dept)}팀</div><div class="u">${SN.URGENCY[c.urgency]}</div><div class="s">규칙표로 결정</div></div></div>`; };
653
+ return `${K(i, "고객센터라면")}${HL("문의를 읽고, 나누고, *바로 보냅니다*")}
654
+ <div class="rows">${row(IN_HACK, 800, "shield")}${row(IN_THANK, 5600, "heart")}</div>`; },
655
+ play(x) { x.counts(null, 800, v => pct(v, 0)); } },
656
+
657
+ { name: "확신", dur: 13200, aura: ["#ffb44d", "#ff6b5e", "#6d5dfc"], cls: "s-unsure", cap: "확신 숫자를 믿을 수 있으니, 낮을 때만 사람이 보면 됩니다.",
658
+ html: i => { const pr = IN_PAY.axes.case.probs, top = pr.map((p, j) => [p, j]).sort((a, b) => b[0] - a[0]).slice(0, 3), conf = IN_PAY.axes.case.conf, TH = 0.7;
659
+ const gold = GOLD_PAY.length ? SN.CASES[GOLD_PAY[0]].label : null, right = GOLD_PAY.includes(IN_PAY.axes.case.pick);
660
+ // 반원 게이지: 중심 (220,230), 반지름 190
661
+ const cx = 220, cy = 230, R = 190, ang = p => Math.PI * (1 - p), pt = (p, r) => [cx + r * Math.cos(ang(p)), cy - r * Math.sin(ang(p))];
662
+ const [t1x, t1y] = pt(TH, R - 26), [t2x, t2y] = pt(TH, R + 26), [lx, ly] = pt(TH, R + 52);
663
+ const arc = `M${cx - R} ${cy} A${R} ${R} 0 0 1 ${cx + R} ${cy}`;
664
+ return `${K(i, `${SHORT}도 헷갈릴 때`)}${HL("모르면, *모른다고* 말합니다")}
665
+ <div class="unsure">
666
+ <div class="ucol"><div class="msg glass" data-in="500"><div class="h"><i></i>고객 문의</div><div class="t">“${esc(IN_PAY.text)}”</div></div>
667
+ <div class="cands glass" data-in="1100">${top.map(([p, j], k) => `<div class="op"><span class="t">${esc(SN.CASES[j].label)}</span><span class="pct" data-n="${p}" data-t="1300">0%</span><div class="bar"><i data-w="${p}" data-t="1300" style="--c:${k === 0 ? "var(--ask)" : "#59637a"}"></i></div></div>`).join("")}</div>
668
+ <div class="calib glass" data-in="7600"><div><div class="n" data-n="${D.pooled.mean_conf}" data-t="7800">0%</div><div class="l">모델이 말한 평균 확신</div></div><div class="eq">≈</div>
669
+ <div><div class="n" data-n="${D.pooled.acc}" data-t="7800">0%</div><div class="l">실제 정답률 · ${D.pooled.n.toLocaleString()}문항</div></div>
670
+ <div class="say">확신 숫자가 실제와 거의 같아<br>기준선을 걸어 두고 쓸 수 있습니다</div></div></div>
671
+ <div class="gauge glass" data-in="2200"><div class="lab2">1순위 판단의 확신</div>
672
+ <div class="gwrap"><svg viewBox="0 0 440 250"><path d="${arc}" stroke="rgba(255,255,255,.08)" stroke-width="30" fill="none" stroke-linecap="round"/>
673
+ <path id="arcv" d="${arc}" pathLength="100" stroke="url(#gA)" stroke-width="30" fill="none" stroke-linecap="round" stroke-dasharray="100" stroke-dashoffset="100" style="filter:drop-shadow(0 0 14px rgba(255,170,70,.55))"/>
674
+ <line x1="${t1x}" y1="${t1y}" x2="${t2x}" y2="${t2y}" stroke="#fff" stroke-width="3.5" stroke-linecap="round"/>
675
+ <text class="gth" x="${lx}" y="${ly}" text-anchor="middle">자동 처리 기준 ${pct(TH, 0)}</text></svg>
676
+ <div class="gnum" data-n="${conf}" data-t="2500" data-d="1200">0%</div></div>
677
+ <div class="hold" data-in="4100">${I("pause")} 자동 처리 보류 ${I("arrow")} ${I("user")} 사람 상담사</div>
678
+ ${gold ? `<div class="truth" data-in="5600">${right ? "이번 1순위는 맞았지만, 스스로 확신이 낮다고 알렸습니다." : `실제 정답은 <b>‘${esc(gold)}’</b>.<br>1순위는 틀렸고, <b>그래서 넘긴 게 맞았습니다.</b>`}</div>` : ""}</div>
679
+ </div>`; },
680
+ play(x) { x.bars(null, 1000); x.counts(null, 1000, v => pct(v)); const a = x.$("#arcv"), c = IN_PAY.axes.case.conf; x.tween(2500, 1200, p => a.setAttribute("stroke-dashoffset", 100 - c * 100 * p)); } },
681
+
682
+ { name: "순위", dur: 12200, aura: ["#ffd36b", "#6d5dfc", "#2b9fff"], cap: "공개 벤치마크 표의 4B 모델 중 가장 높고, 27B급 모델과 나란히 섭니다.",
683
+ html: i => { const rows = [["Gemma 4 31B", "31B", 94.40], ["Decision 2.0 Vega 27B", "27B", 92.38], ["Gemma 4 26B-A4B", "26B", 90.37], ["Gemma 4 12B", "12B", 89.58], ["Cygnet · Gemma 12B", "12B", 89.18],
684
+ ["Qwen3.8 27B", "27B", 89.02], ["JEV 1.13 · hosted API", "API", 88.93], ["K-Decision 4B", "4B", 85.41], ["Mica v0.1 4B", "4B", 81.47], ["Qwen3.5 4B", "4B", 78.77]];
685
+ rows.push([`${NAME} (이 모델)`, "4B", D.pooled.acc * 100, true]); rows.sort((a, b) => b[2] - a[2] || (a[3] ? 1 : 0) - (b[3] ? 1 : 0)); // 동점이면 이 모델을 아래에
686
+ return `${K(i, `공개 한국어 판단 벤치마크 · ${D.pooled.n.toLocaleString()}문항`)}${HL("덩치 *7배* 모델들과 같은 줄에")}
687
+ <div class="board">${rows.map((r, j) => `<div class="lr ${r[3] ? "me" : ""} ${r[1] === "4B" ? "small" : ""}" data-in="${600 + j * 110}"><span class="rk">${String(j + 1).padStart(2, "0")}</span><span class="nm">${esc(r[0])}</span><span class="sz">${r[1]}</span>
688
+ <div class="bar"><i data-w="${(r[2] - 70) / 30}" data-t="${1000 + j * 110}"></i></div><span class="pct" data-n="${r[2] / 100}" data-t="${1000 + j * 110}">0%</span></div>`).join("")}</div>
689
+ <div class="fine" data-in="2800">출처: Korean JEV Benchmark 공개 표(2026-10-09)의 한국어 정확도, 막대는 70~100% 구간. 다른 모델은 추가 학습 없는 제로샷이고, ${NAME}은 같은 출처 데이터의 학습 분할로 미세조정했습니다 — 같은 조건의 비교가 아니며, 영어 성능은 측정하지 않았습니다.</div>`; },
690
+ play(x) { x.bars(null, 1300); x.counts(null, 1300, v => (v * 100).toFixed(2) + "%"); } },
691
+
692
+ { name: "속도", dur: 11200, aura: ["#20d3ad", "#2b9fff", "#6d5dfc"], cap: "뉴스 제목이 뜨자마자, 호재인지 악재인지 판단합니다.",
693
+ html: i => `${K(i, "속도")}${HL(`판단 한 번, *${(MED / 1000).toFixed(2)}초*`)}
694
+ <div class="speed"><div class="ticker glass" id="tick" data-in="400"></div>
695
+ <div class="spr"><div class="spbox glass" data-in="700"><div class="big"><span data-n="${MED}" data-t="900" data-d="1000">0</span><small>ms</small></div><div class="l">판단 1번 계산 시간 (네트워크 왕복 제외)<br>GPU 1장 · 저장된 예시 판정 ${MS.length}건의 중앙값</div></div>
696
+ <div class="cnt glass" data-in="1100"><div><b id="tkn">0</b><span>가상 회사 뉴스<br>판정 건수</span></div><div class="g"><b id="tkh">0</b><span>미리 정해 둔<br>답과 일치</span></div></div></div></div>`,
697
+ play(x) { const box = x.$("#tick"), LAB = [["호재", "up", "up"], ["악재", "dn", "down"], ["영향 적음", "nn", "minus"]]; let hit = 0;
698
+ x.counts(null, null, v => Math.round(v));
699
+ NEWS.forEach((n, j) => x.at(1000 + j * 210, () => { const ok = [1, -1, 0][n.r.pick] === n.impact; if (ok) hit++; const L = LAB[n.r.pick];
700
+ const el = document.createElement("div"); el.className = "tk " + L[1];
701
+ el.innerHTML = `<span class="tr">${I(L[2])}</span><span class="ti">${esc(n.title)}</span><span class="tg">${L[0]}</span><span class="ck" style="color:var(--${ok ? "good" : "bad"})">${I(ok ? "check" : "x")}</span>`;
702
+ box.prepend(el); while (box.children.length > 10) box.lastChild.remove();
703
+ x.$("#tkn").textContent = j + 1; x.$("#tkh").textContent = hit; })); } },
704
+
705
+ { name: "마무리", dur: 9500, aura: BRAND, cap: "",
706
+ html: () => `<div class="center">
707
+ <div data-in="200">${MARK("markbig")}</div>
708
+ <div class="wm" data-in="900"><span class="a">KJH-Judge</span><span class="b">-4B-ko</span></div>
709
+ <div class="tag words" data-in="1700">${H("고르는 일은, *KJH-Judge*에게.")}</div>
710
+ <div class="facts">
711
+ <div class="fact glass k-call" data-in="2600"><div class="itile">${I("target")}</div><b>${pct(D.pooled.acc)}</b><span>한국어 판단 정확도 · ${D.pooled.n.toLocaleString()}문항</span></div>
712
+ <div class="fact glass k-respond" data-in="2850"><div class="itile">${I("zap")}</div><b>${(MED / 1000).toFixed(2)}초</b><span>판단 1번 계산 · GPU 1장</span></div>
713
+ <div class="fact glass k-hi" data-in="3100"><div class="itile">${I("cpu")}</div><b>4B</b><span>작아서 내 서버에서 직접 운영</span></div>
714
+ </div>
715
+ <div class="try" data-in="3900">${I("play")} 직접 해 보기 · <b>${esc(TRY)}</b></div></div>` },
716
+ ];
717
+
718
+ /* ───────── 재생 엔진 (자체 시계: 일시정지·장면 이동이 정확) ───────── */
719
+ const $ = s => document.querySelector(s), stage = $("#stage");
720
+ const P = new URLSearchParams(location.search);
721
+ const LOOP = P.get("loop") === "1", HOLD = P.get("hold") === "1";
722
+ if (P.get("cap") === "0") document.body.classList.add("nocap");
723
+ if (P.get("clean") === "1") document.body.classList.add("clean");
724
+ let cur = 0, t = 0, paused = false, cues = [], tweens = [], sceneEl = null, camEl = null, last = performance.now();
725
+ const easeOut = p => 1 - Math.pow(1 - p, 3), lin = p => p;
726
+
727
+ $("#brand").innerHTML = MARK("on") + `<b>${SHORT}</b><span class="pl">4B · ko</span>`;
728
+ $("#chapall").textContent = String(SCENES.length).padStart(2, "0");
729
+ $("#segs").innerHTML = SCENES.map(() => "<span><i></i></span>").join("");
730
+
731
+ function makeCtx(root) {
732
+ const x = {
733
+ $: s => root.querySelector(s), $$: s => [...root.querySelectorAll(s)],
734
+ at(ms, fn) { cues.push({ ms, fn, done: false }); },
735
+ tween(ms, dur, fn, ease = easeOut) { tweens.push({ ms, dur, fn, ease, done: false }); },
736
+ bars(start, dur) { x.$$("[data-w]").forEach(el => { const s = el.dataset.t ? +el.dataset.t : start, d = el.dataset.d ? +el.dataset.d : dur, w = Math.max(0, Math.min(1, +el.dataset.w));
737
+ x.tween(s, d, p => el.style.width = w * p * 100 + "%"); }); },
738
+ counts(start, dur, fmt) { x.$$("[data-n]").forEach(el => { const s = el.dataset.t ? +el.dataset.t : start, d = el.dataset.d ? +el.dataset.d : dur, n = +el.dataset.n;
739
+ x.tween(s, d, p => el.textContent = fmt(n * p)); }); },
740
+ };
741
+ return x;
742
+ }
743
+ function go(i) {
744
+ cur = (i + SCENES.length) % SCENES.length; t = 0; cues = []; tweens = [];
745
+ if (sceneEl) { const old = sceneEl; old.classList.add("leaving"); setTimeout(() => old.remove(), 560); }
746
+ const sc = SCENES[cur], el = document.createElement("div"); el.className = "scene";
747
+ el.innerHTML = `<div class="cam ${sc.cls || ""}">${sc.html(cur)}</div>`;
748
+ stage.insertBefore(el, $("#cap")); sceneEl = el; camEl = el.firstChild;
749
+ const x = makeCtx(el);
750
+ x.$$("[data-in]").forEach(n => x.at(+n.dataset.in, () => n.classList.add("on")));
751
+ x.$$("[data-type]").forEach(n => { const full = n.dataset.full, tt = n.querySelector(".tt"), sp = +n.dataset.sp;
752
+ x.tween(+n.dataset.type, full.length * sp, p => tt.textContent = full.slice(0, Math.round(full.length * p)), lin); });
753
+ if (sc.play) sc.play(x);
754
+ const cap = $("#cap"); cap.classList.remove("on"); cap.textContent = sc.cap || ""; if (sc.cap) x.at(900, () => cap.classList.add("on"));
755
+ (sc.aura || BRAND).forEach((c, k) => $("#aurora .b" + (k + 1)).style.backgroundColor = c);
756
+ $("#chapn").textContent = String(cur + 1).padStart(2, "0"); $("#chapt").textContent = sc.name;
757
+ cues.sort((a, b) => a.ms - b.ms);
758
+ tick(0); renderHud();
759
+ }
760
+ function tick(dt) {
761
+ if (!paused) t += dt;
762
+ for (const c of cues) if (!c.done && t >= c.ms) { c.done = true; c.fn(); }
763
+ for (const w of tweens) if (!w.done && t >= w.ms) { const p = Math.min(1, (t - w.ms) / w.dur); w.fn(w.ease(p)); if (p >= 1) w.done = true; }
764
+ const dur = SCENES[cur].dur, prog = Math.min(1, t / dur);
765
+ if (camEl) camEl.style.transform = `scale(${1 + 0.022 * prog})`; // 천천히 다가가는 카메라
766
+ document.querySelectorAll("#segs i").forEach((s, k) => s.style.width = (k < cur ? 100 : k === cur ? prog * 100 : 0) + "%");
767
+ const lastScene = cur === SCENES.length - 1 && !LOOP && !HOLD;
768
+ $("#fade").style.opacity = lastScene ? Math.max(0, Math.min(1, (t - (dur - 1500)) / 1300)) : 0;
769
+ if (!paused && !HOLD && t >= dur) { if (cur < SCENES.length - 1) go(cur + 1); else if (LOOP) go(0); else t = dur; }
770
+ }
771
+ function loop(now) { const dt = Math.min(100, now - last); last = now; tick(dt); requestAnimationFrame(loop); }
772
+
773
+ function fit() { const s = Math.min(innerWidth / 1920, innerHeight / 1080); stage.style.transform = `translate(-50%,-50%) scale(${s})`; }
774
+ addEventListener("resize", fit); fit();
775
+
776
+ function setPause(v) { paused = v; $("#play").textContent = paused ? "▶︎ 재생" : "❚❚"; $("#pausebadge").hidden = !paused || document.body.classList.contains("clean"); }
777
+ function renderHud() { $("#dots").innerHTML = SCENES.map((s, i) => `<button class="${i === cur ? "cur" : ""}" data-g="${i}" title="${i + 1}. ${s.name}">${i + 1}</button>`).join(""); }
778
+ $("#dots").onclick = e => { const b = e.target.closest("[data-g]"); if (b) go(+b.dataset.g); };
779
+ $("#prev").onclick = () => go(cur - 1); $("#next").onclick = () => go(cur + 1); $("#play").onclick = () => setPause(!paused);
780
+ addEventListener("keydown", e => {
781
+ if (e.ctrlKey || e.metaKey || e.altKey) return;
782
+ const k = e.key;
783
+ if (k === " ") { e.preventDefault(); setPause(!paused); }
784
+ else if (k === "ArrowRight" || k === "PageDown") go(cur + 1);
785
+ else if (k === "ArrowLeft" || k === "PageUp") go(cur - 1);
786
+ else if (k === "r" || k === "R") { setPause(false); go(0); }
787
+ else if (k === "h" || k === "H") { document.body.classList.toggle("clean"); setPause(paused); }
788
+ else if (k === "c" || k === "C") document.body.classList.toggle("nocap");
789
+ else if (k === "f" || k === "F") { document.fullscreenElement ? document.exitFullscreen() : document.documentElement.requestFullscreen().catch(() => {}); }
790
+ else if (/^[0-9]$/.test(k)) { const n = k === "0" ? 9 : +k - 1; if (n < SCENES.length) go(n); }
791
+ });
792
+ let idleT; addEventListener("mousemove", () => { document.body.classList.remove("idle"); clearTimeout(idleT); idleT = setTimeout(() => document.body.classList.add("idle"), 2200); });
793
+ idleT = setTimeout(() => document.body.classList.add("idle"), 2200);
794
+
795
+ const start = Math.max(0, Math.min(SCENES.length - 1, (+P.get("s") || 1) - 1));
796
+ (document.fonts ? Promise.race([document.fonts.ready, new Promise(r => setTimeout(r, 1800))]) : Promise.resolve()).then(() => { go(start);
797
+ const at = +P.get("at") || 0; for (let k = 0; k < at; k += 50) tick(Math.min(50, at - k)); // ?at=ms : 장면 안의 그 시점으로 이동
798
+ last = performance.now(); requestAnimationFrame(loop); });
799
+ </script>
800
+ </body>
801
+ </html>
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
3
+ size 11422650
tokenizer_config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "model_max_length": 131072,
24
+ "pad_token": "<|endoftext|>",
25
+ "split_special_tokens": false,
26
+ "tokenizer_class": "Qwen2Tokenizer",
27
+ "unk_token": null
28
+ }