Self-Distillation에서 Feedback Alignment의 역할
The Role of Feedback Alignment in Self-Distillation
TL;DR Highlight
LLM이 스스로를 가르칠 때, 피드백을 모델의 추론 흐름에 단계별로 맞추면 GRPO보다 16점 이상 수학 추론 성능이 오른다.
Who Should Read
LLM 수학 추론 성능을 올리려는 ML 엔지니어, 또는 RLHF/GRPO 대신 더 나은 학습 신호를 찾고 있는 파인튜닝 개발자.
Core Mechanics
- Self-distillation(자기 자신을 교사로 삼아 증류하는 기법)은 같은 모델을 학생(질문만 봄)과 교사(질문 + 추가 컨텍스트를 봄) 두 역할로 나눠서 학습한다. 핵심은 교사에게 어떤 컨텍스트를 줄 것인가다.
- 세 가지 피드백 방식을 비교했다: 이진 보상만 쓰는 GRPO, 참조 풀이(RefSol)를 컨텍스트로 주는 방식, 그리고 학생의 추론 단계에 맞춰 단계별로 피드백을 주는 StepAlignFB.
- StepAlignFB는 Qwen/QwQ-32B(frozen critic)가 학생 풀이의 정답 단계는 그대로 복사하고, 오답 단계만 수정하는 '성실한 서기(faithful scribe)' 방식으로 피드백을 생성한다.
- 참조 풀이(RefSol)를 컨텍스트로 주면, 학생이 맞게 푼 단계에서도 표현 방식이 달라서 거의 모든 토큰에 부정적 gradient가 퍼진다. 오답만 틀렸는데 전체 풀이 방식을 다 바꾸라는 압력이 생기는 셈이다.
- StepAlignFB는 PRM(Process Reward Model, 각 추론 단계마다 보상을 주는 모델)처럼 오류 토큰 근처에만 학습 신호를 집중시킨다. 별도의 PRM 학습이나 단계별 라벨링 없이도 이 효과를 얻는다.
- 정답 단계를 그대로 verbatim 복사하면 induction head(문맥에서 본 패턴을 반복하는 어텐션 메커니즘)가 활성화되어 올바른 추론을 강화하고, 오답 단계는 복사하지 않아 critic의 수정이 그대로 반영된다.
Evidence
- StepAlignFB는 Avg@12 기준 GRPO 대비 +16.11점, RefSol 대비 +5.27점 우위 (각각 35.83 vs 19.72, 35.83 vs 30.56).
- Majority-Vote@12에서 StepAlignFB 56.67 vs RefSol 43.33 vs GRPO 26.67으로, 정답에 확률 질량이 더 집중되는 효과가 확인됨.
- Pass@12(12번 중 한 번이라도 맞출 확률)는 StepAlignFB 90.00, RefSol 86.67, GRPO 76.67로 StepAlignFB가 최고.
- 실험은 Qwen3-1.7B solver, OpenMathReasoning 데이터셋(난이도 필터링 후 282 train / 30 test), 4×H100 GPU, 최대 7 epoch 학습 조건에서 수행.
How to Apply
- 수학/코딩 추론 파인튜닝 파이프라인에서 GRPO를 쓰고 있다면, 강한 모델(예: QwQ-32B)을 frozen critic으로 두고 학생 풀이의 단계별 피드백을 생성하게 한 뒤 self-distillation 컨텍스트로 주면 된다. 핵심은 정답 단계를 그대로 복사하고 오답 단계만 수정하도록 critic 프롬프트를 설계하는 것.
- Critic 프롬프트를 설계할 때 '정답 단계는 학생 표현 그대로 verbatim 복사, 오답 단계는 학생 스타일을 유지하면서 수정'하는 faithful-scribe 규칙을 따르면 된다. 논문의 Appendix A.1에 전체 critic 프롬프트 템플릿이 공개되어 있어 바로 재현 가능하다.
- 참조 풀이만 있는 데이터셋을 쓰는 경우, 참조 풀이를 직접 teacher 컨텍스트로 쓰기보다 강한 모델에게 '학생 풀이와 참조 풀이를 비교해서 단계별 critique 생성'을 시키는 중간 단계를 추가하면 성능이 더 오른다.
Code Example
# StepAlignFB Critic 프롬프트 핵심 구조 (Appendix A.1 기반)
CRITIC_PROMPT = """
You are a math grader producing feedback to a student's solution.
Your default behavior is faithful scribe: when the student's work is correct up to
some point, reproduce that portion. The exceptions:
- In Case D, at the erroneous step only, replace the student's claim with the correct one.
- In Case C, you may compress the student's correct steps because the student ran out of room.
# Decision procedure
Step 1: Classify into ONE case.
- No final answer -> Case C
- Boxed answer doesn't match reference -> Case D
- Boxed answer matches but a non-routine step is unjustified/invalid -> Case B
- Else -> Case A
Step 2: Identify the pivotal step N.
Step 3: Output the matching schema. No preamble, no postamble.
# Hard rules
1. Output ONE schema only.
2. Summary block: one line per student step 'Step <i>: Correct' or 'Step <i>: Incorrect -- <phrase>'.
3. In Cases A, B, D: reproduce correct steps VERBATIM (same notation, same wording).
4. In Case D, at step N ONLY: replace incorrect claim with correct claim in student's style.
Problem: {problem}
Reference answer: {reference_solution}
Student's solution: {student_sol}
"""
# Teacher 프롬프트 (StepAlignFB)
TEACHER_PROMPT = """
Question: {problem}
Expert feedback on a prior attempt at this problem is given below.
The feedback diagnoses where the attempt went wrong (by step number)
and carries the corrected continuation.
Expert feedback:
{expert_critique}
Instructions:
- Produce a fresh, self-contained solution to the original problem.
- Use the feedback only to ensure correctness; do not mention or refer to it.
Let's think step by step and produce a final answer in the format \\boxed{}.
"""
# Self-distillation advantage 계산 (핵심 수식)
# A_SD_t = log π(y_t | x, context, y_<t) - log π(y_t | x, y_<t)
# context가 step-aligned feedback일 때 오답 토큰 근처에서만 크게 음수가 됨Terminology
관련 논문
레이어 하나면 충분한가? 단일 Transformer 레이어 학습이 전체 파라미터 RL 학습과 동등한 성능
LLM의 RL 후처리 학습(post-training)에서 성능 향상의 대부분이 중간 레이어 소수에 집중되며, 단 하나의 레이어만 학습해도 전체 파라미터 학습과 비슷하거나 더 나은 결과를 낼 수 있다는 연구 결과. 이는 RL 학습 비용을 대폭 줄일 수 있는 가능성을 시사한다.
Black-Box LLM에서 지식 증류하기: Proxy-KD 기법 (2024)
GPT-4 같은 내부 구조에 접근할 수 없는 독점 LLM에서 작은 모델로 지식을 효과적으로 전달하는 Proxy-KD 기법을 소개하는 논문으로, 전통적인 White-Box 방식보다 성능이 높다는 점에서 주목할 만하다.
NanoEuler – 순수 C/CUDA로 처음부터 만든 GPT-2 규모 언어 모델
PyTorch나 autograd 없이 C와 CUDA만으로 GPT-2 수준의 LLM을 처음부터 구현한 교육용 프로젝트로, 역전파·BPE 토크나이저·FlashAttention까지 직접 손으로 작성했다.
Neural Particle Automata: 자기조직화 파티클 시스템을 학습하는 신경망 모델
고정된 격자 대신 움직이는 파티클 위에서 동작하는 Neural Cellular Automata의 확장 버전으로, 형태 생성·포인트 클라우드 분류·텍스처 합성 등 다양한 작업에서 자기조직화 동작을 학습할 수 있다.
PyTorch Training Loop 완전 해부: 각 줄이 하는 일과 순서를 바꾸면 생기는 문제
PyTorch 학습 루프의 각 코드 줄이 왜 그 위치에 있어야 하는지, 순서를 바꾸거나 빠뜨렸을 때 어떤 문제가 생기는지를 단계별로 설명한 심층 가이드다.
좋은 Verifier도 망가질 수 있다: Self-Improving VLM이 새로운 태스크에서 오히려 퇴보하는 현상
VLM 자가학습 루프에서 verifier가 특정 태스크에 맞지 않으면 학습할수록 오히려 성능이 떨어지는데, DPO 손실값은 멀쩡히 내려가서 눈치채기도 어렵다.
Related Resources
Original Abstract (Expand)
Conditioning a language model on additional context, such as feedback on a previous attempt, typically improves its response. Self-distillation trains the model to retain this improvement when the context is not present. The method works by matching the model's output distribution under two settings: a student that sees only the question, and a self-teacher that also sees the context. What the model learns therefore depends on what context the self-teacher receives, yet the design of this context remains largely unexplored. We study context design for self-distillation by training a solver on feedback from a frozen critic. We compare three conditions: (i) a binary reward (GRPO), (ii) the reference solution, and (iii) a step-by-step critique aligned to the solver's reasoning trace. Step-aligned critique yields the largest gains, outperforming GRPO by 16.11 points and reference-solution-conditioned self-distillation by 5.27 points (Avg@12). Per-token advantage analysis reveals why: step-aligned feedback targets only the tokens where reasoning fails, leaving correct behavior intact. Conditioning on the reference solution, by contrast, pressures the model to change its behavior at every token (even correct steps) because an alternative derivation inevitably differs in phrasing and approach. This suggests that structural alignment between feedback and the solver's reasoning is a key driver of self-distillation effectiveness.