Abstract
This study identifies and proposes techniques to alleviate two key bottlenecks to executing deep neural networks in trusted execution environments (TEEs): page thrashing during the execution of convolutional layers and the decryption of large weight matrices in fully-connected layers. For the former, we propose a novel partitioning scheme, y-plane partitioning, designed to (i) provide consistent execution time when the layer output is large compared to the TEE secure memory; and (ii) significantly reduce the memory footprint of convolutional layers. For the latter, we leverage quantization and compression. In our evaluation, the proposed optimizations incurred latency overheads ranging from 1.09X to 2X baseline for a wide range of TEE sizes; in contrast, an unmodified implementation incurred latencies of up to 26X when running inside of the TEE.
Introduction
Model owners often seek to run AI inference on untrusted infrastructure without exposing proprietary model weights or user data. Trusted Execution Environments (TEEs), such as Intel SGX, provide a secure enclave for such operations. However, TEEs face a significant "memory wall" due to limited secure memory (often as low as 28MB), while modern models like VGG-16 require over 1GB. When memory limits are exceeded, the system relies on secure paging—swapping data in and out of the enclave—which involves expensive encryption and integrity checks for every swap. This paper identifies two primary performance bottlenecks: page thrashing during convolutions and the decryption link saturation for large weight matrices in fully-connected layers.
Methodology
The authors introduce a two-pronged optimization strategy to address these bottlenecks.
Y-Plane Partitioning for Convolutions
Standard frameworks often use im2col to accelerate convolutions, but this can expand the memory footprint by up to 9x. To mitigate this, the authors propose y-plane partitioning. This technique slices the input into horizontal planes along the y-axis, allowing the model to fit into small enclaves without constant swapping.
The study found that y-plane partitioning is particularly effective when the layer's output is large, whereas traditional channel partitioning (slicing by depth) is better when weights are the primary memory hog. A hybrid approach allows for optimal performance across various layer configurations.
Quantization and Compression for Fully-Connected Layers
In layers with massive weights, the hardware's decryption link becomes a bottleneck. The authors apply 16-bit quantization and lossy compression to halve the data volume requiring decryption before it enters the enclave. This shift is crucial because in TEE environments, the bottleneck is often the secure paging and decryption link rather than raw FLOPs.
Evaluation and Results
The techniques were evaluated using VGG-16, AlexNet, and a synthetic VGG-Large architecture on the ImageNet dataset. The optimized implementation demonstrates near-native performance compared to unmodified TEE execution.
As shown in the results, for VGG-16 in a 28MB enclave, the optimized version reduced latency from 84.639 seconds (26.73x baseline) to just 3.468 seconds (1.09x baseline). Furthermore, y-plane partitioning reduced page evictions in specific convolutional layers from 1.8 million to approximately 8,270. Accuracy impact was minimal, with Top-1 accuracy remaining within 2% of the baseline and Top-5 accuracy within 0.8%.
Conclusion
By addressing the memory wall and decryption bottlenecks, this work enables efficient deep learning inference in secure enclaves. The proposed optimizations reduce overhead from 26x to near-native levels. Future research will focus on automated partitioning selection and supporting model concurrency—running multiple secure enclaves on the same CPU—within shared TEE resources.
Summary updated