Skip to main content
QUICK REVIEW

[Paper Review] Learning to Reverse DNNs from AI Programs Automatically

Simin Chen, Hamed Khanpour|arXiv (Cornell University)|May 20, 2022
Advanced Malware Detection TechniquesComputer Science6 citations
TL;DR

NNReverse is a learning-based method that automatically reverses deep neural networks (DNNs) from compiled AI programs on edge devices by inferring layer semantics from binary code. It uses a fine-grained embedding model combining syntax and topology semantics to achieve high-accuracy function similarity search, enabling full DNN reconstruction without accuracy loss on real-world models like ResNet-18 and VGG-19.

ABSTRACT

With the privatization deployment of DNNs on edge devices, the security of on-device DNNs has raised significant concern. To quantify the model leakage risk of on-device DNNs automatically, we propose NNReverse, the first learning-based method which can reverse DNNs from AI programs without domain knowledge. NNReverse trains a representation model to represent the semantics of binary code for DNN layers. By searching the most similar function in our database, NNReverse infers the layer type of a given function's binary code. To represent assembly instructions semantics precisely, NNReverse proposes a more fine-grained embedding model to represent the textual and structural-semantic of assembly functions.

Motivation & Objective

  • To address the growing risk of model leakage in on-device DNN deployments, where compiled models are vulnerable to reverse engineering.
  • To automate the reverse engineering of DNNs from binary code without requiring manual analysis or domain-specific knowledge.
  • To develop a representation model that captures both textual and structural semantics of assembly functions across multiple hardware platforms.
  • To enable accurate, automated reconstruction of DNN architectures from compiled AI programs by mapping binary functions to known layer types.
  • To release the first public dataset of 80k decompiled DNN functions across four hardware platforms to support future research in on-device DNN security.

Proposed method

  • NNReverse employs a two-phase approach: an offline phase to build a database of decompiled DNN kernel functions and train a semantic representation model, and an online phase to reverse-engineer unknown DNNs.
  • It introduces a novel fine-grained embedding model that jointly encodes the textual semantics of assembly instructions and the topological structure of control flow graphs (CFGs).
  • The embedding model combines word-level representations (e.g., using Skip-gram or CBOW) with graph-based structural encoding to improve semantic fidelity.
  • Function similarity is computed using learned embeddings to search the database for the most semantically similar known function, enabling layer type inference.
  • The method uses a representation model trained on diverse hardware platforms (e.g., Android, Intel, ARM, AArch64), enabling cross-platform DNN reverse engineering.
  • The reconstruction phase uses the inferred layer types and parameters to rebuild the full DNN architecture with minimal accuracy loss.

Experimental results

Research questions

  • RQ1Can a learning-based method automatically reverse DNNs from compiled AI programs without requiring domain expertise or manual reverse engineering?
  • RQ2How effective is a fine-grained embedding model combining syntax and topology semantics in capturing the functional semantics of assembly functions across different hardware platforms?
  • RQ3To what extent can the proposed method reconstruct DNN architectures with high fidelity, as measured by accuracy loss compared to the original model?
  • RQ4How sensitive is the performance of the representation model to hyperparameters such as embedding dimension and context length?
  • RQ5Can the proposed embedding technique reduce the out-of-vocabulary (OOV) problem common in low-level code representation?

Key findings

  • NNReverse achieves significantly higher F1 scores in binary function mapping compared to baseline methods like word2vec, doc2vec, and asm2vec across all hardware platforms.
  • The method successfully reconstructs real-world DNNs—including LeNet-5, ResNet-18, VGG-11, and WideResNet-50—without any accuracy loss, as confirmed by input-output comparison.
  • The model maintains stable performance across varying embedding dimensions (100–300) and context lengths (3–7), indicating low sensitivity to hyperparameter settings.
  • Combining textual and topological embeddings improves function similarity accuracy in 20 out of 30 cases, demonstrating the complementary value of structural information.
  • The fine-grained embedding model reduces the OOV ratio compared to treating each instruction as a standalone word, especially on platforms like Intel and ARM.
  • Ablation studies confirm that topology-only embeddings underperform, while the combination of text and structure yields the best results, validating the design choice.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.