# akumar2709/fides_asiaccs architecture

> Architecture diagram of the GitHub repository akumar2709/fides_asiaccs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akumar2709/fides_asiaccs
- Repository: https://github.com/akumar2709/fides_asiaccs

## Overview

Based on our analysis of the file tree and README, this is a research/proof-of-concept implementation for result validation in Machine Learning-as-a-Service inference. It implements several distinct pipelines (training a service model, distilling a verification model, and training a detector/corrector) and also includes an attack testing script. The system is designed to work in a secure enclave environment using Gramine-SGX, with testing examples implemented using TFLite.

##### Main Components
- Service Model Training Component – Represented by the “training” folder (training.py, function_dispatcher.py, training.json). This module is responsible for training the service (inference) model.
- Distillation Verification Component – Represented by the “distillation” folder (distillation.py, function_dispatcher.py, distillation.json). It handles the distillation process that produces a streamlined (or “distilled”) version of the model for validation purposes.
- Detector/Corrector Training Component – Represented by the detector_corrector_training.py file. This script likely trains a mechanism to detect or correct results from the inference service.
- Attack Testing Module – Represented by attack_testing.py, which simulates attacks and tests the resilience (likely in low-cost result validation of the ML inference output).

##### Interactions and Data Flow
- The training component produces the service model.
- The distillation component takes input from the service model to train a verification model.
- The detector/corrector module operates by using its own training mechanisms and/or by taking inputs from the verification and service models.
- The attack testing module interacts with one or more of these components to simulate adversarial conditions.
- Also, indicate that the SGX secure environment is a deployment target for the inference service and verification models, highlighting the connection between the system’s output (e.g., TFLite models) and secure execution.

##### Architectural Patterns
- There is a pipeline or sequential flow:
- First, training the service model.
- Second, distillation for verification.
- Third, training a detector/corrector.
- Fourth, executing attack tests.
- This might be viewed as a multi-stage experimental pipeline which validates model performance and resilience under tested attack conditions.
- Loosely coupled modules – each folder or script is largely independent but is connected by data inputs/outputs and parameter configuration (through JSON files).

##### Technologies and External Dependencies
- That Gramine-SGX (and its documentation link) is used for SGX deployment.
- Usage of TFLite for testing – include a “TensorFlow Lite” node connected to the inference models.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Training Cluster
    subgraph "Training Cluster"
        T1["Service Model Trainer"]:::training
        T2["Training Function Dispatcher"]:::training
        T3["Training Configuration (JSON)"]:::training
    end

    %% Distillation Cluster
    subgraph "Distillation Cluster"
        D1["Verification Model Distiller"]:::verification
        D2["Distillation Function Dispatcher"]:::verification
        D3["Distillation Configuration (JSON)"]:::verification
    end

    %% Security/Validation Cluster
    subgraph "Security/Validation Cluster"
        DC["Detector/Corrector Trainer"]:::security
        AT["Attack Tester"]:::security
    end

    %% Deployment/Inference Environment
    subgraph "Deployment Environment"
        SGX["Secure SGX Environment<br/>(Gramine-SGX/TFLite)"]:::external
    end

    %% Data Flow Connections
    T1 -->|"producesModel"| D1
    T2 -->|"routesData"| D2
    T3 -->|"providesConfig"| D3
    D1 -->|"suppliesVerification"| DC
    DC -->|"triggersAttackTests"| AT

    %% Deployment Connections
    T1 -->|"deploysTo"| SGX
    D1 -->|"deploysTo"| SGX

    %% Click Events
    click T1 "https://github.com/akumar2709/fides_asiaccs/blob/main/training/training.py"
    click T2 "https://github.com/akumar2709/fides_asiaccs/blob/main/training/function_dispatcher.py"
    click T3 "https://github.com/akumar2709/fides_asiaccs/blob/main/training/training.json"
    click D1 "https://github.com/akumar2709/fides_asiaccs/blob/main/distillation/distillation.py"
    click D2 "https://github.com/akumar2709/fides_asiaccs/blob/main/distillation/function_dispatcher.py"
    click D3 "https://github.com/akumar2709/fides_asiaccs/blob/main/distillation/distillation.json"
    click DC "https://github.com/akumar2709/fides_asiaccs/blob/main/detector_corrector_training.py"
    click AT "https://github.com/akumar2709/fides_asiaccs/blob/main/attack_testing.py"

    %% Styles
    classDef training fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef verification fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef security fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
