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

Fine-Tuning vs Prompting vs Feature Extraction

~16 min · adaptation, tradeoffs

Level 0Curious
0 XP0/73 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

비용 순서의 3 adaptation strategy

  1. Prompting — natural language 로 task describe. Zero training cost, fast iteration, 많은 task 에 surprisingly 잘 작동. Prompt context length 와 prompt-engineering ceiling 으로 제한.
  2. Feature extraction — pretrained encoder 로 data embed, embedding 위 small classical head (linear, MLP, gradient boosting) train. Backbone training 없음. Cheap, scalable.
  3. Fine-tuning — backbone 실제 update (full 또는 LoRA) 본인 task 에. Highest ceiling, biggest engineering investment, most overfitting risk.
팁: 이 순서로 시도하고 accuracy bar 만족하는 첫 번째에서 stop. 대부분 production 팀이 prompting + few example 이 long tail 처리한다는 거 발견, fine-tuning 은 진짜 필요한 case 에 reserve.

각각이 이길 때

  • Prompting 이김 — task 가 model training distribution 안 (general reasoning, common writing task, popular language code completion).
  • Feature extraction 이김 — scale 에 fast inference 필요, 관련 신호가 이미 pretrained embedding 에 capture.
  • Fine-tuning 이김 — model 이 specific style, domain, format 에 consistently 행동 필요 + 수백~수천 labeled example 있음.

3 가지 다 자주 이기는 hybrid

RAG (prompting + retrieved context) + few-shot example + 위 small reranker 가 knowledge-intensive task 에 fine-tuning 자주 이김. Infrastructure 더 complex 한데 task 당 adaptation 비용 낮게 유지.

원칙: Adaptation 비용이 accuracy 만큼 중요. CPU 에 deploy 가능한 frozen-backbone classifier 가 request 당 GPU 필요한 fully fine-tuned 7B model 자주 이김. Model 만 아니라 whole pipeline engineer.

Code

Feature extraction with a sentence-transformer·python
from sentence_transformers import SentenceTransformer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import f1_score

# 1. Frozen pretrained encoder
encoder = SentenceTransformer("all-MiniLM-L6-v2")

# 2. Embed your text
X_train_emb = encoder.encode(X_train_texts, normalize_embeddings=True)
X_val_emb   = encoder.encode(X_val_texts,   normalize_embeddings=True)

# 3. Cheap classical head
clf = LogisticRegression(max_iter=1000).fit(X_train_emb, y_train)
preds = clf.predict(X_val_emb)
print(f"f1: {f1_score(y_val, preds, average='macro'):.3f}")
# This baseline often beats hopeful fine-tuning attempts on small datasets.

External links

Exercise

Text classification task 골라. 3 approach 비교: (1) zero-shot LLM prompting, (2) feature extraction + logistic regression, (3) LoRA fine-tuning. Accuracy, training time, inference latency 추적. Accuracy bar 만족하는 가장 싼 method 이김.

Progress

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

댓글 0

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

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