VGG-11 FHE Implementation
This page demonstrates the VGG-11 inference workflow using FHEON. It highlights the use of optimized convolution, bootstrapping, and fully connected layers for encrypted CIFAR-10 inference.
Overview
The workflow consists of:
Context and Key Generation
Initializes FHEONHEController with parameters such as ring degree, slots, depth, and modulus chain.
Generates rotation keys for convolution, average pooling, and fully connected layers.
Keys are merged, deduplicated, and serialized for reuse.
Data Preparation
Loads CIFAR-10 test images from binary format.
Normalizes pixel values and encrypts them into ciphertext vectors.
VGG-11 Layers
Implements convolution + ReLU blocks with optional bootstrapping.
Average pooling reduces spatial dimensions between stages.
Fully connected layers finalize classification.
Bootstrapping is applied at critical points to refresh ciphertext precision.
Inference Loop
Iterates over encrypted CIFAR-10 images.
Sequentially applies convolution blocks, pooling, bootstrapping, and fully connected layers.
Decrypts outputs and writes predicted labels to file.
Key Functions
Controller functions used in this example:
he_convolution_optimized()– 3x3 “same” convolution with hoisted rotations.he_avgpool_optimzed_with_multiple_channels()– Average pooling that also compacts the channels for the next stage.he_globalavgpool()– Global average pooling.he_linear()– Fully connected layer.he_relu()– Chebyshev approximation of ReLU.bootstrap_function()– CKKS bootstrapping to refresh the ciphertext levels.encode_kernel_optimized()– Encodes the 3x3 kernels with their padding masks.
Functions of the example:
convolution_relu_block()– Convolution followed by ReLU (and bootstrapping).FClayer_relu_block()– Fully connected layer followed by ReLU.
Full Example Source
You can view the full optimized VGG-11 implementation here: