C.W.K.
Stream
Lesson 05 of 05 · published

흔한 실패 & 디버깅

~22 min · debugging, failures, gotchas, troubleshooting

Level 0관찰자
0 XP0/43 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

Top-10 파인튜닝 실패 (와 fix)

#증상가능한 원인Fix
1모델이 헛소리 출력잘못된 chat template 또는 토크나이저 불일치매칭하는 토크나이저 사용; 학습/추론 chat template 동일 검증.
2측정 가능한 개선 없음예제 너무 적거나 데이터 품질 낮음500+ 예제; 처음 50개 다 리뷰.
3Validation loss 일찍 상승Epoch 너무 많거나 데이터셋 너무 작음Epoch 줄여, dropout 늘려, 다양한 데이터 추가.
4일반 능력 잃음 (forgetting)Full FT의 catastrophic forgetting대신 LoRA 써; learning rate 낮춰.
5출력 포맷 일관성 없음학습 데이터 포맷 일관성 없음학습 전 모든 예제 한 포맷으로 표준화.
6Loss 전혀 감소 XLR 너무 낮거나 데이터 포맷 잘못LR 올려; 데이터가 변경 없이 모델에 도달하는지 검증.
7OOM (메모리 부족)모델 또는 배치가 GPU에 비해 큼QLoRA 써; batch 줄여; gradient checkpointing 활성화.
8학습 느림Flash Attention 없음, bf16 없음Flash Attention 2 + bf16 활성화.
9FT 후 모델이 더 환각학습 데이터에 에러 또는 환각 포함데이터 audit; 검증 못 하는 거 다 제거.
10Eval에선 작동, 실서비스에선 실패Eval 데이터가 학습이랑 너무 비슷실서비스 derived 테스트 셋 구축; eval에 학습 분포 절대 재사용 X.

Code

Three-step debug protocol when something looks wrong·python
# 1. Manually inspect 5 random training examples
import json, random
with open("train.jsonl") as f:
    examples = [json.loads(line) for line in f]
for ex in random.sample(examples, 5):
    for m in ex["messages"]:
        print(f"[{m['role']}] {m['content'][:240]}")
    print("---")

# 2. Verify the tokenized output looks correct
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
for ex in random.sample(examples, 1):
    formatted = tok.apply_chat_template(ex["messages"], tokenize=False)
    print("=== formatted ===")
    print(formatted[:1000])
    tokens = tok(formatted)["input_ids"]
    print(f"=== token count: {len(tokens)} ===")

# 3. Run a tiny training run (10 examples, 1 epoch) to verify pipeline
# If THAT crashes, the pipeline is broken, not the data scale.

External links

Exercise

네 자신의 파인튜닝 경험(또는 공공 W&B 실패 리포트 읽어서)에서 top-10 실패 각각의 실제 사례 하나씩 찾아. 근본 원인이랑 fix를 네 말로 문서화. 이게 팀의 디버깅 quick-reference 돼.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.