C.W.K.
Stream
Lesson 01 of 06 · published

파라미터 문제

~18 min · full-fine-tuning, vram, memory

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

Full 파인튜닝이 비현실적인 이유

7B 파라미터 모델 = 70억 개 부동소수점. Full 파인튜닝은 이 다 저장해야 해 —

  • 모델 가중치(7B × fp16 2바이트 = 14 GB)
  • Gradient(또 14 GB)
  • 옵티마이저 상태(Adam은 파라미터당 2상태 = 28 GB)
  • 플러스 activation, 배치 데이터, 프레임워크 오버헤드...

~60~80 GB VRAM이 7B 모델 하나에. 70B 모델은 600+ GB — A100 여러 장.

모델 크기Full FT VRAM (fp16)필요 GPU
1B~12 GBRTX 3090 / 4090
7B~60 GBA100 80 GB
13B~120 GB2× A100 80 GB
70B~600 GB8× A100 80 GB

여기서 Parameter-Efficient Fine-Tuning (PEFT)이 등장. 70억 개 다 업데이트 안 하고 추가된 작은 subset — 보통 1% 미만 — 만 업데이트, 나머진 freeze.

Code

Count trainable params before vs after PEFT·python
from transformers import AutoModelForCausalLM
from peft import LoraConfig, get_peft_model

base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
total = sum(p.numel() for p in base.parameters())
print(f"Base trainable: {total:,}")

config = LoraConfig(r=16, lora_alpha=32,
                    target_modules="all-linear", task_type="CAUSAL_LM")
lora_model = get_peft_model(base, config)
lora_model.print_trainable_parameters()
# trainable params: ~13M || all params: ~8B || trainable%: 0.17%

External links

Exercise

관심 있는 모델 크기 골라(1B, 7B, 13B, 70B). Full-FT VRAM, LoRA VRAM, QLoRA VRAM 계산(QLoRA 숫자는 lesson 4). 실제 대여 가능한 GPU랑 비교 — 어느 메서드가 너한테 가능?

Progress

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

댓글 0

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

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