File size: 10,667 Bytes
7b7257a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
"""KAIdol 학습 모델 레지스트리 - 모든 학습된 모델 정의"""

from typing import Dict, List, Optional

# 기본 모델 정보 (HuggingFace Hub)
BASE_MODELS = {
    "hyperclovax-32b": "naver-hyperclovax/HyperCLOVAX-SEED-Think-32B",
    "qwen2.5-72b": "Qwen/Qwen2.5-72B-Instruct",
    "qwen2.5-32b": "Qwen/Qwen2.5-32B-Instruct",
    "qwen2.5-14b": "Qwen/Qwen2.5-14B-Instruct",
    "qwen2.5-7b": "Qwen/Qwen2.5-7B-Instruct",
    "qwen3-8b": "Qwen/Qwen3-8B",
    "exaone-7.8b": "LGAI-EXAONE/EXAONE-3.5-7.8B-Instruct",
    "solar-10.7b": "upstage/SOLAR-10.7B-Instruct-v1.0",
    "solar-pro": "upstage/solar-pro-preview-instruct",
    "varco-8b": "NCSOFT/Llama-VARCO-8B-Instruct",
    "kanana-2-30b-thinking": "kakaocorp/kanana-2-30b-a3b-thinking",
    "kanana-2-30b-instruct": "kakaocorp/kanana-2-30b-a3b-instruct",
    "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct",
}

# 전체 모델 레지스트리
MODEL_REGISTRY: Dict[str, Dict[str, Dict]] = {
    # ============================================================
    # DPO v5 계열 (2026-01-13)
    # ============================================================
    "dpo-v5": {
        "hyperclovax-32b-dpo-v5": {
            "path": "outputs/dpo_v5/hyperclovax-32b-dpo-v5-20260113-0012",
            "base": BASE_MODELS["hyperclovax-32b"],
            "method": "DPO",
            "size": "32B",
            "description": "HyperCLOVAX 32B DPO v5 (Primary)",
            "recommended": True,
        },
        "qwen2.5-14b-dpo-v5": {
            "path": "outputs/dpo_v5/qwen2.5-14b-dpo-v5-20260113-0045",
            "base": BASE_MODELS["qwen2.5-14b"],
            "method": "DPO",
            "size": "14B",
            "description": "Qwen2.5 14B DPO v5",
        },
        "qwen2.5-7b-dpo-v5": {
            "path": "outputs/dpo_v5/qwen2.5-7b-dpo-v5-20260113-0052",
            "base": BASE_MODELS["qwen2.5-7b"],
            "method": "DPO",
            "size": "7B",
            "description": "Qwen2.5 7B DPO v5",
        },
        "exaone-7.8b-dpo-v5": {
            "path": "outputs/dpo_v5/exaone-7.8b-dpo-v5-20260113-0052",
            "base": BASE_MODELS["exaone-7.8b"],
            "method": "DPO",
            "size": "7.8B",
            "description": "EXAONE 7.8B DPO v5",
        },
        "qwen3-8b-dpo-v5": {
            "path": "outputs/dpo_v5/qwen3-8b-dpo-v5-20260113-0052",
            "base": BASE_MODELS["qwen3-8b"],
            "method": "DPO",
            "size": "8B",
            "description": "Qwen3 8B DPO v5",
        },
        "solar-10.7b-dpo-v5": {
            "path": "outputs/dpo_v5/solar-10.7b-dpo-v5-20260113-0045",
            "base": BASE_MODELS["solar-10.7b"],
            "method": "DPO",
            "size": "10.7B",
            "description": "Solar 10.7B DPO v5",
        },
    },

    # ============================================================
    # SFT Thinking 계열 (2026-01-16)
    # ============================================================
    "sft-thinking": {
        "qwen2.5-14b-thinking": {
            "path": "outputs/qwen2.5-14b-thinking-full",
            "base": BASE_MODELS["qwen2.5-14b"],
            "method": "SFT",
            "size": "14B",
            "description": "Qwen2.5 14B SFT Thinking",
        },
        "qwen2.5-7b-thinking": {
            "path": "outputs/qwen2.5-7b-thinking-full",
            "base": BASE_MODELS["qwen2.5-7b"],
            "method": "SFT",
            "size": "7B",
            "description": "Qwen2.5 7B SFT Thinking",
        },
        "exaone-7.8b-thinking": {
            "path": "outputs/exaone-7.8b-thinking-full",
            "base": BASE_MODELS["exaone-7.8b"],
            "method": "SFT",
            "size": "7.8B",
            "description": "EXAONE 7.8B SFT Thinking",
        },
    },

    # ============================================================
    # Phase 7 Students (Kimi K2 Distillation)
    # ============================================================
    "phase7-students": {
        "kanana-30b-thinking-kimi": {
            "path": "outputs/phase7_students/kanana-2-30b-thinking-kimi-student",
            "base": BASE_MODELS["kanana-2-30b-thinking"],
            "method": "Distillation",
            "size": "30B (3B active)",
            "description": "Kanana 30B Thinking Kimi Student",
        },
        "kanana-30b-instruct-kimi": {
            "path": "outputs/phase7_students/kanana-2-30b-instruct-kimi-student",
            "base": BASE_MODELS["kanana-2-30b-instruct"],
            "method": "Distillation",
            "size": "30B (3B active)",
            "description": "Kanana 30B Instruct Kimi Student",
        },
        "qwen2.5-14b-kimi": {
            "path": "outputs/phase7_students/qwen2.5-14b-kimi-student",
            "base": BASE_MODELS["qwen2.5-14b"],
            "method": "Distillation",
            "size": "14B",
            "description": "Qwen2.5 14B Kimi Student",
        },
        "qwen2.5-7b-kimi-v3": {
            "path": "outputs/phase7_students/qwen2.5-7b-kimi-student-v3",
            "base": BASE_MODELS["qwen2.5-7b"],
            "method": "Distillation",
            "size": "7B",
            "description": "Qwen2.5 7B Kimi Student v3",
        },
        "exaone-7.8b-kimi": {
            "path": "outputs/phase7_students/exaone-7.8b-kimi-student",
            "base": BASE_MODELS["exaone-7.8b"],
            "method": "Distillation",
            "size": "7.8B",
            "description": "EXAONE 7.8B Kimi Student",
        },
    },

    # ============================================================
    # V7 Students (Latest - 2026-01-17~19)
    # ============================================================
    "v7-students": {
        "qwen2.5-72b-v7": {
            "path": "outputs/v7_students/qwen2.5-72b-v7-20260119-1113",
            "base": BASE_MODELS["qwen2.5-72b"],
            "method": "SFT",
            "size": "72B",
            "description": "Qwen2.5 72B V7 (Latest)",
        },
        "llama-3.3-70b-v7": {
            "path": "outputs/v7_students/llama-3.3-70b-v7-20260119-1114",
            "base": BASE_MODELS["llama-3.3-70b"],
            "method": "SFT",
            "size": "70B",
            "description": "Llama 3.3 70B V7 (Latest)",
        },
        "qwen2.5-32b-v7": {
            "path": "outputs/v7_students/qwen2.5-32b-v7-20260118-1135",
            "base": BASE_MODELS["qwen2.5-32b"],
            "method": "SFT",
            "size": "32B",
            "description": "Qwen2.5 32B V7",
        },
        "qwen2.5-14b-v7": {
            "path": "outputs/v7_students/qwen2.5-14b-v7-20260118-1135",
            "base": BASE_MODELS["qwen2.5-14b"],
            "method": "SFT",
            "size": "14B",
            "description": "Qwen2.5 14B V7",
        },
        "qwen2.5-7b-v7": {
            "path": "outputs/v7_students/qwen2.5-7b-v7-20260118-1135",
            "base": BASE_MODELS["qwen2.5-7b"],
            "method": "SFT",
            "size": "7B",
            "description": "Qwen2.5 7B V7",
        },
        "exaone-7.8b-v7": {
            "path": "outputs/v7_students/exaone-7.8b-v7-20260118-1135",
            "base": BASE_MODELS["exaone-7.8b"],
            "method": "SFT",
            "size": "7.8B",
            "description": "EXAONE 7.8B V7",
        },
        "qwen3-8b-v7": {
            "path": "outputs/v7_students/qwen3-8b-v7-20260118-1135",
            "base": BASE_MODELS["qwen3-8b"],
            "method": "SFT",
            "size": "8B",
            "description": "Qwen3 8B V7",
        },
        "solar-pro-v7": {
            "path": "outputs/v7_students/solar-pro-v7-20260118-1135",
            "base": BASE_MODELS["solar-pro"],
            "method": "SFT",
            "size": "22B",
            "description": "Solar Pro V7",
        },
        "varco-8b-v7": {
            "path": "outputs/v7_students/varco-8b-v7-20260118-1135",
            "base": BASE_MODELS["varco-8b"],
            "method": "SFT",
            "size": "8B",
            "description": "VARCO 8B V7",
        },
    },

    # ============================================================
    # 기타 학습 모델 (DPO, etc.)
    # ============================================================
    "others": {
        "exaone-7.8b-dpo": {
            "path": "outputs/exaone-7.8b-dpo",
            "base": BASE_MODELS["exaone-7.8b"],
            "method": "DPO",
            "size": "7.8B",
            "description": "EXAONE 7.8B DPO (Standalone)",
        },
        "qwen2.5-7b-dpo": {
            "path": "outputs/qwen2.5-7b-dpo",
            "base": BASE_MODELS["qwen2.5-7b"],
            "method": "DPO",
            "size": "7B",
            "description": "Qwen2.5 7B DPO (Standalone)",
        },
    },
}


def get_all_models() -> List[str]:
    """모든 모델 ID 목록 반환"""
    models = []
    for category, model_dict in MODEL_REGISTRY.items():
        models.extend(model_dict.keys())
    return models


def get_model_info(model_id: str) -> Optional[Dict]:
    """모델 ID로 정보 조회"""
    for category, model_dict in MODEL_REGISTRY.items():
        if model_id in model_dict:
            info = model_dict[model_id].copy()
            info["category"] = category
            info["id"] = model_id
            return info
    return None


def get_models_by_category(category: str) -> List[str]:
    """카테고리별 모델 목록"""
    return list(MODEL_REGISTRY.get(category, {}).keys())


def get_all_categories() -> List[str]:
    """모든 카테고리 목록"""
    return list(MODEL_REGISTRY.keys())


def get_models_for_dropdown() -> List[tuple]:
    """드롭다운용 (display_name, model_id) 튜플 리스트"""
    result = []
    for category, model_dict in MODEL_REGISTRY.items():
        for model_id, info in model_dict.items():
            display = f"[{info.get('size', '?')}] {info.get('description', model_id)}"
            result.append((display, model_id))
    return result


def get_small_models(max_size_gb: int = 16) -> List[str]:
    """메모리 제한에 맞는 소형 모델만 반환 (4bit 양자화 기준)"""
    # 4bit 양자화 시 대략적인 메모리: 7B~2GB, 14B~4GB, 32B~8GB, 72B~18GB
    size_map = {
        "7B": 2, "7.8B": 2, "8B": 2,
        "10.7B": 3, "14B": 4, "22B": 6,
        "30B (3B active)": 1,  # MoE
        "32B": 8, "70B": 18, "72B": 18,
    }

    result = []
    for model_id in get_all_models():
        info = get_model_info(model_id)
        if info:
            size_str = info.get("size", "72B")
            estimated_gb = size_map.get(size_str, 20)
            if estimated_gb <= max_size_gb:
                result.append(model_id)
    return result