Papers
arxiv:2611.27962

Model Carving: Training Transformers That Optimize Their Own Topology

Published on Nov 20
· Submitted by
Kaden Zheng
on Nov 25
Authors:

Abstract

Model Carving jointly learns a Transformer's weights and architecture by gating sublayers during training, producing smaller, faster, and stronger models than dense, pruned, or distilled alternatives.

Machine learning has largely kept separate the choice of architecture and the process of training. A classic Transformer, for instance, trains a fixed set of attention and MLP sublayers at every layer, in the same order, and optimizes the weights within. This uniformity is a convention rather than a principled design choice, and it is likely suboptimal: the best architecture for a given task may be smaller, more efficient, and far from uniform. We believe that, ideally, training itself should shape the model's topology. To this end, we introduce Model Carving, which learns both a Transformer's weights and its architecture in a single run. By applying learnable, scalar gates to each sublayer, we allow the training loss to remove the model's own components during training -- freeing a smaller heterogeneous network inside. We evaluate Model Carving by pre-training standard Transformers from 140M to 2.7B parameters and looped Transformers from 140M to 1.3B. At equal training compute, carved models reach a lower validation loss than dense models trained with up to 1.7 times more compute. Furthermore, carved models also outperform size-matched models produced by pruning or distillation, suggesting that the best way to obtain small models for edge devices is to carve them during training, not to compress a large one afterwards. This advantage both grows with scale and carries over to downstream tasks such as few-shot evaluation and generation. Because the removed sublayers no longer run, carved models also cost up to 34% fewer FLOPs per token and decode up to 1.6 times faster without cost in quality. Our results show that architecture, like weights, should be learned and not fixed in advance, and that inside every large transformer is a smaller, faster, stronger one waiting to be carved out.

Community

Paper author Paper submitter

What if inside every Transformer, there was a smaller, faster, and better one?

Model Carving is a method that learns both a Transformer's weights and its architecture in one run! Inspired by synaptic pruning in the brain, each sublayer and connection gets a learned gate and pays a compute price, set by how much it's still learning versus what it costs. When a gate hits zero, we simply remove it-- learning a smaller, faster, and better Transformer from within!

Highlights:

  • Carved looped Transformers match dense looped models trained with up to 1.7× the compute, and the gain grows with scale (1.33× at 140M → 1.71× at 1.3B).
  • Carved standard models need up to 34% fewer inference FLOPs, decode up to 1.6× faster, and use up to 31% less KV cache.
  • Given the same inference budget, a 2.7B carved down to 1.75B solves up to 37% more problems (GSM8K 28.4% → 37.5%, MATH-500 14.2% → 19.4%).
  • Carving during training beats post-hoc pruning and distillation, and the lead holds after instruction tuning and quantization down to 4 bits!

📝 Blog: https://kadenzheng.com/model-carving/
📄 Paper: https://arxiv.org/abs/2611.27962
💻 Code: https://github.com/KadenZheng/model-carving

Happy to answer questions!

Sign up or log in to comment

Models citing this paper 0

No model linking this paper

Cite arxiv.org/abs/2611.27962 in a model README.md to link it from this page.

Datasets citing this paper 0

No dataset linking this paper

Cite arxiv.org/abs/2611.27962 in a dataset README.md to link it from this page.

Spaces citing this paper 0

No Space linking this paper

Cite arxiv.org/abs/2611.27962 in a Space README.md to link it from this page.

Collections including this paper 0

No Collection including this paper

Add this paper to a collection to link it from this page.