Neural Network Model Encryption via Code Generation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Neural network models deployed on User Equipment (UE) face security issues as model information can be easily accessed, leading to potential exposure and poor security performance, especially when using existing encryption methods that require key storage and have efficiency limitations.

Innovation Solution

A method and device for encrypting neural network models by acquiring an encrypted model file through encryption of model information using a hash function, generating model program code, and creating a model library file, which is then sent to UE as an installation package, allowing secure execution without storing the original model file, thus enhancing security and efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If the neural network model is deployed on User Equipment (UE), then the model can be executed locally, but model information can be easily accessed leading to poor security performance

Engineering Contradiction:
Improvelocal execution capabilityVSAvoidsecurity performance
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The patent segments the model information into multiple encrypted parts and stores them in separate data structures within the code. The model weights are divided into multiple arrays (e.g., array1, array2, array3) that are encrypted separately and cannot be easily reconstructed, thus maintaining security while enabling local execution.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary encryption layer between the original model and the deployed code. A encryption module transforms the original model weights into encrypted form using a predetermined algorithm, creating an intermediate representation that can be executed but not easily reverse-engineered.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If existing encryption methods are used to encrypt the model file, then security is improved, but key storage is required and execution efficiency is reduced

Engineering Contradiction:
ImprovesecurityVSAvoidkey storage requirement
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent extracts the encryption keys from the deployment package and hardcodes them directly into the application source code during compilation. This eliminates the need for separate key storage files or external key management systems, reducing device complexity while maintaining security.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The encryption and compilation process is performed in advance during the build phase. The model is encrypted and the encryption keys are embedded into the code before deployment, so that at runtime no additional key management or decryption steps are required, improving execution efficiency.

Inventive Principle:
Principle #10Preliminary action

3Ease of operation

If the original model file is stored on UE, then the model can be accessed, but storage space is consumed and security is compromised

Engineering Contradiction:
Improvemodel accessibilityVSAvoidsecurity
Core Design Contradiction:
Ease of operationVSReliability

Solution Approach 1:

The patent creates a transformed copy of the model where the weights are encrypted and embedded directly into the code structure. Instead of storing and accessing the original model file, the system uses this encrypted copy that is integrated into the executable, maintaining accessibility while improving security.

Inventive Principle:
Principle #26Copying

4Reliability

If the model file is encrypted using traditional methods, then security is improved, but decryption is required for execution reducing efficiency

Engineering Contradiction:
ImprovesecurityVSAvoidexecution efficiency
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The model encryption and key embedding are performed as preliminary actions during the compilation phase. The encrypted model weights are baked into the code structure beforehand, eliminating the need for runtime decryption operations and ensuring efficient execution while maintaining security.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentEP3772700B1Method and device for encrypting model of neural network, and storage medium
Publication Date: 2022.03.30 BEIJING XIAOMI MOBILE SOFTWARE CO LTD
  • EP3772700B1 patent drawingFigure 1
  • EP3772700B1 patent drawingFigure 2
  • EP3772700B1 patent drawingFigure 3

AI summary

An encrypted model file is acquired (S101) by encrypting at least a part of model information in an original model file. The original model file describes a target neural network model. A model program code is generated (S102) according to the encrypted model file. The model program code describes the target neural network model. An installation package for installing an application (APP) is sent (S103) to a User Equipment (UE) based on a request sent by the UE. The installation package includes the model program code.