Image Classification
timm
PyTorch
vision-transformer
knowledge-distillation
feature-distillation
model-compression
interpretability
explainability
representation-analysis
encoding-mismatch
spectral-energy-pattern
spectral-kd
low-rank
pca
svd
deit-tiny
distilled-deit-tiny
cait-s24
lift
widelast
icml-2026
Eval Results (legacy)
Instructions to use Huiyuancs/Encoding_Mismatch with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use Huiyuancs/Encoding_Mismatch with timm:
import timm model = timm.create_model("hf_hub:Huiyuancs/Encoding_Mismatch", pretrained=True) - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,306 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: timm
|
| 4 |
+
pipeline_tag: image-classification
|
| 5 |
+
datasets:
|
| 6 |
+
- ILSVRC/imagenet-1k
|
| 7 |
+
metrics:
|
| 8 |
+
- accuracy
|
| 9 |
+
tags:
|
| 10 |
+
- vision-transformer
|
| 11 |
+
- image-classification
|
| 12 |
+
- knowledge-distillation
|
| 13 |
+
- feature-distillation
|
| 14 |
+
- model-compression
|
| 15 |
+
- interpretability
|
| 16 |
+
- explainability
|
| 17 |
+
- representation-analysis
|
| 18 |
+
- encoding-mismatch
|
| 19 |
+
- spectral-energy-pattern
|
| 20 |
+
- spectral-kd
|
| 21 |
+
- low-rank
|
| 22 |
+
- pca
|
| 23 |
+
- svd
|
| 24 |
+
- deit-tiny
|
| 25 |
+
- distilled-deit-tiny
|
| 26 |
+
- cait-s24
|
| 27 |
+
- lift
|
| 28 |
+
- widelast
|
| 29 |
+
- pytorch
|
| 30 |
+
- timm
|
| 31 |
+
- icml-2026
|
| 32 |
+
- arxiv:2511.15572
|
| 33 |
+
model-index:
|
| 34 |
+
- name: Lift
|
| 35 |
+
results:
|
| 36 |
+
- task:
|
| 37 |
+
type: image-classification
|
| 38 |
+
name: Image Classification
|
| 39 |
+
dataset:
|
| 40 |
+
type: ILSVRC/imagenet-1k
|
| 41 |
+
name: ImageNet-1K
|
| 42 |
+
split: validation
|
| 43 |
+
metrics:
|
| 44 |
+
- type: accuracy
|
| 45 |
+
name: Top-1 Accuracy (%)
|
| 46 |
+
value: 77.53
|
| 47 |
+
source:
|
| 48 |
+
name: ICML 2026 paper, Table 2
|
| 49 |
+
url: https://arxiv.org/abs/2511.15572
|
| 50 |
+
- name: WideLast
|
| 51 |
+
results:
|
| 52 |
+
- task:
|
| 53 |
+
type: image-classification
|
| 54 |
+
name: Image Classification
|
| 55 |
+
dataset:
|
| 56 |
+
type: ILSVRC/imagenet-1k
|
| 57 |
+
name: ImageNet-1K
|
| 58 |
+
split: validation
|
| 59 |
+
metrics:
|
| 60 |
+
- type: accuracy
|
| 61 |
+
name: Top-1 Accuracy (%)
|
| 62 |
+
value: 78.23
|
| 63 |
+
source:
|
| 64 |
+
name: ICML 2026 paper, Table 2
|
| 65 |
+
url: https://arxiv.org/abs/2511.15572
|
| 66 |
---
|
| 67 |
|
| 68 |
+
# From Per-Image Low-Rank to Encoding Mismatch
|
| 69 |
+
|
| 70 |
+
This repository releases the **Lift** and **WideLast** checkpoints from the ICML 2026 paper:
|
| 71 |
+
|
| 72 |
+
> **From Per-Image Low-Rank to Encoding Mismatch: Rethinking Feature Distillation in Vision Transformers**
|
| 73 |
+
> Huiyuan Tian, Bonan Xu, and Shijian Li
|
| 74 |
+
|
| 75 |
+
The paper studies why feature distillation between heterogeneous Vision Transformers can remain difficult even when individual feature maps are strongly low-rank. Its analysis distinguishes:
|
| 76 |
+
|
| 77 |
+
- **Per-image low-rank structure**, measured by sample-wise singular value decomposition (SVD).
|
| 78 |
+
- **Dataset-level representational structure**, measured by PCA over features from many images.
|
| 79 |
+
- **Spectral Energy Patterns (SEP)**, which characterize how feature energy is distributed across channels.
|
| 80 |
+
|
| 81 |
+
The central finding is an **encoding mismatch**: compact students and wider teachers can encode dataset-level information using substantially different channel-space geometries. Two simple architecture modifications reduce this mismatch:
|
| 82 |
+
|
| 83 |
+
- **Lift** retains a linear endpoint projector that lifts the student's final representation from 192 to 384 channels.
|
| 84 |
+
- **WideLast** widens only the last transformer block from 192 to 384 channels.
|
| 85 |
+
|
| 86 |
+
## Links
|
| 87 |
+
|
| 88 |
+
- [Paper on arXiv](https://arxiv.org/abs/2511.15572)
|
| 89 |
+
- [Paper on OpenReview](https://openreview.net/forum?id=2Ud1nkQrVZ)
|
| 90 |
+
- [Official code, analysis scripts, raw numeric data, and training recipes](https://github.com/thy960112/From-Per-Image-Low-Rank-to-Encoding-Mismatch)
|
| 91 |
+
- [ICML 2026 poster](https://huggingface.co/Huiyuancs/Encoding_Mismatch/blob/main/icml_poster.pdf)
|
| 92 |
+
|
| 93 |
+
## Released Checkpoints
|
| 94 |
+
|
| 95 |
+
| Checkpoint | File | Architecture | Distillation recipe | ImageNet-1K top-1 |
|
| 96 |
+
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------- | ----------------: |
|
| 97 |
+
| Lift | [`models/Lift/pytorch_model.pth`](https://huggingface.co/Huiyuancs/Encoding_Mismatch/blob/main/models/Lift/pytorch_model.pth) | DeiT-Tiny-derived student with a retained 192β384 endpoint projector | SoftKD + SpectralKD, CaiT-S24 teacher | **77.53%** |
|
| 98 |
+
| WideLast | [`models/WideLast/pytorch_model.pth`](https://huggingface.co/Huiyuancs/Encoding_Mismatch/blob/main/models/WideLast/pytorch_model.pth) | DeiT-Tiny-derived student with blocks 1β11 at 192 dimensions and block 12 at 384 dimensions | SoftKD + MSE, CaiT-S24 teacher | **78.23%** |
|
| 99 |
+
|
| 100 |
+
The reported baseline distilled DeiT-Tiny accuracy is **74.86%** under the paper's experimental protocol.
|
| 101 |
+
|
| 102 |
+
## Model Details
|
| 103 |
+
|
| 104 |
+
### Shared setting
|
| 105 |
+
|
| 106 |
+
- **Task:** ImageNet-1K image classification
|
| 107 |
+
- **Input resolution:** 224 Γ 224
|
| 108 |
+
- **Student family:** DeiT-Tiny-derived Vision Transformer
|
| 109 |
+
- **Teacher:** CaiT-S24
|
| 110 |
+
- **Framework:** PyTorch and `timm`
|
| 111 |
+
- **Training duration:** 300 epochs
|
| 112 |
+
- **Primary metric:** ImageNet-1K validation top-1 accuracy
|
| 113 |
+
|
| 114 |
+
These models use custom architectures and checkpoint-loading code from the accompanying GitHub repository. They are **not** packaged as `transformers.AutoModel` checkpoints and are not expected to run directly through the Hugging Face hosted inference widget.
|
| 115 |
+
|
| 116 |
+
### Lift
|
| 117 |
+
|
| 118 |
+
Lift preserves the standard 192-dimensional DeiT-Tiny transformer blocks and adds a learned linear projection at the student endpoint:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
\mathbb{R}^{192} \rightarrow \mathbb{R}^{384}.
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
Unlike a training-only projector, this layer is retained at inference. The released Lift checkpoint corresponds to the **SoftKD + SpectralKD** result reported in Table 2 of the paper.
|
| 125 |
+
|
| 126 |
+
### WideLast
|
| 127 |
+
|
| 128 |
+
WideLast keeps the first eleven transformer blocks at 192 channels and widens only the final block to 384 channels. The final block uses six attention heads, while the preceding 192-dimensional blocks use three heads. The released WideLast checkpoint corresponds to the **SoftKD + MSE** result reported in Table 2.
|
| 129 |
+
|
| 130 |
+
## Evaluation Results
|
| 131 |
+
|
| 132 |
+
### Main ImageNet-1K results
|
| 133 |
+
|
| 134 |
+
| Student | Distillation objective | Top-1 accuracy |
|
| 135 |
+
| ---------------------------- | ----------------------- | -------------: |
|
| 136 |
+
| Distilled DeiT-Tiny baseline | Original baseline | 74.86% |
|
| 137 |
+
| Lift | SoftKD | 77.23% |
|
| 138 |
+
| Lift | SoftKD + MSE | 77.50% |
|
| 139 |
+
| **Lift** | **SoftKD + SpectralKD** | **77.53%** |
|
| 140 |
+
| WideLast | SoftKD | 77.88% |
|
| 141 |
+
| WideLast | SoftKD + SpectralKD | 78.16% |
|
| 142 |
+
| **WideLast** | **SoftKD + MSE** | **78.23%** |
|
| 143 |
+
|
| 144 |
+
### Inference cost
|
| 145 |
+
|
| 146 |
+
| Model | Parameters | Change vs. baseline | FLOPs | Change vs. baseline |
|
| 147 |
+
| ---------------------------- | ---------: | ------------------: | -----: | ------------------: |
|
| 148 |
+
| Distilled DeiT-Tiny baseline | 5,717,416 | β | 2.507G | β |
|
| 149 |
+
| Lift | 5,983,528 | +4.65% | 2.536G | +1.17% |
|
| 150 |
+
| WideLast | 7,239,016 | +26.61% | 3.089G | +23.20% |
|
| 151 |
+
|
| 152 |
+
Results are taken from the paper. Reproduction can vary with software versions, distributed-training configuration, data access, and numerical nondeterminism.
|
| 153 |
+
|
| 154 |
+
## Installation
|
| 155 |
+
|
| 156 |
+
Clone the implementation repository and install its dependencies:
|
| 157 |
+
|
| 158 |
+
```bash
|
| 159 |
+
git clone https://github.com/thy960112/From-Per-Image-Low-Rank-to-Encoding-Mismatch.git
|
| 160 |
+
cd From-Per-Image-Low-Rank-to-Encoding-Mismatch
|
| 161 |
+
|
| 162 |
+
conda create -n encoding-mismatch python=3.10 -y
|
| 163 |
+
conda activate encoding-mismatch
|
| 164 |
+
pip install -r requirements.txt
|
| 165 |
+
pip install huggingface_hub
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
Download this Hugging Face repository:
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
from huggingface_hub import snapshot_download
|
| 172 |
+
|
| 173 |
+
snapshot_download(
|
| 174 |
+
repo_id="Huiyuancs/Encoding_Mismatch",
|
| 175 |
+
local_dir="./Encoding_Mismatch",
|
| 176 |
+
)
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
Expected checkpoint paths:
|
| 180 |
+
|
| 181 |
+
```text
|
| 182 |
+
Encoding_Mismatch/
|
| 183 |
+
βββ models/
|
| 184 |
+
βββ Lift/
|
| 185 |
+
β βββ pytorch_model.pth
|
| 186 |
+
βββ WideLast/
|
| 187 |
+
βββ pytorch_model.pth
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
## Data Preparation
|
| 191 |
+
|
| 192 |
+
The evaluation and training scripts expect ImageNet-1K in the standard `ImageFolder` layout:
|
| 193 |
+
|
| 194 |
+
```text
|
| 195 |
+
/path/to/ILSVRC/
|
| 196 |
+
βββ train/
|
| 197 |
+
βββ val/
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
ImageNet is not redistributed with this repository. Users must obtain it under the dataset's applicable terms.
|
| 201 |
+
|
| 202 |
+
## Evaluate the Released Checkpoints
|
| 203 |
+
|
| 204 |
+
Run these commands from the cloned GitHub repository.
|
| 205 |
+
|
| 206 |
+
### Lift
|
| 207 |
+
|
| 208 |
+
```bash
|
| 209 |
+
cd training/lift
|
| 210 |
+
|
| 211 |
+
python main.py \
|
| 212 |
+
--eval \
|
| 213 |
+
--resume /absolute/path/to/Encoding_Mismatch/models/Lift/pytorch_model.pth \
|
| 214 |
+
--data-path /path/to/ILSVRC \
|
| 215 |
+
--model deit_tiny_patch16_224 \
|
| 216 |
+
--batch-size 256 \
|
| 217 |
+
--num_workers 8 \
|
| 218 |
+
--use-modified-student \
|
| 219 |
+
--expansion-start-layer 11 \
|
| 220 |
+
--expansion-type step \
|
| 221 |
+
--expansion-use-ln \
|
| 222 |
+
--expansion-target-dim 384
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
### WideLast
|
| 226 |
+
|
| 227 |
+
```bash
|
| 228 |
+
cd training/widelast
|
| 229 |
+
|
| 230 |
+
python main.py \
|
| 231 |
+
--eval \
|
| 232 |
+
--resume /absolute/path/to/Encoding_Mismatch/models/WideLast/pytorch_model.pth \
|
| 233 |
+
--data-path /path/to/ILSVRC \
|
| 234 |
+
--model deit_tiny_patch16_224 \
|
| 235 |
+
--batch-size 256 \
|
| 236 |
+
--num_workers 8 \
|
| 237 |
+
--custom-arch \
|
| 238 |
+
--arch-schedule heads_step
|
| 239 |
+
```
|
| 240 |
+
|
| 241 |
+
The repository's evaluation code expects a PyTorch checkpoint dictionary containing a `model` state dictionary.
|
| 242 |
+
|
| 243 |
+
## Reproduce Training
|
| 244 |
+
|
| 245 |
+
Set the dataset and distributed-training configuration:
|
| 246 |
+
|
| 247 |
+
```bash
|
| 248 |
+
export DATA_PATH=/path/to/ILSVRC
|
| 249 |
+
export GPUS=0,1,2,3
|
| 250 |
+
export NPROC=4
|
| 251 |
+
```
|
| 252 |
+
|
| 253 |
+
Train the released Lift recipe:
|
| 254 |
+
|
| 255 |
+
```bash
|
| 256 |
+
cd training/lift
|
| 257 |
+
bash scripts/run_cait_softkd_spectralkd.sh
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
Train the released WideLast recipe:
|
| 261 |
+
|
| 262 |
+
```bash
|
| 263 |
+
cd training/widelast
|
| 264 |
+
bash scripts/run_cait_softkd_mse.sh
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
Additional ablation recipes are available in the `training/lift/scripts/` and `training/widelast/scripts/` directories.
|
| 268 |
+
|
| 269 |
+
## Analysis Artifacts and Raw Data
|
| 270 |
+
|
| 271 |
+
The official GitHub repository includes:
|
| 272 |
+
|
| 273 |
+
- sample-wise SVD analysis;
|
| 274 |
+
- dataset-level PCA analysis;
|
| 275 |
+
- Spectral Energy Pattern analysis;
|
| 276 |
+
- SEP permutation-robustness analysis;
|
| 277 |
+
- scripts for regenerating figures and tables;
|
| 278 |
+
- prepared `.npz` and `.csv` numeric results in [`Raw data`](https://github.com/thy960112/From-Per-Image-Low-Rank-to-Encoding-Mismatch/tree/main/Raw%20data).
|
| 279 |
+
|
| 280 |
+
See the [ICML 2026 poster](https://huggingface.co/Huiyuancs/Encoding_Mismatch/blob/main/icml_poster.pdf) for a compact visual overview.
|
| 281 |
+
|
| 282 |
+
## Intended Use
|
| 283 |
+
|
| 284 |
+
The checkpoints are intended for:
|
| 285 |
+
|
| 286 |
+
- research on feature and knowledge distillation in Vision Transformers;
|
| 287 |
+
- analysis of teacherβstudent representation mismatch;
|
| 288 |
+
- controlled ImageNet-1K evaluation of Lift and WideLast;
|
| 289 |
+
- studies of low-rank structure, dataset-level subspaces, and spectral channel statistics;
|
| 290 |
+
- reproduction and extension of the ICML 2026 paper.
|
| 291 |
+
|
| 292 |
+
## Citation
|
| 293 |
+
|
| 294 |
+
```bibtex
|
| 295 |
+
@inproceedings{tian2026encodingmismatch,
|
| 296 |
+
title = {From Per-Image Low-Rank to Encoding Mismatch:
|
| 297 |
+
Rethinking Feature Distillation in Vision Transformers},
|
| 298 |
+
author = {Tian, Huiyuan and Xu, Bonan and Li, Shijian},
|
| 299 |
+
booktitle = {Proceedings of the 43rd International Conference on Machine Learning},
|
| 300 |
+
year = {2026}
|
| 301 |
+
}
|
| 302 |
+
```
|
| 303 |
+
|
| 304 |
+
## License
|
| 305 |
+
|
| 306 |
+
This Hugging Face repository is marked as **Apache-2.0**. Users are responsible for complying with the licenses and terms of the code dependencies, ImageNet-1K, and any upstream assets.
|