Transformers Model Integration Contracts Hugging Face proposed Model Integration Contracts (MICs), a standard for packaging small "fixture" models with runnable usage paths and human-reviewed baselines, published in the huggingface-mic repository, after a July 30, 2026 change enabling PyTorch scaled dot-product attention (SDPA) for T5 let UMT5's decoder attend to future tokens and the bug stayed in main for almost two months. The experimental UMT5 fixture uses 66 MB of weights versus 1,227 MB for the source checkpoint, letting fast integration tests run on cheap CPU runners against a suite that otherwise spans 88,000+ CPU tests on main plus 200,000+ GPU tests in a daily run. The SmolLM contract generates from prompts such as "The capital of France is" and compares token IDs with a recorded answer, and also compares training loss, checks gradients are finite and verifies an optimizer step changes the weights. 3.22M • Updated • 702 https://huggingface.co/huggingface-mic/smollm-mic Transformers Model Integration Contracts Update on GitHub https://github.com/huggingface/blog/blob/main/transformers-mic.md On July 30, 2026, Transformers enabled PyTorch's scaled dot-product attention SDPA for T5. As a side effect, UMT5's decoder could attend to future tokens. During training, it could peek at the answer it was supposed to predict. Nothing crashed, and the bug stayed in main for almost two months. When we later replayed those commits, a small UMT5 model running on CPU flagged it on every one of them. This post is about that model and the tests built around it. Why bugs reach main Transformers https://github.com/huggingface/transformers supports over 750 model types, and its test suite is big: 88,000+ CPU tests on main, plus 200,000+ GPU tests in a daily run. Model tests are only part of it: we also test pipelines, training, distributed execution, quantization and attention kernels. The integration tests load real checkpoints and exercise the model's API on real hardware. Running all of that on every PR would mean keeping a lot of GPUs busy all day long, which isn't practical. By the time a scheduled run finds a regression, it may already be in main. Our approach is to shrink the model instead. We build a fixture : a small model made from the real checkpoint's configuration, with fewer and narrower layers but every kind of layer it has, and its tokenizer and processor files unchanged. It is published once, then reused. We run "fast integration tests" against it on a cheap CPU runner. In our CPU study https://github.com/huggingface/transformers-mic/blob/main/docs/evidence.md on-cpu , the experimental UMT5 fixture used 66 MB of weights; the source checkpoint is 1,227 MB. This also covers very large models: some don't fit on our standard GPU runners, but their fixtures run on CPU. Model integrators already build tiny test models Transformers' tiny-random- checkpoints . We wanted a common recipe, and checks that go beyond loading the model and running a forward pass. The UMT5 bug would have passed a forward pass just fine. Fixtures won't replace full integration tests, but on PRs they give us a chance to catch bugs before they reach main. Introducing Model Integration Contracts transformers-mic https://github.com/huggingface/transformers-mic is a proposed standard for packaging these tests. A Model Integration Contract MIC has three parts: - a fixture : the shrunk model described above, published once and pinned - a usage path : a runnable Markdown example of something people do with the model, such as generating text or running a training step - baselines : the outputs recorded when running that example, reviewed by a human The contract holds if running the usage path on the fixture still produces the baselines. A contract covers an architecture and a usage path, not a single checkpoint: compatible checkpoints can share a fixture, while each keeps its own expected results. We publish them in huggingface-mic https://huggingface.co/huggingface-mic . For example, the SmolLM contract generates from prompts such as "The capital of France is" and compares its token IDs with a recorded answer. After loading the model and tokenizer, the generation code is, simplified to one prompt: inputs = tokenizer "The capital of France is", return tensors="pt" outputs = model.generate inputs, max new tokens=4, do sample=False new tokens = outputs :, inputs "input ids" .shape 1 : print tokenizer.batch decode new tokens, skip special tokens=True It also compares training loss, checks that gradients are finite and verifies that an optimizer step changes the weights. See the full usage.md https://huggingface.co/huggingface-mic/smollm-mic/blob/main/integrations/transformers/usage.md . A fleet dataset https://huggingface.co/datasets/huggingface-mic/transformers-fleet on the Hub pins each MIC to a frozen revision, along with the package versions used to record its baselines. Each CI run records the fleet revision it used, so we can reproduce it later. On a PR, we pick MICs based on the files the patch changes. The UMT5 regression We replayed frozen MICs over five months of Transformers commits. The small UMT5 fixture flagged the regression from its introduction on July 30, 2026 https://github.com/huggingface/transformers/commit/560f36cc561fa154d224b7a6dfcba1d57a621d7b until its fix on September 28 https://github.com/huggingface/transformers/commit/d7ba937671edb174fd80d33f9ecbd38f6559dfca . Label log-probabilities differed from the reviewed baseline by 1.22 and training loss by about 0.20. One detail mattered: the contract used SDPA, the default attention path. Running only the eager attention variant missed the bug. A fixture only helps if it goes through the same code as the real checkpoint. We then reverted the fix on a proof branch in Transformers' CI. The check failed with the same differences, and the selected T5 contract's runner step took 13.4 seconds on CPU, excluding setup. The replay results https://github.com/huggingface/transformers-mic/blob/main/docs/evidence.md shadow-backfill and the CI demo https://github.com/huggingface/transformers-mic/blob/main/docs/evidence.md transformers-ci-proof have the measurements and reproduction details. How models are shrunk The first recipe was simple: make the dimensions smaller and keep fewer layers. That wasn't enough for mixed architectures. Keeping two layers is no use if both use sliding attention and the full-attention layers disappear. The recipe now has four steps: 1. Shrink the configuration. Start from a real checkpoint and reduce hidden sizes, attention heads and depth. Keep the different layer kinds, including mixtures of sliding and full attention or dense and MoE layers. Some architectures need extra rules to keep their components compatible. We also look at the model's own Transformers tests: the ModelTester in test modeling