← News

Technology updates

Hugging Face Proposes Model Integration Contracts to Catch Transformer Regressions on CPU

Hugging Face details transformers-mic, a proposed standard pairing shrunk model fixtures with runnable usage examples and human-reviewed baselines, tested against a UMT5 attention regression.

Published: 2026-11-18 13:18 UTCUpdated: 2026-11-18 13:18 UTCSource date: 2026-11-03

Hugging Face published a blog post on November 3 introducing a proposed standard called Model Integration Contracts (MIC), aimed at catching breaking regressions before pull requests merge using cheap CPU tests. The post opens with a concrete case: on July 30, 2026, Transformers enabled PyTorch's scaled dot-product attention (SDPA) for T5, and as a side effect UMT5's decoder could attend to future tokens, effectively peeking at the answer it was supposed to predict during training. Nothing crashed, and the bug remained in main for nearly two months until its fix on September 28.

Hugging Face explains why such bugs reach main. Transformers supports more than 750 model types, with over 88,000 CPU tests on main and more than 200,000 GPU tests in a daily run; full integration tests load real checkpoints and exercise the API on real hardware, which is impractical on every PR, and by the time a scheduled run finds a regression it may already be merged.

The project therefore shrinks models. A fixture is built from the real checkpoint's configuration with fewer and narrower layers but every kind of layer it has, and tokenizer and processor files are copied byte for byte. The experimental UMT5 fixture used 66 MB of weights against a 1,227 MB source checkpoint. A Llama 4 Scout shrink report shows 108.6 billion parameters reduced to 44.7 million, with the vision stack cut from 34 layers to 2 and the language stack from 48 to 4.

A contract has three parts: a fixture published once and pinned; a runnable Markdown usage path such as generating text or running a training step; and baselines recorded from that example and reviewed by a human. The contract holds if the usage path on the fixture still produces the baselines. Contracts cover an architecture and a usage path, not a single checkpoint, so compatible checkpoints share a fixture while keeping their own expected results; they are published in huggingface-mic. For SmolLM, the 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 weights. A fleet dataset on the Hub pins each MIC to a frozen revision and the package versions used to record its baselines, and each CI run records the fleet revision for later reproduction.

In replay, the small UMT5 fixture flagged the regression from its introduction to its fix, with label log-probabilities differing from the reviewed baseline by 1.22 and training loss by about 0.20. The post stresses that the contract used SDPA, the default attention path; running only the eager attention variant missed the bug. Reverting the fix on a proof branch made the check fail with the same differences, and the selected T5 contract's runner step took 13.4 seconds on CPU excluding setup.

Weights can be random or overfit. A random-weight Whisper fixture barely responded to audio changes, catching 18 of 24 injected faults in the study, while overfit fixtures caught all 24. Those were synthetic faults, however, and no real regression has yet been found that only the overfit version catches; both versions missed an assisted-decoding bug that the real Whisper checkpoint exposed.

The tmic CLI drafts a contract and builds the fixture; for new models an LLM drafts the usage code and manifest while CPU and GPU runs measure candidate baselines. Hugging Face is explicit that drafting is not approval, and changed expectations need human review. As of November 1, the MIC job in Transformers CI reports failures without blocking PRs, and whether it should block depends on unmeasured factors such as real-world catch rate, false alarms and baseline review effort. Coverage is still partial, and the team hopes to link original Hub model pages to their MICs so a developer or agent can start from an example tested on that checkpoint, its environment and its expected outputs.


Related articles