# google/fully-homomorphic-encryption architecture

> Architecture diagram of the GitHub repository google/fully-homomorphic-encryption, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/google/fully-homomorphic-encryption
- Repository: https://github.com/google/fully-homomorphic-encryption

## Overview

This tree is a collection of FHE demonstration workloads, not the HEIR compiler itself. The intended user journey is to prepare or export a model, compare cleartext inference with encrypted evaluation, and inspect the resulting inference or performance. The README describes model conversion, multiple FHE schemes/backends, and encrypted computation, but only go.mod was sampled; the demo-specific connections below are therefore dashed and unverified.

Main entry points: [`demos/cc_fraud/lattigo/evaluate_fhe.go`](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe.go) (Encrypted evaluation), [`demos/cc_fraud/torch/export_mlir.py`](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/torch/export_mlir.py) (MLIR export), [`demos/cc_fraud/cleartext/evaluate_cleartext.py`](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/cleartext/evaluate_cleartext.py) (Cleartext evaluation), [`demos/cc_fraud/train/train.py`](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/train/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workloads["Demo Workloads"]
  node_fraud["Fraud detection"]
  node_criteo["Criteo inference"]
  node_hotword["Hotword inference"]
  node_mnist["MNIST inference"]
  node_network["Network anomaly"]
end

subgraph group_model_prep["Model Preparation"]
  node_training["Model training<br/>[train.py]"]
  node_prep["Data preparation"]
  node_export["MLIR export<br/>[export_mlir.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_cleartext["Cleartext evaluation"]
  node_fhe_eval["Encrypted evaluation<br/>[evaluate_fhe.go]"]
  node_suites["Evaluation suites"]
  node_timing["Timing analysis"]
  node_result["Decrypted result"]
end

subgraph group_backends["FHE Backends"]
  node_lattigo["Lattigo backend"]
  node_openfhe["OpenFHE backend"]
end

node_developer(("Demo user"))

node_developer -.->|"runs demo"| node_fraud
node_developer -.->|"runs demo"| node_criteo
node_developer -.->|"runs demo"| node_hotword
node_developer -.->|"runs demo"| node_mnist
node_developer -.->|"runs demo"| node_network
node_training -.->|"exports model"| node_export
node_prep -.->|"supplies data"| node_cleartext
node_export -.->|"supplies model"| node_fhe_eval
node_cleartext -.->|"compares inference"| node_fhe_eval
node_fhe_eval -.->|"uses backend"| node_lattigo
node_fhe_eval -.->|"uses backend"| node_openfhe
node_fhe_eval -.->|"decrypts output"| node_result
node_developer -.->|"runs suite"| node_suites
node_developer -.->|"measures runtime"| node_timing

click node_fraud "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud"
click node_criteo "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/criteo"
click node_hotword "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/hotword"
click node_mnist "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/mnist"
click node_network "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/network_anomaly"
click node_training "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/train/train.py"
click node_prep "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/utils"
click node_export "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/torch/export_mlir.py"
click node_cleartext "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/cleartext/evaluate_cleartext.py"
click node_fhe_eval "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe.go"
click node_suites "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe_suite.go"
click node_timing "https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe_timing.go"
click node_lattigo "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/lattigo"
click node_openfhe "https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/openfhe"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_fraud,node_criteo,node_hotword,node_mnist,node_network,node_developer toneBlue
class node_training,node_prep,node_export toneAmber
class node_cleartext,node_fhe_eval,node_suites,node_timing,node_result toneMint
class node_lattigo,node_openfhe toneRose
```

## Components

### Demo Workloads

- [Fraud detection](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud): `demos/cc_fraud`
- [Criteo inference](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/criteo): `demos/criteo`
- [Hotword inference](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/hotword): `demos/hotword`
- [MNIST inference](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/mnist): `demos/mnist`
- [Network anomaly](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/network_anomaly): `demos/network_anomaly`

### Model Preparation

- [Model training](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/train/train.py): `demos/cc_fraud/train/train.py`
- [Data preparation](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/utils): `demos/cc_fraud/utils`
- [MLIR export](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/torch/export_mlir.py): `demos/cc_fraud/torch/export_mlir.py`

### Evaluation

- [Cleartext evaluation](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/cleartext/evaluate_cleartext.py): `demos/cc_fraud/cleartext/evaluate_cleartext.py`
- [Encrypted evaluation](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe.go): `demos/cc_fraud/lattigo/evaluate_fhe.go`
- [Evaluation suites](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe_suite.go): `demos/cc_fraud/lattigo/evaluate_fhe_suite.go`
- [Timing analysis](https://github.com/google/fully-homomorphic-encryption/blob/main/demos/cc_fraud/lattigo/evaluate_fhe_timing.go): `demos/cc_fraud/lattigo/evaluate_fhe_timing.go`
- **Decrypted result**

### FHE Backends

- [Lattigo backend](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/lattigo): `demos/cc_fraud/lattigo`
- [OpenFHE backend](https://github.com/google/fully-homomorphic-encryption/tree/main/demos/cc_fraud/openfhe): `demos/cc_fraud/openfhe`

### Other components

- **Demo user**

## Connections

- Demo user → Fraud detection: runs demo
- Demo user → Criteo inference: runs demo
- Demo user → Hotword inference: runs demo
- Demo user → MNIST inference: runs demo
- Demo user → Network anomaly: runs demo
- Model training → MLIR export: exports model
- Data preparation → Cleartext evaluation: supplies data
- MLIR export → Encrypted evaluation: supplies model
- Cleartext evaluation → Encrypted evaluation: compares inference
- Encrypted evaluation → Lattigo backend: uses backend
- Encrypted evaluation → OpenFHE backend: uses backend
- Encrypted evaluation → Decrypted result: decrypts output
- Demo user → Evaluation suites: runs suite
- Demo user → Timing analysis: measures runtime
