Partitioning Deep Networks for Memory-Constrained Enclaves

25 concepts23 papers1 proposal

Trusted Execution Environments (TEEs), such as Intel SGX or ARM TrustZone, offer a compelling promise for secure machine learning: a hardware-isolated "enclave" where computations can execute safely away from an untrusted or compromised host operating system. This isolation ensures both data confidentiality and model intellectual property protection.

However, deploying modern deep neural networks (DNNs) inside secure enclaves runs directly into a physical bottleneck: severe memory limitations. While modern deep learning models require gigabytes of memory for parameters and intermediate activations, secure hardware enclaves are typically restricted to tiny allocations of protected memory—often less than 16MB to 128MB on edge and mobile devices, as highlighted by Mo et al. and Ding et al..

When a model's memory footprint exceeds the hardware's Enclave Page Cache (EPC) limit, the system is forced to perform cryptographically secured memory paging. The CPU must encrypt, evict, and later decrypt pages of memory back and forth between the enclave and untrusted main memory. As documented by Boneh et al. and Hanzlik et al., this page swapping incurs catastrophic latency overheads, rendering naive local enclave deployment impractical.

To resolve this paradox, a prominent research direction has emerged: hybrid execution frameworks that intelligently partition, compress, and obfuscate neural networks so that only the most critical components reside within the secure enclave, while the bulk of the heavy computation is offloaded to untrusted but resource-rich environments.


Hybrid Execution via Model Partitioning

The core intuition behind model partitioning is that a neural network does not need to be treated as a monolithic block. Instead, execution can be split between the untrusted Rich Execution Environment (REE)—or an untrusted external accelerator like a GPU—and the secure TEE.

In DarkneTZ, Mo et al. demonstrate that the vulnerability of a model to privacy threats like Membership Inference Attacks is heavily concentrated in its final layers. By keeping the massive, early feature-extraction layers in the untrusted REE and isolating only the final classification layers inside the TEE, they achieve robust privacy guarantees with minimal performance overhead.

Similarly, Zhou et al. propose TBNet, which splits a deep network into a public branch running in the REE and a lightweight, secure branch running in the TEE. By enforcing a one-way data flow from the untrusted to the trusted zone, the framework hides the overall model architecture and critical decision boundaries without overloading the enclave's memory cache.

This architectural splitting extends beyond standard convolutional or dense layers. For graph-structured data, Graph in the Vault by Ding et al. partitions Graph Neural Networks (GNNs) into a public "backbone" and a private "rectifier" housed in the TEE, successfully shielding sensitive graph topologies from link-stealing attacks while avoiding expensive swapping operations. For distributed or IoT settings, Nahrstedt et al. show in Serdab that workloads can be distributed across a pipeline of multiple distinct enclaves to bypass the single-hardware memory wall.


Selective Shielding and Sensitivity-Driven Compression

Rather than making arbitrary layer-based cuts, more recent strategies use structural properties or explainability metrics to identify exactly which parameters or tensors are essential to protect.

In TensorShield, Sun et al. leverage eXplainable AI (XAI) techniques to pinpoint "critical tensors"—the specific mathematical pathways that contribute most to the model's predictive capability. By shielding only these highly sensitive tensors within the TEE and leaving the rest exposed, they achieve up to a 25× speedup over full-model enclave execution.

[Input Data] ---> [ Untrusted REE / GPU ] ---> [ Secure TEE Enclave ] ---> [Output]
                  (Massive Backbone /          (Critical Tensors / 
                   Unsensitive Layers)          Pruned Adapters Only)

This concept is highly effective for adapting Large Language Models (LLMs) to edge devices. In AegisGuard, Wang et al. use reinforcement learning to dynamically select only the most sensitive model adapters (such as LoRA weights) to run inside the TEE. They combine this selective shielding with structural pruning, shrinking the secure memory footprint by 4×.

By focusing exclusively on the "secret sauce" of a model, these approaches make defense practical. For instance, Zhou et al. introduce ProDiF, which isolates and perturbs only the specific weights responsible for domain-invariant features. This prevents attackers from repurposing or fine-tuning a stolen model, while authorized users can unlock full performance by executing a lightweight correction step inside the TEE.


Cryptographic Blinding and Low-Rank Obfuscation

When model parameters cannot be cleanly separated, researchers turn to algebraic and cryptographic techniques to offload heavy matrix operations to untrusted hardware while keeping the underlying data obfuscated.

In Slalom, Boneh et al. introduce a framework that streams heavy linear layers (like convolutions) out of the TEE to an untrusted, high-performance GPU. To preserve privacy, the TEE "blinds" the input data $X$ by adding a random cryptographic mask $R$, sending $X + R$ to the GPU. The GPU computes the forward pass on the blinded data, and the TEE subsequently unblinds the result. To ensure the untrusted GPU did not alter the computation, the authors implement highly efficient, randomized verification checks within the enclave, achieving massive throughput gains without sacrificing integrity.

   Secure TEE Enclave                          Untrusted GPU
+-----------------------+                  +--------------------+
|  Input X, Mask R      |                  |                    |
|  Compute: X + R       | --(Blinded)----> | Compute Heavy      |
|                       |                  | Matrix Mult:       |
|  Receive Result       | <--(Result)----- | W * (X + R)        |
|  Unblind & Verify     |                  |                    |
+-----------------------+                  +--------------------+

For weight protection, Xiong et al. propose LoRO, which targets the memory overhead of storing massive, unique layer masks. Instead of holding gigabytes of obfuscation matrices inside the secure enclave, LoRO uses low-rank matrix factorization and "factor multiplexing." The enclave only needs to store a tiny set of base factors, dynamically synthesizing the layer-specific masks on the fly. This mathematical compression collapses the secure memory footprint from gigabytes to megabytes, completely avoiding performance-killing memory paging.


Bypassing the Activation Memory Wall in Training

While inference is constrained by model weights, training models inside an enclave introduces an even steeper hurdle: backpropagation. Training requires storing intermediate activations for every single layer during the forward pass to compute gradients during the backward pass. As noted by Gu et al., this memory accumulation makes full-scale enclave training virtually impossible for modern architectures.

To circumvent this entirely, Feng et al. propose BAFFLE (BAckpropagation-Free Federated LEarning). Instead of performing memory-heavy backpropagation inside edge enclaves, BAFFLE relies on zero-order optimization and Stein’s identity. The enclave executes only forward passes (inference) to estimate gradients based on loss perturbations. By eliminating the need to store activation tensors entirely, the authors bypass the enclave memory wall, allowing decentralized edge devices to securely participate in collaborative training within tight hardware bounds.

Key Foundational Work

Reaching Data Confidentiality and Model Accountability on the CalTrain (2018) — contributed 1 concept elements to this direction.
Poster: Towards Characterizing and Limiting Information Exposure in DNN Layers (2019) — contributed 1 concept elements to this direction.
VoiceGuard: Secure and Private Speech Processing (2018) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_enclave_memory_limitations_a47c58c4,
  title = {enclave memory limitations},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/enclave-memory-limitations/rdr_a47c58c493d8471ca3317feef98efa4a},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-19},
}

This exact version (version 1, frozen text):

@misc{lacuna_enclave_memory_limitations_a47c58c4_v1,
  title = {enclave memory limitations},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/enclave-memory-limitations/rdr_a47c58c493d8471ca3317feef98efa4a/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-19},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake