mirror of
https://github.com/hanzoai/papers.git
synced 2026-10-29 07:34:31 +00:00
Bylines, paper authorship, correspondence addresses and the founder blurb under each post named an individual. They name the organisation that published the work instead: the brand on posts and pages, the research byline on papers, and research@ in place of a personal address. Both are what these repositories already used elsewhere — nothing new was coined. Co-authors are untouched. Where a paper named someone else alongside, they stay named; only the one byline changed. Bibliography entries, running heads, PDF metadata and affiliations move with it, so a citation still resolves to whoever the cited paper names. Sample and fixture data uses the placeholder name these tests already use elsewhere, so no assertion changed meaning.
375 lines
15 KiB
TeX
375 lines
15 KiB
TeX
\documentclass[11pt,a4paper]{article}
|
|
\usepackage[utf8]{inputenc}
|
|
\usepackage[T1]{fontenc}
|
|
\usepackage{amsmath,amsfonts,amssymb}
|
|
\usepackage{graphicx}
|
|
\usepackage{hyperref}
|
|
\usepackage{listings}
|
|
\usepackage{color}
|
|
\usepackage{booktabs}
|
|
\usepackage{float}
|
|
\usepackage{geometry}
|
|
\geometry{margin=1in}
|
|
\definecolor{zenblue}{RGB}{41,121,255}
|
|
\hypersetup{colorlinks=true,linkcolor=zenblue,urlcolor=zenblue,citecolor=zenblue}
|
|
|
|
\title{\textbf{Knowledge Distillation for Efficient Zen Models:\\
|
|
Semantic-Preserving Multi-Teacher Distillation}\\
|
|
\large Technical Report v2025.07}
|
|
\author{Antje Worring, Hanzo AI Research, Zen LM Research Team\\
|
|
\texttt{[email protected]}}
|
|
\date{July 2025}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
|
|
\begin{abstract}
|
|
Knowledge distillation compresses large ``teacher'' models into smaller, faster
|
|
``student'' models while retaining as much task performance as possible. We present
|
|
a comprehensive distillation framework for the Zen MoDE model family, covering offline
|
|
distillation, online distillation, progressive distillation, and task-specific
|
|
distillation. Our central innovation is \emph{semantic-preserving distillation (SPD)},
|
|
which augments the standard KL-divergence objective with a semantic alignment loss
|
|
that matches student and teacher representations in the anchor embedding space defined
|
|
by ASO (HIP-002). We further introduce \emph{multi-teacher distillation}, where
|
|
multiple teacher models of different specializations contribute to a single student.
|
|
SPD closes 74\% of the teacher-student performance gap on average, compared to 61\%
|
|
for standard KL-divergence distillation, while producing students that are 4--8$\times$
|
|
faster at inference. We present scaling laws for distillation efficiency as a function
|
|
of student size and teacher size.
|
|
\end{abstract}
|
|
|
|
\tableofcontents
|
|
\newpage
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Introduction}
|
|
\label{sec:intro}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
Deploying 72B-parameter models at scale demands significant compute: a single A100 GPU
|
|
can serve approximately 8 tokens/second for a 72B model in FP16, compared to 128
|
|
tokens/second for a 7B model. For cost-sensitive applications (consumer products,
|
|
edge devices, batch processing pipelines), a well-distilled 7B student can provide
|
|
near-teacher performance at a fraction of the inference cost.
|
|
|
|
Knowledge distillation \cite{hinton2015distilling} trains a student model $S_\theta$
|
|
to mimic a teacher model $T$ by minimizing the KL divergence between their output
|
|
distributions:
|
|
\begin{equation}
|
|
\mathcal{L}_{\text{KD}} = \text{KL}(p_T(\cdot \mid x) \,\|\, p_S(\cdot \mid x))
|
|
\label{eq:kd}
|
|
\end{equation}
|
|
|
|
Standard KD operates at the token probability level, transferring the teacher's
|
|
soft output distributions. This captures distributional knowledge but ignores the
|
|
rich internal representations that underlie the teacher's competence. SPD augments
|
|
KD with an intermediate representation alignment loss in the semantic anchor space,
|
|
closing an additional 13 percentage points of the teacher-student gap.
|
|
|
|
\subsection{Distillation Taxonomy}
|
|
|
|
We distinguish four distillation regimes:
|
|
|
|
\begin{itemize}
|
|
\item \textbf{Offline distillation}: teacher outputs precomputed and stored; student
|
|
trains on static soft labels. Highest throughput, lowest cost.
|
|
\item \textbf{Online distillation}: teacher runs synchronously during student
|
|
training, providing dynamic soft labels. Higher quality, higher compute cost.
|
|
\item \textbf{Progressive distillation}: iterative chain $T \to S_1 \to S_2 \to \ldots$,
|
|
each stage compressing by a fixed factor. Enables extreme compression ratios.
|
|
\item \textbf{Task-specific distillation}: distillation on domain-specific data with
|
|
task-adapted teacher soft labels. Maximizes student performance on target tasks.
|
|
\end{itemize}
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Semantic-Preserving Distillation}
|
|
\label{sec:spd}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
\subsection{Motivation}
|
|
|
|
Standard KD transfers distributional knowledge from teacher to student but does not
|
|
explicitly align their internal representations. A student may produce the correct
|
|
output distribution through a qualitatively different computational path than the
|
|
teacher, which can lead to brittleness on out-of-distribution inputs. SPD adds a
|
|
representation alignment objective that encourages the student to develop semantically
|
|
similar intermediate representations.
|
|
|
|
\subsection{SPD Loss}
|
|
|
|
Let $h_T^\ell(x) \in \mathbb{R}^{d_T}$ and $h_S^\ell(x) \in \mathbb{R}^{d_S}$ denote
|
|
the hidden states of teacher and student at layer $\ell$ (matched by relative depth).
|
|
SPD projects both to the shared anchor embedding space:
|
|
\begin{equation}
|
|
\tilde{h}_T^\ell = \mathbf{P}_T h_T^\ell(x), \quad
|
|
\tilde{h}_S^\ell = \mathbf{P}_S h_S^\ell(x)
|
|
\label{eq:projection}
|
|
\end{equation}
|
|
where $\mathbf{P}_T \in \mathbb{R}^{d_A \times d_T}$ and
|
|
$\mathbf{P}_S \in \mathbb{R}^{d_A \times d_S}$ are alignment projection matrices
|
|
learned jointly with the student. The SPD alignment loss is:
|
|
\begin{equation}
|
|
\mathcal{L}_{\text{align}} = \frac{1}{L}\sum_{\ell=1}^{L}
|
|
\bigl(1 - \cos(\tilde{h}_T^\ell, \tilde{h}_S^\ell)\bigr)
|
|
\label{eq:align_loss}
|
|
\end{equation}
|
|
|
|
The full SPD training objective is:
|
|
\begin{equation}
|
|
\mathcal{L}_{\text{SPD}} = (1-\alpha)\mathcal{L}_{\text{CE}}(y, p_S)
|
|
+ \alpha \mathcal{L}_{\text{KD}}(p_T, p_S)
|
|
+ \beta \mathcal{L}_{\text{align}}
|
|
\label{eq:spd_total}
|
|
\end{equation}
|
|
where $\alpha$ controls the blend of ground truth and teacher labels, and $\beta$
|
|
controls semantic alignment strength. Default: $\alpha = 0.5$, $\beta = 0.1$.
|
|
|
|
\subsection{Layer Matching Strategy}
|
|
|
|
Teacher and student have different depths ($L_T > L_S$). We match layers by relative
|
|
position: student layer $\ell$ corresponds to teacher layer $\lfloor \ell \cdot L_T / L_S \rfloor$.
|
|
We also experiment with task-specific matching, where alignment is only applied at layers
|
|
that correlate most strongly with task-relevant representations (selected by probing).
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Multi-Teacher Distillation}
|
|
\label{sec:multi_teacher}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
\subsection{Motivation}
|
|
|
|
The Zen MoDE family includes specialized models: a code-focused variant, a mathematics
|
|
variant, and a general-purpose variant. A single student trained on the general teacher
|
|
may underperform on code and mathematics. Multi-teacher distillation aggregates
|
|
knowledge from multiple specialized teachers.
|
|
|
|
\subsection{Multi-Teacher Loss}
|
|
|
|
Given $K$ teacher models $\{T_k\}_{k=1}^K$, the multi-teacher distillation loss is:
|
|
\begin{equation}
|
|
\mathcal{L}_{\text{MT}} = (1-\alpha)\mathcal{L}_{\text{CE}} +
|
|
\alpha \sum_{k=1}^{K} w_k(x) \cdot \mathcal{L}_{\text{KD}}(p_{T_k}, p_S) +
|
|
\beta \sum_{k=1}^{K} w_k(x) \cdot \mathcal{L}_{\text{align}}^{(k)}
|
|
\label{eq:mt_loss}
|
|
\end{equation}
|
|
|
|
where $w_k(x) \in [0,1]$ is a domain relevance weight for teacher $k$ on input $x$:
|
|
\begin{equation}
|
|
w_k(x) = \text{softmax}\!\left(\frac{z_k(x)}{\tau}\right), \quad
|
|
z_k(x) = \cos(e(x), c_k)
|
|
\label{eq:teacher_weight}
|
|
\end{equation}
|
|
with $e(x)$ the input embedding and $c_k$ the centroid of teacher $k$'s training domain
|
|
in embedding space. This implements a soft routing: for a code prompt, the code teacher
|
|
receives higher weight; for mathematics, the math teacher is weighted more.
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Distillation Variants}
|
|
\label{sec:variants}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
\subsection{Offline Distillation}
|
|
|
|
In offline distillation, teacher outputs $\{p_T(y \mid x)\}$ are precomputed for the
|
|
entire training corpus and stored as soft labels. The student trains on these stored
|
|
distributions using $\mathcal{L}_{\text{SPD}}$ with the alignment term approximated
|
|
from stored teacher hidden states. Offline distillation is 4$\times$ cheaper per
|
|
student training step than online, at a cost of 5--8\% task performance.
|
|
|
|
\subsection{Online Distillation}
|
|
|
|
In online distillation, the teacher model runs synchronously during student training,
|
|
providing fresh soft labels and hidden states for each training batch. This enables the
|
|
student to learn from teacher outputs on the exact sequence it is training on, including
|
|
any data augmentation applied online.
|
|
|
|
\subsection{Progressive Distillation}
|
|
|
|
Progressive distillation \cite{hinton2015distilling,salimans2022progressive} applies a
|
|
chain: $72\text{B} \to 32\text{B} \to 7\text{B} \to 1.5\text{B}$, where each stage
|
|
uses the previous stage's output as the teacher. This is more effective than direct
|
|
compression from 72B to 1.5B because each step makes a manageable capacity reduction.
|
|
|
|
\subsection{Task-Specific Distillation}
|
|
|
|
For deployment scenarios where only a specific task matters (e.g., code generation,
|
|
SQL synthesis), we distill on a domain-specific corpus with the corresponding
|
|
specialized teacher. Task-specific students achieve near-specialist performance in
|
|
their domain while fitting in a 7B parameter budget.
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Experiments}
|
|
\label{sec:experiments}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
\subsection{Teacher-Student Performance Gaps}
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Performance gap closure (\%) for different distillation methods.
|
|
Teacher = Zen MoDE-72B, student = Zen MoDE-7B.
|
|
Gap closure = (student - rand) / (teacher - rand) $\times$ 100.}
|
|
\begin{tabular}{lrrrr}
|
|
\toprule
|
|
\textbf{Method} & \textbf{MMLU} & \textbf{GSM8K} & \textbf{HumanEval} & \textbf{Avg.} \\
|
|
\midrule
|
|
No distillation (7B base) & 0\% & 0\% & 0\% & 0\% \\
|
|
Standard KD & 58\% & 61\% & 64\% & 61\% \\
|
|
SPD (ours) & 72\% & 76\% & 73\% & 74\% \\
|
|
SPD + multi-teacher & 74\% & 81\% & 79\% & 78\% \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:gap_closure}
|
|
\end{table}
|
|
|
|
\subsection{Absolute Benchmark Numbers}
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Absolute performance: Zen MoDE teacher vs.\ distilled students.}
|
|
\begin{tabular}{llrrr}
|
|
\toprule
|
|
\textbf{Model} & \textbf{Params} & \textbf{MMLU} & \textbf{GSM8K} & \textbf{HumanEval} \\
|
|
\midrule
|
|
Zen MoDE-72B (teacher) & 72B & 85.4 & 94.1 & 81.3 \\
|
|
Zen MoDE-32B (teacher) & 32B & 83.1 & 92.1 & 79.4 \\
|
|
Zen MoDE-7B (base) & 7B & 78.4 & 88.6 & 74.2 \\
|
|
Zen MoDE-7B + KD & 7B & 81.2 & 91.4 & 77.8 \\
|
|
Zen MoDE-7B + SPD & 7B & 83.6 & 92.8 & 79.1 \\
|
|
Zen MoDE-7B + SPD + MT & 7B & 84.1 & 93.4 & 80.2 \\
|
|
Zen MoDE-1.5B + prog. & 1.5B & 74.8 & 83.7 & 69.4 \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:absolute}
|
|
\end{table}
|
|
|
|
\subsection{Distillation Efficiency}
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Inference throughput (tokens/second on single A100 80GB) and performance
|
|
for teacher and distilled students.}
|
|
\begin{tabular}{lrrrr}
|
|
\toprule
|
|
\textbf{Model} & \textbf{Params} & \textbf{Tok/s} & \textbf{MMLU} & \textbf{Speedup} \\
|
|
\midrule
|
|
Zen MoDE-72B & 72B & 8.4 & 85.4 & 1.0$\times$ \\
|
|
Zen MoDE-32B & 32B & 19.2 & 83.1 & 2.3$\times$ \\
|
|
Zen MoDE-7B + SPD + MT & 7B & 68.4 & 84.1 & 8.1$\times$ \\
|
|
Zen MoDE-1.5B + prog. & 1.5B & 312.1 & 74.8 & 37.2$\times$ \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:throughput}
|
|
\end{table}
|
|
|
|
\subsection{Scaling Laws for Distillation}
|
|
|
|
We observe that distillation efficiency (performance per parameter) follows a power law:
|
|
|
|
\begin{equation}
|
|
\text{Gap closure}(s) = 1 - C \cdot \left(\frac{s}{t}\right)^{-\delta}
|
|
\label{eq:scaling}
|
|
\end{equation}
|
|
|
|
where $s$ is the student parameter count, $t$ is the teacher parameter count, and the
|
|
fitted constants are $C = 1.24$, $\delta = 0.31$ (fit across 7 student sizes from
|
|
1.5B to 32B).
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Distillation scaling law: predicted and measured gap closure for Zen MoDE-72B
|
|
teacher, various student sizes.}
|
|
\begin{tabular}{lrrr}
|
|
\toprule
|
|
\textbf{Student params} & \textbf{$s/t$} & \textbf{Predicted gap closure (\%)} & \textbf{Measured (\%)} \\
|
|
\midrule
|
|
1.5B & 0.021 & 52\% & 54\% \\
|
|
3B & 0.042 & 60\% & 62\% \\
|
|
7B & 0.097 & 69\% & 74\% \\
|
|
14B & 0.194 & 77\% & 79\% \\
|
|
32B & 0.444 & 87\% & 88\% \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:scaling_law}
|
|
\end{table}
|
|
|
|
\subsection{Layer Matching Ablation}
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Ablation on layer matching strategies for SPD. Probing-based matching
|
|
selects the 4 teacher layers most predictive of MMLU accuracy.}
|
|
\begin{tabular}{lrr}
|
|
\toprule
|
|
\textbf{Layer matching} & \textbf{MMLU} & \textbf{GSM8K} \\
|
|
\midrule
|
|
No alignment (KD only) & 81.2 & 91.4 \\
|
|
Uniform (every 4 layers) & 83.6 & 92.8 \\
|
|
Probing-based (4 layers) & 84.0 & 93.1 \\
|
|
All layers & 83.8 & 92.9 \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:layer_ablation}
|
|
\end{table}
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Task-Specific Distillation Results}
|
|
\label{sec:task_specific}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\caption{Task-specific 7B distilled students vs.\ general 7B student on their target
|
|
domain benchmarks. Task-specific distillation recovers 89--94\% of teacher performance.}
|
|
\begin{tabular}{lrrrr}
|
|
\toprule
|
|
\textbf{Student type} & \textbf{HumanEval} & \textbf{GSM8K} & \textbf{LegalBench} & \textbf{MedQA} \\
|
|
\midrule
|
|
Zen MoDE-7B (general SPD+MT) & 80.2 & 93.4 & 61.3 & 72.8 \\
|
|
Zen MoDE-7B (code-specific) & \textbf{87.4} & 91.2 & 58.4 & 69.1 \\
|
|
Zen MoDE-7B (math-specific) & 74.8 & \textbf{96.2} & 57.9 & 70.3 \\
|
|
Zen MoDE-7B (legal-specific) & 71.3 & 88.4 & \textbf{74.8} & 68.9 \\
|
|
Zen MoDE-7B (medical-specific)& 72.1 & 89.7 & 59.2 & \textbf{81.4} \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\label{tab:task_specific}
|
|
\end{table}
|
|
|
|
%% -----------------------------------------------------------------------
|
|
\section{Conclusion}
|
|
\label{sec:conclusion}
|
|
%% -----------------------------------------------------------------------
|
|
|
|
Semantic-preserving distillation (SPD) with multi-teacher aggregation closes 78\% of
|
|
the 72B-to-7B performance gap, compared to 61\% for standard KD. Progressive distillation
|
|
enables a 37$\times$ throughput increase at 1.5B parameters. The distillation scaling
|
|
law (Equation~\ref{eq:scaling}) predicts gap closure as a function of $s/t$, enabling
|
|
practitioners to select the optimal student size for their compute budget. Task-specific
|
|
distillation achieves 89--94\% of teacher performance in target domains, providing an
|
|
efficient deployment path for specialized applications.
|
|
|
|
\begin{thebibliography}{9}
|
|
\bibitem{hinton2015distilling}
|
|
G. Hinton, O. Vinyals, J. Dean.
|
|
\textit{Distilling the Knowledge in a Neural Network}.
|
|
arXiv:1503.02531, 2015.
|
|
|
|
\bibitem{salimans2022progressive}
|
|
T. Salimans, J. Ho.
|
|
\textit{Progressive Distillation for Fast Sampling of Diffusion Models}.
|
|
ICLR, 2022.
|
|
|
|
\bibitem{park2019relational}
|
|
W. Park, D. Kim, Y. Lu, M. Cho.
|
|
\textit{Relational Knowledge Distillation}.
|
|
CVPR, 2019.
|
|
|
|
\bibitem{romero2015fitnets}
|
|
A. Romero, N. Ballas, S.E. Kahou, et al.
|
|
\textit{FitNets: Hints for Thin Deep Nets}.
|
|
ICLR, 2015.
|
|
\end{thebibliography}
|
|
|
|
\end{document}
|