Arion is a high-performance framework for privacy-preserving machine learning inference using Fully Homomorphic Encryption (FHE). It is specifically designed to accelerate the inference of Transformer-based models (e.g., BERT-Base) on encrypted data.
Core to Arion is the Double Baby-Step Giant-Step (Double-BSGS) algorithm, which significantly reduces the computational complexity of attention mechanisms from linear to square root scaling ($O(\sqrt{m})$).
- Optimized Attention Mechanism: Implements the Double-BSGS algorithm to minimize rotation keys and computational overhead in the Attention layer.
- End-to-End BERT Inference: Supports fully encrypted inference for BERT-Tiny and BERT-Base architectures.
- Multi-Threading Support: Leveraging Go's concurrency with 64 threads to execute high-performance parallel matrix operations .
- Flexible Security Parameters: Pre-configured settings for various testing scales:
- Tiny:
logN=6(Fast debugging) - Short:
logN=10(Correctness verification) - Base:
logN=16(Production-grade security & accuracy)
- Tiny:
-
Clone the repository
git clone https://github.com/hangenba/Arion.git cd Arion -
Install dependencies
go mod tidy
-
Prepare Model Data Ensure your pre-trained model weights and input samples are placed in the directory (e.g.,
bert_base_data,bert_tiny_data). Tip: After end-to-end execution, all inference results and benchmark logs are automatically saved to theoutput/directory.
Arion provides an interactive Command Line Interface (CLI) to simplify benchmarking and testing.
Run the main entry point:
go run main.go