mirror of
https://github.com/luxfhe/ml-sdk.git
synced 2026-10-30 18:13:04 +00:00
# Conflicts: # .github/workflows/benchmarks.yaml # .github/workflows/cifar_benchmark.yaml # .github/workflows/continuous-integration.yaml # .github/workflows/llama_finetuning_benchmark.yaml # .github/workflows/publish_aws_ami.yaml # .github/workflows/release.yaml # .github/workflows/resnet_hybrid_model.yaml # .github/workflows/sync_on_push.yaml # .github/workflows/weekly_tests.yaml # LICENSE # Makefile # README.md # UPGRADING.md # benchmarks/common.py # ci/aws_ami_build_component.yaml # conftest.py # docs/README.md # docs/SUMMARY.md # docs/advanced_examples/ClassifierComparison.ipynb # docs/advanced_examples/FullyConnectedNeuralNetwork.ipynb # docs/advanced_examples/FullyConnectedNeuralNetworkOnMNIST.ipynb # docs/advanced_examples/GLMComparison.ipynb # docs/advanced_examples/QuantizationAwareTraining.ipynb # docs/advanced_examples/RegressorComparison.ipynb # docs/advanced_examples/SVMClassifier.ipynb # docs/advanced_examples/utils/classifier_comparison_utils.py # docs/conventions.md # docs/deep-learning/fhe_assistant.md # docs/deep-learning/fhe_friendly_models.md # docs/developer/contributing.md # docs/developer/debug_support_submit_issues.md # docs/developer/project_setup.md # docs/explanations/compilation.md # docs/explanations/pruning.md # docs/getting-started/README.md # docs/getting-started/concepts.md # docs/getting-started/pip_installing.md # docs/guides/client_server.md # docs/references/api/concrete.ml.search_parameters.p_error_search.md # docs/references/api/concrete.ml.sklearn.base.md # docs/references/api/concrete.ml.sklearn.glm.md # docs/references/api/concrete.ml.sklearn.linear_model.md # docs/references/api/concrete.ml.sklearn.neighbors.md # docs/references/api/concrete.ml.sklearn.rf.md # docs/references/api/concrete.ml.sklearn.svm.md # docs/references/api/concrete.ml.sklearn.tree.md # docs/references/api/concrete.ml.sklearn.tree_to_numpy.md # docs/references/api/concrete.ml.sklearn.xgb.md # docs/tutorials/showcase.md # pyproject.toml # script/actions_utils/monitor.py # script/doc_utils/check_forbidden_words.py # script/make_utils/check_installation_with_all_python.sh # script/make_utils/check_issues.py # script/make_utils/fix_omp_issues_for_intel_mac.sh # script/make_utils/jupyter.sh # script/make_utils/local_link_check.py # src/concrete/ml/common/serialization/__init__.py # src/concrete/ml/common/serialization/encoder.py # src/concrete/ml/common/utils.py # src/concrete/ml/deployment/fhe_client_server.py # src/concrete/ml/onnx/convert.py # src/concrete/ml/onnx/onnx_model_manipulations.py # src/concrete/ml/onnx/onnx_utils.py # src/concrete/ml/onnx/ops_impl.py # src/concrete/ml/pandas/_development.py # src/concrete/ml/pandas/_operators.py # src/concrete/ml/pandas/_processing.py # src/concrete/ml/pandas/client_engine.py # src/concrete/ml/pandas/dataframe.py # src/concrete/ml/pytest/utils.py # src/concrete/ml/quantization/base_quantized_op.py # src/concrete/ml/quantization/linear_op_glwe_backend.py # src/concrete/ml/quantization/post_training.py # src/concrete/ml/quantization/quantized_module.py # src/concrete/ml/quantization/quantized_ops.py # src/concrete/ml/quantization/quantizers.py # src/concrete/ml/search_parameters/p_error_search.py # src/concrete/ml/sklearn/_fhe_training_utils.py # src/concrete/ml/sklearn/base.py # src/concrete/ml/sklearn/glm.py # src/concrete/ml/sklearn/linear_model.py # src/concrete/ml/sklearn/neighbors.py # src/concrete/ml/sklearn/qnn.py # src/concrete/ml/sklearn/tree_to_numpy.py # src/concrete/ml/sklearn/xgb.py # src/concrete/ml/torch/compile.py # src/concrete/ml/torch/hybrid_model.py # src/concrete/ml/torch/lora.py # tests/common/test_pbs_error_probability_settings.py # tests/common/test_serialization.py # tests/deployment/test_client_server.py # tests/onnx/test_onnx_utils.py # tests/pandas/test_pandas.py # tests/parameter_search/test_p_error_binary_search.py # tests/quantization/test_compilation.py # tests/quantization/test_quantized_module.py # tests/quantization/test_quantized_ops.py # tests/sklearn/test_dump_onnx.py # tests/sklearn/test_sklearn_models.py # tests/torch/test_brevitas_qat.py # tests/torch/test_compile_keras.py # tests/torch/test_compile_torch.py # tests/torch/test_torch_to_numpy.py # tests/torch/test_training.py # use_case_examples/cifar/README.md # use_case_examples/cifar/cifar_brevitas_finetuning/PerrorImpactOnFMNIST.ipynb # use_case_examples/cifar/cifar_brevitas_finetuning/README.md # use_case_examples/cifar/cifar_brevitas_finetuning/cifar_utils.py # use_case_examples/cifar/cifar_brevitas_training/evaluate_one_example_fhe.py # use_case_examples/cifar/cifar_brevitas_training/evaluate_torch_cml.py # use_case_examples/cifar/cifar_brevitas_training/trainer.py # use_case_examples/credit_card_approval_prediction/README.md # use_case_examples/deployment/sentiment_analysis/train.py # use_case_examples/deployment/server/deploy_to_docker.py # use_case_examples/disease_prediction/HealthCarePrediction.ipynb # use_case_examples/image_filtering/README.md # use_case_examples/llm/README.md # use_case_examples/llm/quant_framework.py # use_case_examples/lora_finetuning/README.md # use_case_examples/lora_finetuning/data_finetune/what_is_fhe.txt # use_case_examples/sentiment_analysis_with_transformer/SentimentClassification.ipynb # use_case_examples/titanic/KaggleTitanic.ipynb # use_case_examples/titanic/README.md # use_case_examples/white_paper_experiment/WhitePaperExperiments.ipynb
CIFAR-10 and CIFAR-100 Classification with FHE
This repository provides resources and documentation on different use-cases for classifying CIFAR-10 and CIFAR-100 images using Fully Homomorphic Encryption (FHE). Each use-case demonstrates different techniques and adaptations to work within the constraints of FHE.Notably, a fine-tuning from a public pre-trained model, a training from scratch using quantization aware training (QAT) and finally a hybrid approach where only a subset of the model is done in FHE.
Table of Contents
Use cases
Fine-Tuning CIFAR
- Description: This use-case explores how to convert a pre-trained CNN (on imagenet) to its FHE equivalent using Quantization Aware Training (QAT) and TorusML. The conversion process involves adapting a VGG11 network and quantizing the network for FHE.
Notebooks:
- Adapting VGG11 for CIFAR datasets.
- Quantizing the pre-trained network.
- Computing the accuracy of the quantized models with FHE simulation.
- Enhancing inference time in FHE using smaller accumulators.
Training Ternary VGG on CIFAR10
- Description: Train a VGG-like neural network from scratch using Brevitas on CIFAR-10 and run it in FHE. This use-case modifies the original VGG model for compatibility with TorusML, and explores the performance gains of rounding operations in FHE.
- Training & Inference: Scripts provided to train the network and evaluate its performance. It also includes simulations in TorusML and insights into the performance enhancement using rounding.
Installation
All use-cases can be quickly set up with:
pip install -r requirements.txt