Unit 07.02: Choosing a pretrained backbone responsibly
Choosing a backbone is a technical decision with non-technical consequences. Both halves deserve explicit answers.
Size is a trade-off; provenance is a liability
The technical half is measurable. A wider backbone has more capacity and costs more memory, more latency, and more energy per prediction. On a phone or an embedded device that decides feasibility.
The other half cannot be measured from the weights:
import torch
from torch import nn
# Size is a real trade-off, not a detail. Compare three widths as stand-ins
# for small, medium and large backbones.
for name, width in [("small", 16), ("medium", 64), ("large", 256)]:
backbone = nn.Sequential(nn.Conv2d(3, width, 3, padding=1), nn.ReLU(),
nn.Conv2d(width, width, 3, padding=1), nn.ReLU(),
nn.AdaptiveAvgPool2d(1), nn.Flatten())
params = sum(p.numel() for p in backbone.parameters())
megabytes = params * 4 / 1e6 # float32
print(f"{name:7} width {width:>3}: {params:>9,} params ~{megabytes:6.1f} MB")
print("""
Before adopting a backbone, answer these in writing:
- what was it trained on, and does that licence permit your use?
- which people are represented in that training data, and which are not?
- does it fit your latency and memory budget on the target device?
- can you cite the model card, or is provenance unknown?
A model with unknown provenance is a liability you inherit.
""")
The parameter counts and memory estimates make the technical trade-off concrete — the large variant is orders of magnitude heavier than the small one for a capability gain that may not matter for your task.
The questions printed afterwards are the ones to answer in writing. A pretrained model carries its training data's licence, its biases, and its gaps into your product.
The mistake this prevents
Adopting a backbone because it tops a leaderboard, without checking its licence or what it was trained on. You inherit every restriction and every bias in that dataset.
Takeaway
Match the backbone to your latency and memory budget, and record where it came from before you depend on it.
