Faster and Accurate Neural Networks with Semantic Inference

Sazzad Sayyed, Jonathan D. Ashdown, Francesco RestucciaarXiv 2023 · DOI

Abstract

Modern deep neural networks (DNNs) are often over-parameterized, leading to high computational costs that hinder deployment on edge devices. This paper introduces Semantic Inference (SINF), a framework that logically partitions a pre-trained DNN into specialized "semantic subgraphs." By activating only the filters relevant to a specific input category at runtime, SINF achieves significant gains in speed and energy efficiency without requiring model retraining.

Introduction

Deep Neural Networks (DNNs) have revolutionized computer vision, but their deployment on resource-constrained edge devices—such as drones, mobile phones, or IoT sensors—remains a challenge. These models typically involve millions of parameters, most of which are activated for every single input, regardless of its content.

SINF (Semantic Inference) addresses this inefficiency by exploiting "semantic sparsity." The core idea is that a network processing an image of a "dog" utilizes different internal features than when it processes a "hammer." By identifying these specialized pathways, SINF can dynamically prune the network for each input, reducing inference time by up to 35% and improving energy efficiency by 51% on devices like the Raspberry Pi 5.

The SINF Framework

The SINF framework transforms a standard, static DNN into a dynamic, semantically-aware system through a three-stage process.

The three stages of the SINF framework: Semantic Clustering, Subgraph Formation, and Dynamic Inference.

1. Semantic Clustering

The first step involves grouping the model's output classes into clusters based on semantic similarity. For instance, in a dataset like CIFAR100, "sharks," "rays," and "trout" might be grouped into a "Fishes" cluster. This high-level categorization provides the logical basis for partitioning the network.

2. Discriminative Capability Score (DCS)

The mathematical heart of SINF is the Discriminative Capability Score (DCS). This metric ranks every filter in a pre-trained DNN based on its importance for identifying classes within a specific cluster. Unlike traditional pruning metrics that look at weight magnitude, DCS uses gradient-based sensitivity analysis and linear transformations to find "expert" filters. This allows the framework to identify which neurons are most critical for "Birds" versus "Tools."

3. Dynamic Semantic Inference

At runtime, the model is structured into a Common Feature Extractor (CFE) followed by several Semantic Subgraphs.

  • Semantic Route Predictor (SRP): An auxiliary, lightweight component that analyzes early features to predict which semantic cluster the input belongs to.
  • Feature Router (FR): If the SRP is confident in its prediction, the FR activates only the specialized subgraph for that cluster. If the prediction is uncertain, the system defaults to the full model to maintain accuracy.

Key Insights: Semantic Sparsity and Specialization

A fundamental discovery of this research is the nature of feature specialization across network layers. The authors observed that while early layers act as general-purpose feature extractors (detecting basic edges and textures), deeper layers become highly specialized.

Visualizing filter activations for different classes. Deeper layers show distinct patterns for dissimilar classes (e.g., Otter vs. Table) but overlapping patterns for similar ones (e.g., Otter vs. Seal).

As shown in the visualization of filter activations, classes within the same semantic group (like "Otter" and "Seal") share a high percentage of active filters in deep layers. Conversely, unrelated classes show almost no overlap. SINF leverages this by "turning off" the irrelevant filters. Interestingly, this often leads to the "Less Confused" effect, where specialized subgraphs actually outperform the full model in per-cluster accuracy because they are not distracted by features irrelevant to the target category.

Experimental Results

The researchers evaluated SINF on VGG16, VGG19, and ResNet50 architectures using the CIFAR100 and ImageNet datasets. Tests were conducted on edge hardware, including the Raspberry Pi 5 and NVIDIA Jetson Nano.

  • Performance Gains: On VGG19 with CIFAR100, SINF reduced inference time by 35% with a negligible accuracy drop of 0.17%. On the more complex ImageNet dataset, it achieved a 22% speedup.
  • Energy Efficiency: The framework proved highly effective for battery-powered devices, showing a 51% reduction in energy consumption on a Raspberry Pi 5.
  • Metric Superiority: The DCS metric significantly outperformed six other state-of-the-art pruning methods. At high levels of sparsity, DCS maintained up to 15% higher accuracy than competing techniques like Taylor expansion-based pruning.

Limitations and Future Directions

While SINF offers a powerful "retraining-free" optimization path, it faces certain challenges:

  • Routing Accuracy: The system's performance is tied to the Semantic Route Predictor. Misrouting an input leads to immediate accuracy loss.
  • Polysemantic Neurons: Some neurons respond to multiple unrelated semantic features, making clean partitioning difficult in extremely complex datasets.
  • Automated Clustering: Future work aims to automate the discovery of semantic clusters, removing the need for manual grouping based on dataset labels.

Conclusion

SINF demonstrates that we don't always need the "whole brain" of a neural network to solve a specific problem. By dynamically activating semantic subgraphs, SINF provides a practical, efficient way to deploy high-performance AI on the edge without the costly overhead of retraining or fine-tuning.

Summary updated

BibTeX
@misc{sayyed2023faster,
  author = {Sazzad Sayyed and Jonathan D. Ashdown and Francesco Restuccia},
  title = {{Faster and Accurate Neural Networks with Semantic Inference}},
  year = {2023},
  eprint = {2310.01259},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.01259},
}
Figure