NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Differentiable Model Scaling using Differentiable Topk

Kai Liu, Ruohui Wang, Jianfei Gao, Kai Chen

Abstract

Scaling neural networks typically involves a tedious choice between manual hyperparameter tuning or computationally expensive architecture searches. This paper introduces Differentiable Model Scaling (DMS), which uses a novel "Differentiable Topk" operator to optimize a network's width and depth directly via gradient descent. DMS achieves state-of-the-art performance with a fraction of the search cost (e.g., 0.4 GPU days) across vision and language tasks.

Introduction

As neural networks grow in complexity, scaling width and depth has become the primary lever for improving performance. However, determining the optimal scale is difficult. Manual design relies on human expertise and is often sub-optimal. Existing Neural Architecture Search (NAS) methods are either slow due to stochastic sampling or unstable because they model structural parameters indirectly or use non-differentiable operations. DMS addresses these issues by making the scaling process direct and fully differentiable.

Methods

The core innovation of DMS is the Differentiable Topk operator. This operator allows the network to learn the exact number of channels and layers through standard backpropagation.

Differentiable Topk Mechanism

  1. Importance Normalization: Standard importance scores are often distributed unevenly. DMS maps these scores to a uniform distribution from 0 to 1, ensuring that small changes in the learnable threshold $a$ consistently affect element selection.
  2. Soft Mask Generation: Instead of a non-differentiable "hard" top-k selection, DMS uses a Sigmoid-based soft mask: $m_i = \text{Sigmoid}(\lambda(c'_i - a))$. Here, $a$ is a learnable pruning ratio, and $\lambda$ is a temperature parameter that pushes the mask toward binary values.
Overview of the DMS framework and the Differentiable Topk operator compared to existing selection methods.

Search Space and Pipelines

DMS searches in a fine-grained manner with a step size of 1 for both width and depth. The authors propose several pipelines, including $DMS_{np}$, which allows searching from a randomly initialized supernet. This eliminates the need for expensive supernet pretraining, a major bottleneck in traditional NAS.

Key Results

DMS consistently outperforms both human-designed baselines and state-of-the-art NAS methods across various tasks.

Vision Tasks

On ImageNet, DMS improved EfficientNet-B0 top-1 accuracy by 1.4% and Deit-Tiny by 0.6%. Notably, the search required only 0.4 GPU days, compared to the 1700 TPU days for the original EfficientNet search. For object detection on COCO, DMS boosted the mAP of Yolo-v8-n by 2.0%.

Performance comparison of DMS against other gradient-based scaling methods on ImageNet.

Language Modeling

When applied to Llama-7B, the DMS-pruned version achieved lower perplexity and higher zero-shot accuracy than the previous state-of-the-art, LLMPruner, across benchmarks like BoolQ and ARC.

Conclusion

Differentiable Model Scaling (DMS) provides a direct, efficient, and differentiable approach to network scaling. By leveraging the Differentiable Topk operator and importance normalization, it achieves superior results with minimal computational overhead. Future work could further enhance the method by incorporating more complex hardware-specific cost models directly into the optimization loop.

Summary updated

BibTeX
@inproceedings{liu2024differentiable,
  author = {Kai Liu and Ruohui Wang and Jianfei Gao and Kai Chen},
  title = {{Differentiable Model Scaling using Differentiable Topk}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=bULHOW1RXM},
}
Figure