production model 더 작고 빠르게 만드는 세 더 기법
Pruning
Pruning 이 중요하지 않다고 판단된 weight 를 zero (크기 또는 structured rule). 두 맛:
- Unstructured — 개별 weight zero. 이론적으로 flops 감소하지만 대부분 hardware 가 sparse matmul 안 가속, 그래서 실용 win 작음.
- Structured — 전체 channel / head / block 제거. parameter 더 적음 AND flops 더 적음 AND activation 더 작음. 실용 win 있는 곳.
Pruning + quantization 잘 결합. Pruning + distillation (pruned teacher 에서 더 작은 student train) 더 잘 결합.
Knowledge distillation
큰 'teacher' model 의 soft prediction 일치하게 작은 'student' model train. student 가 hard label 아니라 teacher 의 logit 에서 학습 — 더 많은 정보 운반 ('이건 대부분 cat 이지만 살짝 fox'). 표준 recipe:
- teacher 를 input 에 돌리기 — soft logit 받기.
- student 를 input 에 돌리기 — 자기 logit 받기.
- Loss = α · KL(student / T || teacher / T) · T² + (1 − α) · CE(student, hard_label)
여기서 T 가 'temperature' (보통 2-8) 가 distribution 둘 다 부드럽게, α 가 soft vs hard target weight.
Benchmarking — 너 정직한 성적표
모든 최적화 주장이 benchmark 받을 자격. 실제 deploy batch size 에, 실제 hardware 에, 실제 input distribution 으로 latency 측정. 일화적 speedup 이 production 접촉에 안 살아남음.