Knowledge distillation across teacher architectures for compact diabetic retinopathy grading
Organizations: Department of Computer Science and Engineering, Shahjalal University of Science and Technology, Sylhet, Bangladesh
Abstract
Diabetic retinopathy grading from retinal fundus photographs is important but difficult to deploy on resource-constrained hardware. We conducted a controlled study of offline response-based knowledge distillation for five-class diabetic retinopathy grading on APTOS 2019, comparing ResNet-50, MobileNetV3-Large, and Swin Transformer-Tiny (Swin-T) teachers distilled into a MobileNetV3-Small student. A 3 x 4 x 2 grid of teacher, temperature, and hard-label weight was screened at one seed, while six configurations and the no-distillation baseline were evaluated across three seeds. The highest observed single-seed quadratic weighted kappa was 0.9093 (macro-F1 0.6851) for Swin-T at temperature 4 and hard-label weight 0.7; the corresponding three-seed mean was 0.9024, compared with 0.8804 for the baseline. The student used 1.52 M parameters and 5.94 MB, representing an 18.07x parameter reduction relative to Swin-T. Temperature and hard-label weight effects were teacher- and configuration-dependent, while small performance differences were sensitive to random seed. Knowledge distillation produced a compact student with competitive performance under the evaluated protocol, but independent external validation remains necessary.
Figures & tables
| Split | No DR | Mild | Moderate | Severe | Prolif. |
|---|---|---|---|---|---|
| Train (80%) | 1,434 | 300 | 808 | 154 | 234 |
| Val (10%) | 172 | 40 | 104 | 22 | 28 |
| Test (10%) | 199 | 30 | 87 | 17 | 33 |
| Total | 1,805 | 370 | 999 | 193 | 295 |
| Hyperparameter | Value |
|---|---|
| Image size | |
| Batch size | 32 |
| Epochs | 30 |
| Optimiser (ResNet-50, MobileNetV3-Large, student) | Adam |
| Optimiser (Swin-T teacher) | AdamW |
| Learning rate (ResNet-50, MobileNetV3-Large, student) |
| Teacher | Params (M) | Size (MB) | Lat. (ms) | QWK | Acc. | macro-F1 |
|---|---|---|---|---|---|---|
| ResNet-50 | 23.52 | 90.02 | 5.61 | 0.8793 | 0.8169 | 0.6589 |
| MobileNetV3-Large | 4.21 | 16.25 | 6.33 | 0.9084 | 0.8333 | 0.6449 |
| Swin-T | 27.52 | 105.28 | 12.22 | 0.9024 | 0.8197 | 0.6540 |
| Teacher | No DR | Mild | Moderate | Severe | Prolif. |
|---|---|---|---|---|---|
| ResNet-50 | 0.9823 | 0.6176 | 0.7000 | 0.4186 | 0.5758 |
| MobileNetV3-Large | 0.9800 | 0.5538 | 0.7709 | 0.3125 | 0.6071 |
| Swin-T | 0.9847 | 0.6111 | 0.7284 | 0.3556 | 0.5902 |
| Seed | Test QWK | Test Acc. | macro-F1 |
|---|---|---|---|
| 42 | 0.8913 | 0.8169 | 0.6190 |
| 123 | 0.8948 | 0.8361 | 0.6522 |
| 999 | 0.8551 | 0.8033 | 0.5871 |
| Mean | 0.8804 | 0.8188 | 0.6194 |
| Range | 0.0397 | 0.0328 | 0.0651 |
| Seed | No DR | Mild | Moderate | Severe | Prolif. |
|---|---|---|---|---|---|
| 42 | 0.9823 | 0.5000 | 0.7407 | 0.3333 | 0.5385 |
| 123 | 0.9799 | 0.5357 | 0.7849 | 0.3784 | 0.5818 |
| 999 | 0.9626 | 0.4400 | 0.7411 | 0.3429 | 0.4490 |
| Mean | 0.9749 | 0.4919 | 0.7556 | 0.3515 | 0.5231 |
| Val QWK | Test QWK | Test Acc. | macro-F1 | Ret. (%) | Best Ep. | |
| 2 | 0.8977 | 0.9019 | 0.8224 | 0.6539 | 102.6 | 22 |
| 3 | 0.9048 | 0.8939 | 0.8142 | 0.6425 | 101.7 | 22 |
| 4 | 0.8987 | 0.8666 | 0.7814 | 0.5965 | 98.6 | 12 |
| 5 | 0.9050 | 0.9090 | 0.8142 | 0.6537 | 103.4 | 24 |
| Val QWK | Test QWK | Test Acc. | macro-F1 | Ret. (%) | Best Ep. | |
| 2 | 0.9190 | 0.9066 | 0.8443 | 0.6695 | 99.8 | 27 |
| 3 | 0.8988 | 0.8932 | 0.8333 | 0.6418 | 98.3 | 20 |
| 4 | 0.8986 | 0.8822 | 0.8005 | 0.5993 | 97.1 | 22 |
| 5 | 0.9041 | 0.8919 | 0.8251 | 0.6299 | 98.2 | 20 |
| Val QWK | Test QWK | Test Acc. | macro-F1 | Ret. (%) | Best Ep. | |
| 2 | 0.9064 | 0.8909 | 0.8197 | 0.6560 | 98.7 | 22 |
| 3 | 0.9010 | 0.8762 | 0.7978 | 0.6081 | 97.1 | 13 |
| 4 | 0.9050 | 0.9065 | 0.8251 | 0.6620 | 100.5 | 28 |
| 5 | 0.9115 | 0.9008 | 0.8169 | 0.6407 | 99.8 | 22 |
| Teacher | ||||
|---|---|---|---|---|
| ResNet-50 | 2 | 0.9019 | 0.8875 | 0.0144 |
| ResNet-50 | 3 | 0.8939 | 0.8922 | 0.0017 |
| ResNet-50 | 4 | 0.8666 | 0.8698 | 0.0032 |
| ResNet-50 | 5 | 0.9090 | 0.8942 | 0.0148 |
| MobileNetV3-Large | 2 | 0.9066 | 0.8869 | 0.0197 |
| MobileNetV3-Large | 3 | 0.8932 | 0.8672 | 0.0260 |
| Teacher | Val QWK | Test QWK | Acc. | macro-F1 | Ret. (%) | |
|---|---|---|---|---|---|---|
| ResNet-50 | 2 | 0.9172 | 0.8875 | 0.8388 | 0.6743 | 100.9 |
| ResNet-50 | 3 | 0.9088 | 0.8922 | 0.8197 | 0.6545 | 101.5 |
| ResNet-50 | 4 | 0.9012 | 0.8698 | 0.7923 | 0.5926 | 98.9 |
| ResNet-50 | 5 | 0.9052 | 0.8942 | 0.8251 | 0.6570 | 101.7 |
| MobileNetV3-Large | 2 | 0.8949 | 0.8869 | 0.8361 | 0.6468 | 97.6 |
| MobileNetV3-Large | 3 | 0.9040 | 0.8672 | 0.8169 | 0.6245 | 95.5 |
| Seed | Val QWK | Test QWK | Acc. | macro-F1 | |
|---|---|---|---|---|---|
| 0.3 | 42 | 0.9050 | 0.9065 | 0.8251 | 0.6620 |
| 0.3 | 123 | 0.9030 | 0.8966 | 0.7978 | 0.6341 |
| 0.3 | 999 | 0.9198 | 0.8984 | 0.8169 | 0.6383 |
| 0.7 | 42 | 0.9250 | 0.9093 | 0.8443 | 0.6851 |
| 0.7 | 123 | 0.9098 | 0.8999 | 0.8224 | 0.6410 |
| 0.7 | 999 | 0.9173 | 0.8979 | 0.8361 | 0.6580 |
| Seed | Val QWK | Test QWK | Val Test | macro-F1 | ||
|---|---|---|---|---|---|---|
| 3 | 0.3 | 42 | 0.9048 | 0.8939 | 0.0109 | 0.6425 |
| 3 | 0.3 | 123 | 0.9082 | 0.9075 | 0.0007 | 0.6681 |
| 3 | 0.3 | 999 | 0.8996 | 0.8856 | 0.0140 | 0.6327 |
| 3 | 0.7 | 42 | 0.9088 | 0.8922 | 0.0166 | 0.6545 |
| 3 | 0.7 | 123 | 0.9139 | 0.8915 | 0.0224 | 0.6729 |
| 3 | 0.7 | 999 | 0.9136 | 0.8813 | 0.0323 | 0.6551 |
| Teacher | Mean (3 seeds) | Mean (excl. flagged) | ||
| ResNet-50 | 3 | 0.3 | 0.8957 | – |
| ResNet-50 | 3 | 0.7 | 0.8883 | – |
| ResNet-50 | 4 | 0.3 | 0.8901 | 0.9019 |
| ResNet-50 | 4 | 0.7 | 0.8943 | 0.9065 |
| Swin-T | 4 | 0.3 | 0.9005 | – |
| Swin-T | 4 | 0.7 | 0.9024 | – |
| Teacher | Test QWK | Comp. | Verification status | ||
| ResNet-50 | 5 | 0.3 | 0.9090 | 15.44 | single seed only |
| MobileNetV3-Large | 2 | 0.3 | 0.9066 | 2.76 | single seed only |
| Swin-T | 4 | 0.7 | 0.9093 | 18.07 | 3 seeds; mean 0.9024 (Table 14 ) |
| Model | F1 0 | F1 1 | F1 2 | F1 3 | F1 4 | macro-F1 | QWK |
|---|---|---|---|---|---|---|---|
| Baseline (No KD) | 0.9823 | 0.5000 | 0.7407 | 0.3333 | 0.5385 | 0.6190 | 0.8913 |
| ResNet-50 MNV3-S ( ) | 0.9796 | 0.5479 | 0.7066 | 0.3902 | 0.6441 | 0.6537 | 0.9090 |
| MNV3-L MNV3-S ( ) | 0.9874 | 0.5970 | 0.7845 | 0.3784 | 0.6000 | 0.6695 | 0.9066 |
| Swin-T MNV3-S ( ) | 0.9823 | 0.6269 | 0.7717 | 0.4324 | 0.6122 | 0.6851 | 0.9093 |
| Model | Params (M) | Size (MB) | Lat. (ms) | Role |
| ResNet-50 | 23.52 | 90.02 | 5.61 | Teacher |
| MobileNetV3-Large | 4.21 | 16.25 | 6.33 | Teacher |
| Swin-T | 27.52 | 105.28 | 12.22 | Teacher |
| MobileNetV3-Small | 1.52 | 5.94 | 5.00 | Student (deployed) |
| Method | Venue (Year) | Task | Metric / Protocol | Value |
| Islam et al. [ 29 ] | Appl. Sci. (2023) | Five-class | Accuracy (split unspecified) | 99.04% |
| Dharrao et al. [ 36 ] | Discov. Appl. Sci. (2025) | Five-class ordinal | QWK, five-fold CV | |
| Dharrao et al. [ 36 ] | Discov. Appl. Sci. (2025) | Five-class ordinal | QWK, held-out test set | 0.919 |
| This work: Swin-T MobileNetV3-Small KD | – | Five-class ordinal | QWK, single held-out split; highest observed single-seed result over a 24-cell screening grid, with the three-seed mean for the same configuration in parentheses | 0.9093 (0.9024) |
Knowledge Distillation
Knowledge distillation transfers useful behavior or representations from larger or specialized models into more compact or adaptable learners.
See all 821 papers