0Pricing
AI Engineering Academy · 강의

LLMs는 어떻게 학습되는가

방대한 말뭉치로 사전 학습하기, 지도 미세 조정, RLHF 등 LLM 학습 단계를 배우고, 각 단계가 모델의 동작에 중요한 이유를 알아봅니다.

LLMs는 어떻게 학습되는가은(는) CoddyKit의 무료 AI Engineering Academy 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Engineering Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Engineering Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Three Stages of LLM Training

LLMs are built in three stages: pre-training teaches language and knowledge, fine-tuning teaches instruction-following, and RLHF aligns the model with what people want.

Pre-Training: Next Token Prediction at Scale

Pre-training feeds the model tons of text with one job: predict the next token. That simple goal is enough to teach grammar, facts, and reasoning along the way.

Training Data Quality and Curation

Raw internet text is messy. Teams clean it with data pipelines that filter, deduplicate, and score quality. The rule of thumb: better data beats a bigger model.

The Loss Function and Optimization

Training minimizes cross-entropy loss — how far the model's guess is from the right next token. Tiny weight nudges, repeated billions of times. The code shows the math.

# Illustrative cross-entropy loss for a single token prediction
import math

vocab_size = 50000
correct_token_index = 4217  # index for the word 'Paris'

# Model output probabilities (softmax of logits)
model_probs = [0.00002] * vocab_size  # simplified uniform base
model_probs[correct_token_index] = 0.70  # model is 70% confident in 'Paris'

loss = -math.log(model_probs[correct_token_index])
print(f'Cross-entropy loss: {loss:.4f}')  # ~0.3567

Emergent Capabilities from Scale

At enough scale, new emergent capabilities appear — like step-by-step reasoning — that small models simply don't have. Nobody trained them in directly; scale brought them.

Supervised Fine-Tuning on Instruction Pairs

A raw model just continues text. Supervised fine-tuning trains it on (instruction, ideal answer) pairs, so it learns to actually answer instead of rambling on.

# Illustrative SFT data format
training_example = {
    'messages': [
        {'role': 'system', 'content': 'You are a helpful assistant.'},
        {'role': 'user', 'content': 'What is the capital of France?'},
        {'role': 'assistant', 'content': 'The capital of France is Paris.'}
    ]
}
# During SFT, loss is computed only on the assistant turn tokens
# The system and user tokens are provided as context but not trained on

RLHF Phase 1: Training the Reward Model

RLHF starts with a reward model. People pick the better of two answers, and the reward model learns to predict those preferences — a stand-in for human taste.

RLHF Phase 2: PPO Fine-Tuning

Next, PPO tunes the LLM to score higher on the reward model. A KL penalty keeps it from drifting weird and gaming the reward instead of truly helping.

Direct Preference Optimization: Simpler RLHF

PPO is complex. DPO is a simpler alternative: it trains the model straight from preferred-vs-rejected answer pairs — no separate reward model needed.

Chinchilla Scaling Laws: Compute-Optimal Training

The Chinchilla finding: older models were undertrained. For a given budget, scale data and size together — roughly 20 tokens per parameter for the best results.

What Each Training Stage Affects

Each stage controls something: pre-training sets what it knows, fine-tuning sets how it behaves, and RLHF sets its values. That tells you which part to fix.

Quick Check

Test your understanding of AI Engineering concepts from this lesson.

Lesson Recap

Recap: pre-training builds knowledge, fine-tuning builds instruction-following, and RLHF or DPO aligns the model with human values. Next: what LLMs can and can't do. 💡

자주 묻는 질문

“LLMs는 어떻게 학습되는가” 강의는 무료인가요?

네 — “LLMs는 어떻게 학습되는가” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Engineering Academy 강의 전체를 잠금 해제할 수 있습니다. AI Engineering Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

“LLMs는 어떻게 학습되는가”에서 뭘 배우나요?

방대한 말뭉치로 사전 학습하기, 지도 미세 조정, RLHF 등 LLM 학습 단계를 배우고, 각 단계가 모델의 동작에 중요한 이유를 알아봅니다. 브라우저에서 직접 실행하는 실습 코드로 AI Engineering Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

AI Engineering Academy을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 AI Engineering Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.

“LLMs는 어떻게 학습되는가” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 AI Engineering Academy 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 AI Engineering Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 자동 완성에서 ChatGPT까지
  2. 트랜스포머와 어텐션을 쉬운 말로 이해하기
  3. LLMs는 어떻게 학습되는가
  4. LLMs의 능력과 한계
← AI Engineering Academy(으)로 돌아가기