Q-CapsNets: A Specialized Framework for Quantizing Capsule Networks

Alberto Marchisio, Beatrice Bussolino, Alessio Colucci, Maurizio Martina, Guido Masera, Muhammad Shafique · DOI

Introduction

Capsule Networks (CapsNets) represent a significant advancement in neural network architecture by using vectors of neurons—capsules—to preserve spatial hierarchies. However, their deployment on edge devices is hindered by high computational and memory demands, largely due to the iterative "dynamic routing" mechanism. Q-CapsNets is the first specialized framework designed to address this by quantizing CapsNets for resource-constrained environments, achieving up to a 6.2x reduction in memory footprint with minimal accuracy loss.

The Challenge of Capsule Networks

Unlike standard Convolutional Neural Networks (CNNs) that use scalar neurons and simple pooling, CapsNets rely on dynamic routing. This process involves iterative calculations and complex non-linear functions like squash and softmax. As a result, CapsNets exhibit a significantly higher ratio of operations to memory (MACs/Memory) compared to architectures like AlexNet or LeNet, making them difficult to deploy on mobile or IoT hardware.

Comparison of memory requirements and compute intensity (MACs/Memory) between CapsNet and traditional CNNs.

The Q-CapsNets Framework

The Q-CapsNets framework optimizes models by transitioning from 32-bit floating-point precision to lighter fixed-point arithmetic through a multi-step process:

  1. Layer-Uniform Quantization: Establishes a baseline bit-width for weights and activations.
  2. Memory-Targeted Weight Quantization: Aggressively reduces weight precision, following the insight that later layers are often more sensitive to perturbations.
  3. Layer-Wise Activation Quantization: Iteratively optimizes activation precision for each layer to find the optimal efficiency point.
  4. Specialized Dynamic Routing Quantization: Applies ultra-low bit-widths to the internal arrays of the routing process, exploiting the mechanism's inherent resilience.
  5. Rounding Schemes: Evaluates Truncation, Round-to-Nearest, and Stochastic Rounding (SR), finding SR crucial for maintaining accuracy at ultra-low bit-widths.

Hardware Efficiency and Results

To validate the framework, components were synthesized using UMC 65nm CMOS technology. The study found that the area and energy consumption of hardware units like MACs, squash, and softmax modules decrease quadratically with wordlength.

Energy and area savings for Squash and Softmax modules as a function of fractional bit-width.

Key results include:

  • Memory Efficiency: A 6.2x reduction in memory footprint for the DeepCaps model on CIFAR10.
  • Accuracy Preservation: Compression resulted in only a 0.15% accuracy loss (91.18% vs. 91.33% in full precision).
  • Hardware Footprint: Reducing fractional bits from 8 to 4 in non-linear modules led to an approximately 3x reduction in area and significant energy savings per operation.

Conclusion

Q-CapsNets demonstrates that the dynamic routing mechanism is remarkably resilient to quantization, tolerating precision as low as 3-4 bits. This resilience allows for massive reductions in hardware requirements, paving the way for energy-efficient "Capsule-on-a-chip" designs and specialized accelerators for edge AI.

Summary updated

BibTeX
@inproceedings{marchisio2020q,
  author = {Alberto Marchisio and Beatrice Bussolino and Alessio Colucci and Maurizio Martina and Guido Masera and Muhammad Shafique},
  title = {{Q-CapsNets: A Specialized Framework for Quantizing Capsule Networks}},
  booktitle = {DAC},
  year = {2020},
  doi = {10.1109/dac18072.2020.9218746},
}
Figure