Fine-Tune gpt-oss for Superior Korean Performance: News and Chat Styles
Unlock peak Korean proficiency in OpenAI's gpt-oss open-weight models by fine-tuning with Korean news style and contemporary chat tones. This bilingual Korean/English guide details efficient BF16/QLoRA workflows, MXFP4 quantization paths, and MoE-aware LoRA setups for optimal results.
이 노트북은 OpenAI의 gpt-oss (open-weight) 모델을 한국 뉴스 문체와 최신 대화 스타일로 세밀하게 조정하는 방법을 한국어/영어 이중 언어로 설명합니다.
This notebook demonstrates fine-tuning OpenAI's gpt-oss (open-weight) models to master Korean news style + modern conversational tone, presented in Korean & English.
MXFP4 workflow clarifications · MXFP4 워크플로 정리
EN:
-
Training or fine-tuning directly in MXFP4 is not supported by public frameworks today.
-
Recommended path: train in BF16 (or QLoRA 4‑bit nf4) → merge LoRA → post‑training quantize to MXFP4 →
save_pretrained()for deployment. -
If you need an MXFP4 artifact, you must re‑quantize from BF16 after merging adapters. (Export utilities are evolving; if your toolchain already supports MXFP4 serialization, that’s ideal.)
KR:
-
현재 공개 프레임워크에서는 MXFP4로 직접 학습/파인튜닝이 지원되지 않습니다.
-
권장 경로: BF16(또는 QLoRA 4‑bit nf4)로 학습 → LoRA 병합 → 사후(MXFP4) 양자화 → 배포용으로
save_pretrained()저장. -
MXFP4 아티팩트가 필요하면, 어댑터 병합 후 BF16 → MXFP4 재양자화가 필요합니다. (직렬화 유틸은 진화 중이며, 툴체인에서 MXFP4 저장을 지원하면 가장 좋습니다.)
LoRA targets (MoE) · LoRA 타깃(MoE 포함)
EN:
-
Minimal config (fast, low VRAM): target attention only, e.g.
["q_proj","v_proj"]. -
MoE‑aware config (better domain adaptation, more VRAM/time): include expert projection layers in addition to attention.
from peft import LoraConfig
TARGET_MODULES = ["q_proj", "v_proj"] # baseline
MOE_TARGET_PARAMETERS = [
# example expert layers; adjust indices to your model depth
"mlp.experts.gate_up_proj",
"mlp.experts.down_proj",
]
lora_cfg = LoraConfig(
r=16, lora_alpha=32, lora_dropout=0.05,
target_modules="all-linear", # cover all linear layers
target_parameters=MOE_TARGET_PARAMETERS, # add expert projections
bias="none", task_type="CAUSAL_LM",
)
- Start with attention‑only; if KR domain fit is insufficient, enable MoE targets and re‑eval.
KR:
-
최소 구성(빠르고 VRAM 절약):
["q_proj","v_proj"]등 어텐션만 적용. -
MoE 인지 구성(도메인 적합성↑, 자원 소모↑): 어텐션에 전문가(Expert) 투영 레이어를 추가로 포함.
-
먼저 어텐션만으로 시도한 뒤, 한국어 도메인 적합성이 부족하면 MoE 타깃을 켜고 재평가하세요.
Comments
More Blog
View allModel Predictive Control Fundamentals: Concepts, Math, and Python Implementation
Discover the essentials of Model Predictive Control (MPC), from its core principles and mathematical foundations to practical Python implementations for dynamic systems control.
Overcoming GPU Limitations: Implementing FP8 Emulation in Software for Legacy Hardware
Discover how to run FP8-optimized AI models on older GPUs without native hardware support using a clever software emulation layer. Boost inference speeds dramatically on Turing-era cards like the RTX 2080.
Hands-On Guide to Hugging Face Transformers: Supercharge Your NLP Projects with AI
Discover how Hugging Face's Transformers library makes advanced NLP accessible. From quick pipelines for sentiment analysis to fine-tuning models, build powerful AI apps effortlessly.
Demystifying Matrix-Matrix Multiplication: Essential Concepts and Practical Insights
Dive deep into matrix-matrix multiplication, from fundamental row-column rules to efficient algorithms like Strassen's, with Python examples and real-world applications in data science.
Demystifying Matrix Transpose: Your Ultimate Guide to A^T and Its Superpowers in Data Science
Dive into the exciting world of matrix transpose! Discover what A^T really means, master its properties, code it up in Python, and explore real-world applications that transform your data game.
Empowering AI Agents to Build Other Agents: A Practical Guide to Meta-Agent Development
Discover how large language models like Claude can generate code for autonomous AI agents, streamlining development and enabling rapid iteration on complex tasks. This approach turns manual coding into an automated, scalable process.