Transformers Model Integration Contracts test models with shrunk CPU fixtures
Hugging Face proposes transformers-mic, where each model gets a shrunk fixture built from its real config, a runnable usage path, and human-reviewed baseline outputs, all run cheaply on CPU. Replaying it caught a two-month UMT5 regression where enabling SDPA…
Why it matters
It reduces silent regressions for anyone who integrates models or kernels into Transformers or depends on it in production.
What happened
1 min readHugging Face proposes transformers-mic, where each model gets a shrunk fixture built from its real config, a runnable usage path, and human-reviewed baseline outputs, all run cheaply on CPU. Replaying it caught a two-month UMT5 regression where enabling SDPA let the decoder attend to future tokens; a CLI called tmic drafts contracts and fixtures with LLM help.
Our analysis
Tiny-random test models are not new, but this turns them into a disciplined recipe: keep every layer kind, copy tokenizers and weight formats byte for byte, and overfit when random weights don't respond to inputs. The instructive detail is that testing only eager attention missed the bug; only the default SDPA path caught it. The fault-detection numbers (24 of 24 for overfit Whisper) are the team's own. LLMs draft contracts while humans approve baselines, a sensible split that maintainers of other ML libraries could copy.