Representation Similarity: A Better Guidance of DNN Layer Sharing for Edge Computing without Training

Bryan Bo Cao, Abhinav Sharma, Manavjeet Singh, Anshul Gandhi, Samir Das, Shubham Jain · DOI

TL;DR

This paper introduces a flexible deep learning model-merging scheme for edge devices that shares layer representations (outputs) rather than requiring architecturally identical weights. By leveraging Centered Kernel Alignment (CKA) to measure representation similarity, the authors can accurately predict a merged model's accuracy ($|r| \ge 0.94$) entirely at the edge, without needing cloud retraining or ground-truth validation data.

What Problem Does This Paper Address?

Deploying multiple Deep Neural Networks (DNNs) on memory-constrained edge devices (like NVIDIA Jetson Nanos) for real-time video analytics is a major bottleneck. Often, these devices lack the GPU memory to load even a single heavy model, let alone multiple pipelines concurrently.

To save memory, researchers use "model merging" to share weights between networks. However, existing techniques suffer from three strict limitations:

  1. They only allow merging between architecturally identical layers.
  2. They require computationally expensive retraining in the cloud.
  3. They rely on ground-truth datasets to validate the accuracy of the merged model.

The authors tackle a challenging constraint: how do we merge diverse DNNs directly at the edge when cloud servers and ground-truth data are completely unavailable?

Methods

Instead of forcing models to share identical weight matrices, the authors propose representation sharing. If two different layers produce highly similar feature maps (representations), one layer's execution can be skipped entirely, and it can simply inherit the output of the other model's layer.

Figure 1: Proposed merging scheme: sharing representations. DNNs are denoted in different colors. Layers with solid bor- ders represent the weights are loaded in memory while dashed borders indicate the layer weights are offloaded. F: representation.

To make this work, the authors introduced several key techniques:

  • Centered Kernel Alignment (CKA): They use CKA to calculate a representation similarity score ($S$) between intermediate layers. Because CKA is invariant to orthogonal transformations, it can reliably compare layers even if they originate from different architectures or different stages of a network.
  • Shape Alignment Tricks: To share representations between layers with mismatched shapes, they uniformly sample channels (with repetition) to fix channel mismatches, and use standard upsampling/downsampling to resolve spatial resolution differences.
  • Handling Non-Sequential Layers: For complex architectures with skip connections (like EfficientDet), they insert None tensors to shift and align incoming data indices, preserving the structural integrity of the network after sharding.

Datasets

The approach was evaluated using pre-trained versions of EfficientNet-B0 (optimized for image classification) and EfficientDet-D0 (optimized for object detection). Post-merging classification accuracy was validated using the standard ImageNet validation set.

Key Insights and Ideas

  • Breaking the Architectural Barrier: Layers do not need to look the same structurally to share information. As long as their mathematical representations are aligned, cross-stage layer sharing (e.g., feeding an early layer from Model A into a deeper layer of Model B) is entirely viable.
  • Similarity as an Accuracy Proxy: Representation similarity ($S$) acts as an exceptional proxy for actual validation accuracy. This means edge devices can autonomously decide which layers to share without needing a labeled dataset to test the final accuracy.
  • The 0.4 Threshold: The authors observed a strict threshold at $S' = 0.4$. If the similarity score falls below 0.4, the merged model's accuracy plummets to near zero. Above 0.4, the relationship between similarity and accuracy becomes cleanly linear.

Key Results

The authors evaluated how well different metrics correlate with actual merged model accuracy using the Pearson Correlation Coefficient ($r$).

Pearson Correlation Coefficient comparison across different metrics.
  • Superior Correlation: Representation similarity ($S$) achieved a massive correlation with model accuracy ($|r| = 0.94$ for same-stage sharing, and $|r| = 0.99$ for cross-stage sharing).
  • Comparison to Baselines: $S$ vastly outperformed traditional layer-selection metrics like FLOPs ($|r| = 0.0021$) and representation size ($|r| = 0.33$), while also beating total parameter count ($|r| = 0.89$).

Limitations and Future Work

As a preliminary pivot study, this work focuses primarily on establishing the viability of representation similarity. The authors acknowledge several open challenges that they are currently designing systems to solve:

  1. Scaling Up: Testing the framework across more diverse, multi-task video pipelines (e.g., combining pose estimation with license plate recognition).
  2. Optimization Algorithms: Developing automated search algorithms that can jointly optimize for both memory footprint reduction and representation similarity.
  3. Accuracy Preservation: Engineering methods to actively preserve or recover post-sharing accuracy without relying on ground-truth data for retraining.

Summary updated

BibTeX
@inproceedings{cao2024representation,
  author = {Bryan Bo Cao and Abhinav Sharma and Manavjeet Singh and Anshul Gandhi and Samir Das and Shubham Jain},
  title = {{Representation Similarity: A Better Guidance of DNN Layer Sharing for Edge Computing without Training}},
  booktitle = {ACM MobiCom '24: Proceedings of the 30th Annual International Conference on Mobile Computing and Networking S3 Workshop},
  year = {2024},
  doi = {10.1145/3636534.3695903},
}
Figure