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

GRPO와 Constitutional AI — DPO 너머의 정렬

~14 min · grpo, constitutional-ai, reasoning

Level 0Token
0 XP0/94 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

주목할 만한 더 새로운 정렬 레시피 둘: GRPO(DeepSeek의 추론 모델 레시피)와 Constitutional AI(Anthropic의 안전 레시피).

GRPO (Group Relative Policy Optimization)

OpenAI o1과 경쟁하는 추론 모델 DeepSeek-R1 학습에 사용. 핵심 통찰: reward 모델 통째로 건너뛰고, 룰 기반 reward(수학 답이 맞나? 코드가 테스트 통과하나?) 사용 + 같은 prompt에 대한 그룹 평균과 각 생성 비교.

  1. 현재 policy에서 prompt당 G개 출력 샘플(예: G=16).
  2. 각각을 룰 기반 reward(정답 신호)로 채점.
  3. advantage 계산 — A_i = r_i − (1/G) Σ_j r_j — 그룹 평균보다 얼마나 나은가.
  4. 평균 이상 출력의 확률을 높이도록 policy 업데이트.

critic 모델 불필요. PPO 대비 ~50% 메모리 감소. 정답을 기계적으로 확인할 수 있는 task에 예외적으로 잘 통함 — 수학, 코드, 구조화된 출력.

Constitutional AI (Anthropic)

모든 Claude 모델이 사용. 사람 선호 라벨링 대부분을 작성된 원칙 집합("헌법", 원조 논문에서 ~16개)으로 안내된 AI 피드백으로 대체.

  1. Red-team 후 self-revise. 해로운 prompt 생성 → 모델이 응답 → 모델한테 헌법에 대조해 자기 응답 비판 요청 → 수정. 수정된 응답에 fine-tune.
  2. RLAIF (RL from AI Feedback). RLHF랑 같은데 preference 라벨이 사람이 아니라 AI(헌법 사용)에서 옴. 사람 라벨러가 생산할 수 있는 것 너머로 스케일.

승리: 정렬이 사람 라벨링 노력에 비례해 스케일하지 않으면서 스케일, 원칙이 불투명한 사람 판단에 암묵적으로 있는 게 아니라 작성되고 검사 가능.

Code

GRPO advantage computation·python
def grpo_advantage(rewards):
    # rewards: (G,) — rule-based scores for G generations from same prompt
    mean_r = rewards.mean()
    return rewards - mean_r           # A_i = r_i - group mean
# Then standard policy gradient with these advantages.
# No reward model, no critic, no value head.
Constitutional AI self-critique loop (sketch)·python
def constitutional_revise(model, prompt, constitution):
    response = model(prompt)
    critique_prompt = (
        f"Original prompt: {prompt}\n"
        f"Original response: {response}\n"
        f"Critique this response based on:\n{constitution}"
    )
    critique = model(critique_prompt)
    revise_prompt = (
        f"{critique_prompt}\n"
        f"Critique: {critique}\n"
        f"Now write a revised response addressing the critique."
    )
    return model(revise_prompt)
# Repeat to build a dataset; then SFT or RLAIF on (prompt, revised_response).

External links

Exercise

DeepSeek-R1 논문 읽어. GRPO를 본인 말로 정리 — 뭐가 샘플되고, 뭐가 채점되고, 뭐가 업데이트되나. 그 다음 RLHF, DPO와 3열 표로 비교. 각각 어디서 컴퓨트 절약? 각각 어떤 종류의 task로 학습 가능한지 어떻게 제약?

Progress

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

댓글 0

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

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