Skip to main navigation Skip to search Skip to main content

LayerFold: A Python library to reduce the depth of neural networks

  • Giommaria Pilo
  • , Nour Hezbri
  • , André Pereira e Ferreira
  • , Victor Quétu
  • , Enzo Tartaglione
  • Institut Polytechnique de Paris

Research output: Contribution to journalArticlepeer-review

Abstract

Large-scale models are the backbone of Computer Vision and Natural Language Processing, and their generalizability allows for transfer learning and deployment in different scenarios. However, their large size means that reducing their computational and memory demands remains a challenge. Recent research proposes to achieve “layer collapse”, a condition where multiple layers can be combined due to the collapse of non-linearities to linear operators. While this is an important discovery, most studies remain theoretical, often replacing non-linearities with simple identity functions and not providing a real implementation of the more compact architecture. Our contribution is LayerFold, a library that studies and implements the merging of collapsed layers. We address typical cases, from fully connected to convolutional layers, discussing constraints and prospective challenges. Our tests on edge devices reveal that merely reducing network depth does not always result in faster computation, even when GPU-equipped. This work raises important warnings and opens the door to further advances in efficient model deployment.

Original languageEnglish
Article number102030
JournalSoftwareX
Volume29
DOIs
Publication statusPublished - 1 Feb 2025

Keywords

  • Deep learning
  • Depth compression
  • Layer collapse
  • Pruning
  • PyTorch

Fingerprint

Dive into the research topics of 'LayerFold: A Python library to reduce the depth of neural networks'. Together they form a unique fingerprint.

Cite this