Model Distillation

모델 증류는 더 작고 덜 복잡한 모델(학생)이 더 크고 더 복잡한 모델(교사)의 동작을 모방하도록 훈련되는 기술입니다.

모델 증류는 크고, 종종 계산 비용이 많이 드는 모델에서 더 작은 모델로 지식을 전송하는 것을 목표로 합니다. 데이터 세트에서 사전 훈련된 교사 모델은 하드 레이블뿐만 아니라 학생 모델이 학습할 수 있도록 소프트 레이블 또는 확률을 제공합니다. 이를 통해 학생 모델은 교사의 일반화 능력을 포착하고 잠재적으로 더 적은 매개변수와 더 적은 계산 비용으로 유사한 성능을 달성할 수 있습니다. 이 프로세스는 일반적으로 원래 훈련 데이터와 교사의 출력을 결합하여 학생 모델을 훈련하는 것을 포함하며, 종종 학생의 예측이 교사의 예측과 일치하도록 장려하는 손실 함수를 사용합니다.

이 기술은 에지 장치 또는 모바일 애플리케이션과 같이 리소스 제약으로 인해 전체 교사 모델을 배포하는 것이 비실용적인 시나리오에서 특히 유용합니다. 더 빠른 추론과 메모리 공간 감소를 촉진하여 더 큰 모델의 성능을 유지하는 효율적인 모델을 생성할 수 있습니다.

        graph LR
  Center["Model Distillation"]:::main
  Pre_machine_learning["machine-learning"]:::pre --> Center
  click Pre_machine_learning "/terms/machine-learning"
  Pre_neural_network["neural-network"]:::pre --> Center
  click Pre_neural_network "/terms/neural-network"
  Pre_deep_learning["deep-learning"]:::pre --> Center
  click Pre_deep_learning "/terms/deep-learning"
  Rel_llm["llm"]:::related -.-> Center
  click Rel_llm "/terms/llm"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 지식 테스트

1 / 3

🧒 5살도 이해할 수 있게 설명

It's like a master chef teaching an apprentice. The apprentice learns not just the final recipe (the right answer) but also the subtle techniques and reasoning the master uses, so the apprentice can cook almost as well but much faster.

🤓 Expert Deep Dive

Model distillation, also known as knowledge distillation, is a form of model compression that leverages a teacher-student architecture. The objective function for the student model typically takes the form: L_total = α L_hard + (1 - α) L_soft, where L_hard is a standard cross-entropy loss against ground-truth labels, and L_soft is a loss (e.g., KL divergence or cross-entropy) comparing the student's softened outputs to the teacher's softened outputs. The temperature parameter T in the softmax function (softmax(z_i / T)) is crucial; a higher T produces a softer probability distribution, emphasizing inter-class similarities, while T=1 recovers the standard softmax. Variants include distilling intermediate feature representations (feature distillation) or attention maps, rather than just the final output probabilities. This can be particularly effective when the teacher and student architectures differ significantly. Offline distillation involves training the teacher first, then distilling it. Online distillation trains the teacher and student simultaneously. Self-distillation involves using a model of the same architecture as both teacher and student. Challenges include selecting the appropriate distillation loss, tuning the temperature and weighting parameters (α), and the potential for negative transfer if the teacher model is poorly suited or the student capacity is too low. The effectiveness often depends on the similarity between the teacher's learned function and the true underlying data distribution.

🔗 관련 용어

📚 출처