ResNet-8 for CIFAR-100, pruned from ResNet-20 and retrained
A small CIFAR ResNet-8 (78 k parameters) used as the pretrained Student in TopKD-imat, a university project that applies topological knowledge distillation (TopKD, Kim et al., ICML 2024) to CIFAR-10.
How it was made
- Start from the CIFAR-100 ResNet-20 released by chenyaofo/pytorch-cifar-models (68.83 % top-1 on CIFAR-100).
- Depth-prune it to a ResNet-8 by keeping only the first BasicBlock of each of its three stages (16, 32, 64 channels). Pruning alone leaves 1.29 % accuracy.
- Retrain the pruned network on CIFAR-100 for 30 epochs: SGD (momentum 0.9, weight decay 5e-4), lr 0.05 with cosine decay, batch 128, random crop (padding 4) and horizontal flip, seed 0, on one RTX 2060.
The network has never seen CIFAR-10.
Results
| Model | CIFAR-100 test top-1 |
|---|---|
| This model | 57.45 % |
| Same ResNet-8 trained from random weights, same recipe | 52.88 % |
| Source ResNet-20 (chenyaofo) | 68.83 % |
As a starting point for CIFAR-10 (new 10-class head, cross-entropy only, 30 epochs), it reaches 85.63 % test accuracy, against 83.17 % for the same architecture from random weights.
File
student_resnet8_healed_c100_state_dict.pt is a PyTorch state_dict with a 100-class head.
Its keys follow chenyaofo's CifarResNet with one block per stage, so it loads into that
class, or into topkd_imat.models.cifar_resnet(8, num_classes=100) from TopKD-imat:
import torch
from huggingface_hub import hf_hub_download
from topkd_imat.models import cifar_resnet
path = hf_hub_download("MarioAlonso7/topkd", "student_resnet8_healed_c100_state_dict.pt")
model = cifar_resnet(8, num_classes=100)
model.load_state_dict(torch.load(path, map_location="cpu", weights_only=True))
Inputs: 3ร32ร32 images normalised with CIFAR-100 statistics, mean (0.5070, 0.4865, 0.4409), std (0.2673, 0.2564, 0.2761).
Licence and attribution
Derived from the weights and code of chenyaofo/pytorch-cifar-models, released under the BSD 3-Clause License, Copyright (c) 2021, chenyaofo. That code is itself modified from torchvision (BSD 3-Clause, Copyright (c) Soumith Chintala 2016). This model is distributed under the same licence; see the upstream repository for its full text.