FHEON’s Controllers
FHEON’s functions are grouped into controllers. A model creates the controllers it needs, gives them the CKKS context of the Homomorphic Encryption Controller, and calls their primitives layer after layer.
Inference controllers
The inference controllers cover two layouts for single inputs, and the standard layout for batches:
Pipeline |
Controller |
|---|---|
Single input, standard |
FHEONANNStandardController: one channel per slot block, convolutions folded over the input channels. Sequential. |
Single input, diagonal (FHEON-D) |
FHEONANNDiagonalController: channels mixed with diagonals, a convolution costs 8 hoisted rotations, one rotation per diagonal and a single level. Sequential. |
Batch of inputs, standard |
FHEONANNStandardBatchController: one channel of the whole batch per ciphertext, evaluated by its multithreaded version FHEONANNStandardBatchThreadedController. |
The standard and diagonal single-input controllers share one interface (same primitive names and arguments, plus the
encode_* helpers), so a model switches layout by changing only the controller type. The diagonal layout is
described in Diagonal Primitives (FHEON-D).
The models use the aliases ANNStandardController and ANNDiagonalController (the sequential controllers) and
ANNStandardBatchController, which names the multithreaded batch controller in the batch models (CMake defines
FHEON_THREADED for them, see Getting Started with FHEON). The batch models take --threads N to cap their worker
threads (and their memory; see Binary Usage and Configuration).
Training controllers
Encrypted training splits each layer into a forward pass primitive, which also caches what the gradient needs, and a backward pass primitive, which returns the input gradient and applies the SGD update to the encrypted parameters. See Encrypted Training.
Training uses the standard layout:
Standard layout |
|
|---|---|
Support |
|
Forward pass |
FHEONTrainForwardPassController, multithreaded: FHEONTrainStandardForwardPassController |
Backward pass |
FHEONTrainBackwardPassController, multithreaded: FHEONTrainStandardBackwardPassController |