Convolutional networks · Strategy 1

Pre-encryption spatial feature extraction

Tensorlock's shuffle and rotation remove the pixel neighborhoods that convolution needs. In this strategy, the data owner runs a small convolutional network on the plaintext examples to create convolved and pooled examples, then encrypts the image and its pooled feature maps, each with its own key. The AI company trains fully connected networks on the ciphertext alone.

Dataset Fashion-MNIST Extractor 24 / 48 channels Padding PCA, interlaced, 20% Perturbation nonlinear, ±0.10

Who does what

Party A, the data owner, holds the plaintext and every key. It trains a small convolutional neural network (CNN) on its own data and freezes it. The frozen layers turn each image into feature maps, and Party A encrypts the image (x) and the pooled maps (P1, P2) separately.

Party B, the AI company, receives only ciphertext and labels. Training needs no contact with Party A. At inference, Party A's oracle repeats the same pipeline and returns only a label.

Data owner (A) AI company (B) Training data New example Pretrain small CNN on own plaintext Frozen extractor Conv, ReLU, pool Weights stay here Encryption One key per representation Encrypted x, P1, P2 Encrypted Training Dense branches Model Freeze x, P1, P2 x, P1, P2 Prediction
Top: training. Bottom: inference through Party A's oracle. Plaintext, feature maps, extractor weights and keys stay inside the green outline. Thumbnails are real Fashion-MNIST test images, their pooled feature maps and their encryptions.

Step 1Party A trains a small CNN, then freezes it

Party A trains two convolution blocks and a small classifier head on its own plaintext training split. It then freezes the network. From here on the kernels never change, and Party A treats the weights as key material. The head is discarded; only the pooled outputs are kept.

Choose a test image

The chosen image's feature maps, from a copy of the frozen extractor with the same architecture; the trained weights themselves stay with Party A. Each tile is one channel, scaled by that representation's 99.9th percentile, so bright means a strong ReLU response.
Architecture
conv 24 → conv 48, 3 × 3
Pooling
2 × 2 max-pool after each conv
Head
Linear 128, then discarded

Step 2Each representation gets its own key

Party A flattens each representation into a vector and applies the same four Tensorlock steps used for raw images: padding, perturbation, a fixed shuffle and a random orthogonal transformation. Each representation has its own padding positions, permutation and matrix, so a key for one reveals nothing about another.

Left of each arrow: the plaintext representation. Right: the ciphertext Party B receives, drawn 28 values per row for x and as a near-square grid for the feature maps.

Step 3Party B trains dense networks on ciphertext

Party B's network is fully connected. Each encrypted representation feeds its own branch, the same two hidden layers as the fully connected network (fcANN) in the initial Tensorlock manuscript. The branch outputs are joined and passed to shared layers. With one representation, the network is the fcANN itself.

The result is an encrypted classifier over fixed spatial features: the convolution kernels sit outside the trainable network.

AI company (B) z(x) 941 values Branch x Dense 512 → 256 z(P1) 5,645 values Branch P1 Dense 512 → 256 z(P2) 2,822 values Branch P2 Dense 512 → 256 Concatenate 768 values Shared Dense 256 Softmax 10 classes

What the frozen features add

In the Fashion-MNIST run, the dense network on encrypted P2 reached 0.924 test accuracy, against 0.890 on the encrypted raw image.

Each encrypted network has a plaintext twin with the same architecture and settings. The gap between the two measures what encryption costs on the same features. Here the encrypted networks on the raw image and on P2 were within 0.1 percentage points of their twins; on P1 the encrypted network was 1.3 points lower.

0.88 0.89 0.90 0.91 0.92 0.93 Test accuracy Raw image x P1 P2 x + P1 + P2 Plaintext twin Encrypted (Party B)
One run: extractor 24/48 channels, 20 epochs; dense networks 512/256, 20 epochs; PCA padding 20%, interlaced; nonlinear perturbation ±0.10. Validation uses the test split. Single runs carry run-to-run variation of a few tenths of a point.
Dense network onWidth DPlaintext twinEncryptedEncrypted − twinAgreementYule's Q
Raw image x 941 0.8894 0.8902 +0.0008 0.9312 0.9642
P1 5,645 0.9151 0.9021 −0.0130 0.9318 0.9563
P2 2,822 0.9236 0.9242 +0.0006 0.9530 0.9770
x + P1 + P2 9,408 0.9227 0.9179 −0.0048 0.9466 0.9706

Results on other datasets

The same experiment was run on ten more datasets: natural images (CIFAR-10), handwritten letters (EMNIST Letters), and four MedMNIST medical image sets at both 28 × 28 and 64 × 64 pixels. For each, the chart compares the raw image with the most accurate encrypted network on extractor features, and each network with its plaintext twin.

Choose a dataset

Dense network onWidth DPlaintext twinEncryptedEncrypted − twinAgreementYule's Q

Inference

Inference repeats the training pipeline exactly. Party A's inference oracle passes a new image through the frozen extractor, encrypts each representation with the stored key (with fresh padding and perturbation draws), runs the trained network and returns only the label. Party B never sees plaintext or an unencrypted feature map.