Model Carving: Training Transformers That Optimize Their Own Topology
Kaden Zheng, Pratyusha Sharma
arXiv:2611.27962v1When people think about training a large Transformer, they usually think of a fixed blueprint: the layers are decided first, and then the weights are learned inside that blueprint. This paper argues that this separation is a limitation. The core question is simple but important: what if the model could learn not just its weights, but also which parts of itself it actually needs? That matters for several reasons. First, the standard Transformer is highly uniform. Every layer usually repeats the same pattern of attention followed by an MLP, in the same order, across depth. But that uniformity is mostly a convention, not a law of nature. We already have hints that more heterogeneous structures can help: sublayers can be reordered, some layers can be removed with only modest loss in quality, and some modern models already mix different kinds of layers by design. Second, there is a practical pressure toward smaller and faster models. For edge devices, memory and inference compute are limited, so a model that can shed unnecessary computation during training would be very valuable. And third, there is a biological analogy here. The brain does not just learn weights; it also prunes structure over development, keeping what proves useful and removing what does not. The paper’s idea is called Model Carving. Instead of choosing an architecture first and training it later, they begin with an overparameterized Transformer and let training itself remove components that do not earn their keep. The metaphor is literal: the large model is like a block of stone, and the final architecture is carved out from inside it during optimization. To understand the context, it helps to separate this from older approaches to architecture search. Neural architecture search has traditionally been a separate optimization problem. You might train many candidate networks with reinforcement learning, or use evolutionary methods, or train a supernet and then search over architecture parameters. But in all of those cases, architecture choice is still something external to the main training objective. Model Carving tries to collapse those two processes into one. The same run that learns the weights also decides which sublayers should remain. How does it do that? The key mechanism is gating. Every sublayer in the Transformer writes into the residual stream through a learned scalar gate. If the gate is large, that sublayer contributes strongly; if the gate shrinks toward zero, the sublayer is effectively removed. They also allow learned connections that can reuse outputs from earlier layers, so the resulting network does not have to remain a rigid stack. This makes the final topology heterogeneous rather than uniformly repeated. The really interesting part is how the model decides whether to keep or remove a sublayer. The paper frames this as a tradeoff between quality and compute. Removing a sublayer will usually make the current model slightly worse on the loss, but it also saves compute. And saved compute is not just a theoretical benefit: under a fixed training FLOPs budget, cheaper updates mean the run can process more tokens. More tokens can improve the final model. So the question becomes: is the immediate quality cost of keeping a sublayer worth more or less than the extra training progress its compute could have bought? To answer that, Model Carving assigns each sublayer a pressure term. You can think of this pressure as the value of the compute that sublayer consumes. If a sublayer’s contribution to the loss is less than its pressure, the gate is pushed downward, and if it reaches zero the sublayer is removed from the computation graph. This is important because it means the model is not being pruned by a separate heuristic after training; the architecture is being optimized directly during training, with the budget folded into the loss. A second key ingredient is that this pressure is adaptive. The paper does not rely on a hand-tuned penalty sweep. Instead, it estimates how valuable compute is at a given point in training by looking at the run’s own learning curve. The intuition is that compute saved early in training is especially valuable, because it can buy many extra tokens over the rest of the run. Compute saved very late is less valuable, because there is little training left. So the pressure naturally decays over time. To estimate this, the method needs an estimate of the model’s rate of learning near the end of training. Since batch-to-batch loss is noisy, they take a snapshot of the model from an earlier point and evaluate the same batch again later, so the batch difficulty cancels out and the difference gives a cleaner estimate of learning progress. Then they fit a power-law trend to forecast that rate to the end of training. This is a practical way to turn the training budget into a live signal for architecture selection. The method is evaluated on standard Transformers ranging from 140 million to 2.7 billion parameters, and also on looped Transformers from 140 million to 1.3 billion. Looped Transformers are a family where the same stack of layers is reused across multiple loops, so they provide another setting where depth and structure can be adjusted. The comparison is not just against the original dense models, but also against shallower models matched to the carved models’ inference cost, as well as against pruning and distillation baselines. The experimental question is therefore twofold. First, if you give the carved model the same training compute as a dense model, does it end up better? Second, if you compare models at the same inference cost, does carving produce a better small model than post-hoc compression methods? The answer in the paper is yes on both counts. At equal training compute, carved models reach lower validation loss than dense models that would need up to 1.7 times more compute to catch up. That is a strong result because it means the savings are not only at inference time; the training process itself becomes more efficient. The advantage also grows with scale, which suggests that fixed homogeneous depth becomes increasingly inefficient as models get larger. They also report that carved models match or improve downstream performance. The paper mentions few-shot evaluation and generation, and the gains carry over there as well. So this is not just an optimization artifact on pretraining loss; the benefits survive when the model is used on actual tasks. On the efficiency side, carved models can reduce inference FLOPs per token by up to 34 percent and decode up to 1.6 times faster at the largest batch sizes they test, without losing quality. That is exactly the kind of result that matters for deployment: if the removed sublayers are truly unnecessary, then you get a faster model for free, not by approximating the original model after the fact, but by never keeping the wasted structure in the first place. The paper is especially interested in the comparison with pruning and distillation, because those are the standard routes to making smaller models. Pruning typically starts from a large trained model and removes parts afterward. Distillation trains a smaller student to imitate a larger teacher. Model Carving claims a better point on the quality-efficiency frontier than either approach, and says that this remains robust even with weight quantization. The takeaway is that the best small model may not be the compressed version of a large one; it may be the one that was allowed to become small during training. What should we be careful about? First, the method still starts from an overparameterized network, so it does not eliminate the need for a large training scaffold. It changes how that scaffold is used, not the fact that it exists. Second, the pressure relies on forecasting the end-of-training value of compute, which means the method depends on a model of the learning curve. The paper handles this with online estimates and power-law fits, but that is still an approximation. Third, the method is evaluated on specific Transformer families and training setups, so we should be cautious about assuming it transfers unchanged to every architecture or every regime. Still, the broader implication is compelling. The paper is challenging a deep convention in neural network design: that architecture must be fixed before training begins. Model Carving shows that architecture can be treated more like weights, something the optimization process discovers rather than something we hand to it in advance. In that sense, the paper’s message is bigger than the particular gating scheme. It is a proposal for a different way to think about model design: not build a large uniform Transformer and then shrink it, but let training itself reveal the smaller, faster, stronger network hidden inside.
Also spotted that day
Previous daily papers