Binary Usage and Configuration
All compiled FHEON model binaries (such as LeNet5, ResNet20Basic, ResNet20Diagonal, BResNet20N16 or tuneResNet20) accept command-line options to configure runtime behaviors dynamically.
This configuration is processed in the global utils::parse_runtime_args helper function to set runtime parameters, dataset paths, weights directories, and prediction file outputs.
Example Usage
To run the LeNet5 binary with customized configuration:
./LeNet5 --verbose 2 --test-size 2 --index-value 0 --weights-folder "./../weights/lenet5/" --prediction-file "./../results/lenet5/fhepredictions.txt" --keys-folder "../AllHEKeys"
Parameter Documentation
The following options can be passed to configure runtime behavior:
Parameter |
Description |
Default Value |
|---|---|---|
|
The number of input images to process during the inference evaluation. Batch programs take any number: they run batches (or pipeline groups) of their batch size and complete the last one with blank images, which are not reported. |
Model-dependent default (e.g., |
|
The start index for reading images from the dataset, allowing evaluations on specific slices of data. |
|
|
Verbosity level. Controls timing and telemetry output ( |
|
|
Largest number of worker threads of the multithreaded programs (the standard batch models and the training) and
of the batched bootstrapping. Every worker
holds its own ciphertexts and bootstrapping temporaries, so fewer workers trade a little speed for much less
memory. |
All the system threads |
|
Directory path where serialized evaluation keys and context are stored or loaded. |
|
|
Directory path containing the model weights and biases CSV files. |
|
|
Training models: directory of the encrypted parameters and of the caches of the forward pass. |
|
|
File path where model prediction outputs (inferred labels) are written. (Aliases: |
|
|
Globally overrides the path to the dataset. (Alias: |
Model-dependent path |
|
Specifies the CIFAR-10 test batch binary file path. |
|
|
Specifies the CIFAR-100 test binary file path. |
|
|
Specifies the MNIST dataset images file path. |
|
|
If true (or given without a value), reloads the context and keys from serialized files on disk instead of generating new ones. |
|
|
Measures and prints the peak memory of every layer. |
|
Importance of Configuration Parameters
These configuration parameters play a critical role in the usability, portability, and optimization of FHEON models:
Flexibility and Path Portability: In homomorphic encryption frameworks, file structures (like directories for weights, keys, and datasets) vary between different execution environments (e.g., local machines, HPC clusters). Instead of hardcoding paths,
--weights-folder,--keys-folder, and dataset paths enable execution anywhere without recompiling the binary.Automatic Dataset Path Resolution: Depending on the executable name (resolved automatically inside
parse_runtime_args), the framework maps the active dataset. For example, if the binary name containslenetormnist(case-insensitive), it defaults to the MNIST dataset, whereas a name containingresnet34(ResNet34,BResNet34N16,ResNet34Diagonal, …) maps to CIFAR-100, and other models map to CIFAR-10. This default behavior can be overridden using--images-pathor dataset-specific options.Key Serialization and Performance Optimization: Generating homomorphic encryption keys (especially rotation and bootstrapping keys) is computationally expensive. Setting
--keys-folderand--load-context trueenables reusing serialized keys from past runs, avoiding redundant key generation overhead and speeding up test executions.Output Logging and Telemetry: The
--verboseparameter dictates the amount of console logging. High verbosity allows auditing execution timings of individual layers (convolutions, activations, pooling), which is vital for evaluating FHE performance bottlenecks. The--prediction-fileautomates output validation and stores predicted results for batch analysis.
Model-specific Options
The training model tuneResNet20 also reads --training-data-dir, the folder that keeps its encrypted parameters
between steps (see Training and Fine-Tuning Examples).