﻿# DeiT distilled inference: a teacher-named class still runs the student heads

Interpret DeiT classification and distillation logits without assuming that a live teacher network is required for every inference request.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-deit-distillation-two-head-inference/
Language: en

## Separate training supervision from deployed computation

DeiT introduced distillation through attention to improve data-efficient image transformer training. The [paper](https://arxiv.org/abs/2012.12877) describes a teacher's role during learning. That role does not automatically require deploying the teacher beside the trained student for every image request. Distinguish the procedure that produced the weights from the forward computation exported in the selected distilled checkpoint before estimating runtime dependencies or building a serving container.

## Inspect the heads actually returned

The [Transformers DeiT interface](https://huggingface.co/docs/transformers/model_doc/deit) documents a classification head and a distillation head for the teacher-named inference class. It also describes the combined logits as their average. Read these fields according to the installed implementation rather than inferring behavior from a class name alone. Selecting only a convenient head can change the prediction rule used in the reported result, even when all underlying checkpoint parameters load successfully.

## Match distilled and nondistilled artifacts correctly

The [official DeiT repository](https://github.com/facebookresearch/deit) provides distinct model variants and inference implementations. Keep the artifact's architecture, tokens and head parameters together. A nondistilled classifier wrapper does not become equivalent to the distilled variant merely by accepting most shared weight names. Review missing or unexpected parameters during conversion, and compare a representative output before describing a loosely loaded state dictionary as a faithful export of the released model.

## Check the chosen prediction rule

For a small image set, inspect the individual head outputs and the documented combination. Include cases where the heads disagree, since identical winners can conceal a changed aggregation rule. Keep class mapping and preprocessing fixed. Evaluate the final retained prediction using the actual application metric, while preserving head-level evidence for diagnosis. An average of logits is also a specific operation, not an arbitrary interchange with averaging any later display probabilities.

## Report deployment requirements from evidence

Describe which checkpoint and inference class ran, how its heads were combined and whether any additional model was actually invoked. Do not inflate GPU requirements by assuming the original training teacher remains active. The guides to [distillation targets](/journal/distillation-soft-target-distribution/) and [image patches](/journal/vit-image-patches-token-sequence/) explain related concepts. DeiT's distinctive boundary is the trained student's inference contract: historical teacher supervision and a live runtime dependency are separate facts that must not be inferred from naming alone.
