Dynamically Hierarchy Revolution: DirNet for Compressing Recurrent Neural Network on Mobile Devices

Jie Zhang, Xiaolong Wang, Dawei Li, Yalin Wang

Introduction

Recurrent Neural Networks (RNNs) and Long Short-Term Memory (LSTM) networks are the foundational engines behind modern mobile applications such as voice assistants and real-time language translators. Despite their utility, these models are computationally expensive and memory-intensive, often necessitating cloud-based processing. This dependency introduces challenges regarding user privacy, latency, and the requirement for persistent internet connectivity.

Existing compression techniques, such as pruning or Singular Value Decomposition (SVD), typically apply uniform compression across all network layers. However, this approach ignores the hierarchical nature of deep networks, where different layers exhibit varying levels of redundancy and perform distinct functions. To address these limitations, we present DirNet, a novel compression framework that achieves up to 8x compression with negligible accuracy loss by leveraging dynamic dictionary learning and adaptive hierarchical sparsity.

Methodology

DirNet reframes model compression as a Sparse Coding problem. Instead of storing a full, dense weight matrix $W$, the framework decomposes it into a smaller dictionary $D$ (containing representative "atoms") and a sparse code matrix $Z$, such that $W \approx DZ$.

Comparison between the classical RNN architecture and the proposed DirNet framework, illustrating the integration of codebooks and sparse codes.

The core innovations of DirNet include:

  • Dynamically Adaptive Dictionary Learning: DirNet "mines" dictionary atoms directly from the network structure. It utilizes a shared projection dictionary for both inter-layer (feed-forward) and recurrent-layer weight matrices, significantly reducing the total parameter count.
  • Adaptively Hierarchical Sparsity: Recognizing that network layers are not uniform, DirNet automatically adjusts sparsity levels for different hidden layers. Using a LASSO-based optimization with adaptive weights, it identifies the optimal neuron count and sparsity for each specific layer to minimize performance degradation.
  • Shift Operations: The framework incorporates shift operations on dictionary atoms, allowing for a more precise representation of original weights using fewer parameters.

Experimental Evaluation

The performance of DirNet was evaluated on two standard sequential data benchmarks:

  1. Penn Tree Bank (PTB): Used for word-level language modeling to predict subsequent words in a sequence.
  2. LibriSpeech: A 1000-hour corpus of English speech used for Automatic Speech Recognition (ASR), representing a complex, real-world task for mobile deployment.

Results and Discussion

Evaluations conducted on mobile hardware (Samsung Galaxy S8) demonstrate that DirNet provides a superior balance of compression and performance compared to traditional methods.

Quantitative comparison of DirNet against standard LSTM, LSTM-SVD, and LSTM-ODL across parameters, speedup (R, T), and error metrics.

As shown in the results table, DirNet achieved a 6.7x compression rate and a 6.4x speedup on mobile CPUs for the PTB dataset while maintaining a perplexity (81.5) nearly identical to the uncompressed baseline (81.3). In contrast, while SVD can reach similar compression levels, it suffers from significant accuracy drops; on the LibriSpeech ASR task, SVD's Word Error Rate (WER) jumped to 16.1% at 8x compression, whereas DirNet maintained a WER of 12.9%, close to the 12.7% baseline.

A key insight from this research is that recurrent and inter-layer matrices share enough structural similarity to be reconstructed from a single shared dictionary. Furthermore, by allowing the model to "self-adjust" sparsity per layer rather than applying a global threshold, DirNet preserves accuracy more effectively at high compression rates.

Conclusion

DirNet represents a significant advancement in structural compression for RNNs, enabling high-performance AI on mobile devices. While the current framework requires a fine-tuning phase and significant initial training time, it paves the way for real-time, privacy-preserving mobile AI. Future work may involve integrating scalar-level compression, such as quantization, to further reduce model footprints.

Summary updated

BibTeX
@inproceedings{zhang2018dynamically,
  author = {Jie Zhang and Xiaolong Wang and Dawei Li and Yalin Wang},
  title = {{Dynamically Hierarchy Revolution: DirNet for Compressing Recurrent Neural Network on Mobile Devices}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.24963/ijcai.2018/429},
}
Figure