DeepSeek-R1 Distillation Case
마지막 수정:
DeepSeek-R1-Distill은 reasoning distillation을 이해하기 좋은 실제 사례다.
핵심은 큰 teacher의 weight를 작은 모델로 직접 복사한 것이 아니다. 큰 reasoning model이 만든 고품질 풀이 sequence를 데이터셋으로 만들고, 작은 student들을 그 데이터로 SFT한 것이다.
DeepSeek-R1 teacher
-> reasoning responses 생성
-> correctness / format / quality filtering
-> curated distillation dataset
-> Qwen / Llama student SFT
DeepSeek-R1
Large reasoning model generates long CoT-style solutions.
Rejection sampling
Keep correct, clean, well-formatted responses.
804K samples
Math, code, STEM, logic, and general instruction data.
Qwen / Llama
SFT only, no RL stage in the distilled models.
Imitation shortcut
The student learns successful traces without running the full RL exploration loop.
Base matters
A math-specialized or stronger base absorbs reasoning traces more effectively.
Not lossless
The teacher still leads, and small students lose capacity on broad coding tasks.
무엇을 증류했나
DeepSeek-R1 distillation에서 teacher의 핵심 가치는 logits가 아니라 생성된 reasoning trace다.
고전 KD라면 teacher와 student가 같은 입력을 보고, student가 teacher의 softened distribution을 KL로 맞춘다. 하지만 DeepSeek-R1-Distill은 그렇게 하지 않았다.
no temperature scaling
no soft-target KL
no teacher logits during student training
yes teacher-generated reasoning traces
yes rejection-sampled synthetic data
yes standard SFT on student models
즉 이 사례는 앞 카드에서 본 LLM sequence distillation과 reasoning distillation의 결합이다. teacher가 만든 긴 풀이와 final answer가 student의 target sequence가 된다.
데이터가 핵심이다
DeepSeek-R1 distillation의 중요한 부분은 “teacher가 답을 만들었다”가 아니라 “teacher가 만든 답 중 무엇을 남겼는가”다.
로컬 reference와 DeepSeek-R1 paper가 설명하는 흐름은 다음과 같다.
1. prompt마다 teacher가 candidate response를 생성한다.
2. math/code는 final answer나 실행 결과로 correctness를 확인한다.
3. 형식이 나쁘거나 언어가 섞이거나 읽기 어려운 response를 제거한다.
4. 살아남은 response를 distillation target으로 저장한다.
이 과정을 rejection sampling으로 볼 수 있다. student는 teacher의 모든 출력을 배우는 것이 아니라, 검증과 필터링을 통과한 성공 trace만 배운다.
그래서 DeepSeek-R1-Distill의 성능을 “SFT가 강했다”로만 이해하면 부족하다. 더 정확한 해석은 다음이다.
teacher의 RL과 sampling이 좋은 후보를 만든다.
verifier와 quality filter가 나쁜 후보를 제거한다.
student SFT가 남은 성공 패턴을 모방한다.
여섯 개의 student
DeepSeek은 같은 distillation recipe로 여러 student를 만들었다.
Qwen2.5 계열: 1.5B, 7B, 14B, 32B
Llama 계열: 8B, 70B
여기서 중요한 세부사항은 base model 선택이다. 작은 Qwen 1.5B와 7B는 Qwen2.5-Math 기반이라 수학 reasoning을 흡수하기 좋은 출발점을 갖고 있었다. 반면 Llama 계열은 더 일반적인 base에서 출발했다.
이것은 distillation의 중요한 교훈이다.
teacher data만 좋다고 끝나지 않는다.
student base가 이미 무엇을 알고 있는지도 성능을 크게 바꾼다.
같은 teacher trace를 줘도, 수학적 vocabulary와 pattern을 이미 가진 base는 더 잘 흡수할 수 있다.
왜 direct RL보다 강했나
DeepSeek-R1 paper의 강한 메시지 중 하나는 32B student 비교다.
같은 Qwen2.5-32B 계열에서:
direct RL로 reasoning을 발견하려는 모델
vs
R1 teacher trace를 SFT로 모방한 모델
distilled model이 AIME 2024에서 크게 앞섰다. 로컬 reference는 32B distilled model이 AIME 72.6%, RL-only variant가 47.0%라고 정리한다.
이 차이는 “RL이 쓸모없다”는 뜻이 아니다. 오히려 역할 분리가 보인다.
큰 teacher:
충분한 capacity로 RL과 sampling을 통해 reasoning behavior를 발견한다.
작은 student:
그 behavior를 처음부터 탐색하지 않고, 성공 trace를 모방한다.
작은 모델에게 exploration은 어렵다. 긴 reasoning chain을 직접 찾아내려면 많은 sampling, reward, update가 필요하고, capacity가 작으면 반복이나 붕괴에 빠지기 쉽다. distillation은 이 탐색 문제를 모방 문제로 바꾼다.
하지만 무손실 압축은 아니다
DeepSeek-R1-Distill은 강력하지만 한계도 분명하다.
capacity gap:
작은 student는 모든 영역을 똑같이 흡수하지 못한다.
knowledge frontier:
teacher가 못 푸는 문제의 성공 trace는 데이터에 없다.
reproducibility gap:
공개된 모델은 있어도 800K 원본 데이터셋과 필터 세부사항은 완전히 공개되지 않았다.
특히 capacity gap은 benchmark별로 드러난다. 작은 모델은 수학처럼 구조가 비교적 반복되는 영역은 잘 압축하지만, coding처럼 syntax, API, 설계 패턴 공간이 넓은 영역은 더 많은 capacity를 요구한다.
그래서 DeepSeek-R1-Distill의 올바른 결론은 “증류가 RL을 대체한다”가 아니다.
RL은 teacher 쪽에서 frontier behavior를 만든다.
distillation은 그 behavior를 배포 가능한 student로 옮긴다.
이 분업이 DeepSeek-R1 distillation case의 핵심이다.
참고 자료
- DeepSeek-AI, DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning
- DeepSeek-AI, DeepSeek-R1 GitHub repository
- 로컬 참고:
reference-books/deepseek from scratch/ch08-Knowledge-distillation-Making-powerful-models-practical.md - 로컬 참고:
reference-books/deepseek from scratch/ch07-Reinforcement-learning-From-policy-gradients-to-GRPO.md - 로컬 참고:
reference-books/deepseek from scratch/ch01-Introduction-to-DeepSeek.md - 로컬 참고:
reference-books/reasoning-model-from-scratch/ch08-Distilling-reasoning-models-for-efficient-reasoning.md
확인
- DeepSeek-R1-Distill은 teacher logits를 맞춘 사례인가, teacher-generated sequence를 학습한 사례인가?
- rejection sampling이 distillation dataset 품질에 중요한 이유는 무엇인가?
- DeepSeek-R1 사례에서 RL과 distillation은 각각 어떤 역할을 맡는가?