Skip to content

Model Casting and Low-Parameter Gating: Towards More Sparsely Activated FFNs

Maria Lomeli, Antoine Groudiev, Matthijs Douze, Loïc Cabannes, Pierre Emmanuel Mazaré, François Fleuret, Maximilian Beck, Gergely Szilvasy, Naila Murray, Hervé Jégou

cs.LG

Abstract

We introduce model casting, a mid-training recipe that drastically sparsifies feed-forward network (FFN) activations to a controllable sparsity target at any model scale, enabling an explicit quality-compute trade-off. With this strategy, at inference time, we first compute the gating output, then exploit its sparsity to skip computations in the other two FFN matrices, reducing the FLOP count by up to 3x. While this theoretical speedup is an upper bound, our sparse kernels translate these theoretical savings into measured CPU and GPU speedups. We then introduce LoPA Gating, a new FFN design that lifts the maximum theoretical speedup. Its low-FLOPs parameterization overcomes the 3x cap by allocating fewer FLOPs and parameters to the gating matrix, whose computation remains dense, than to the other two FFN matrices, whose computation benefits from activation sparsity. We consider three cases: (i) sparsifying the FFNs of a standard pre-trained model, (ii) sparsifying the FFNs of a model pre-trained with LoPA Gating, and (iii) jointly sparsifying and converting the FFNs to LoPA Gating of a standard pre-trained model. As an example, at matched quality, we achieve a 3.2x FLOP speedup with LoPA Casting (ii) against 1.6x at best for competing methods top-p and TEAL. Using dedicated kernels, we achieve an actual 3.31x speed-up on GPU at 90% sparsity, past the 3x ceiling of standard gating; RELU-fication, meanwhile, plateaus below 80% sparsity.

Create a lesson