
Your code pins library versions and nobody argues. The model that code loads comes from from_pretrained("org/model"), with no version at all.
A name is not a version
A repository on the hub is a git repository. The owner can push a new commit, rewrite main, swap the tokenizer or the config file. They can also lose the account, or delete everything. Whoever loads by name gets whatever is there at download time, and the local cache hides the change until the next clean machine.
A model loaded by name is a dependency without a lockfile.
Pin by commit, not by tag
The revision parameter accepts a commit hash. Tags and branches move; hashes do not. Alongside the hash, store the SHA-256 of every weight file and check it after download. That turns "the model changed on its own" from a mystery into a build error, which is where you want to find out.
The internal mirror is the missing piece
Pinning solves the silent change. It does not solve unavailability, or the fact that every CI pipeline goes out to the internet pulling gigabytes. An internal model registry plays the role a package proxy already plays for npm and PyPI: single entry point, reviewed once, immutable copy.
revisionwith a commit hash on everyfrom_pretrained, checked in code review.- Per-file checksums recorded next to the hash.
- The internal registry as the only allowed source in production; egress to the hub blocked at the network.
- Promotion into the registry only after checking format, license and origin.
HF_HUB_OFFLINE=1in runtime environments, so it fails loudly instead of downloading.
The quick test
Take your most important AI service and ask: if the source repository disappears today, does the next deploy come up? If the answer is "depends on the cache", you do not have a model in production. You have a link.