# microsoft/olive architecture

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

- Interactive diagram: https://gitdiagram.com/microsoft/olive
- Repository: https://github.com/microsoft/olive

## Overview

##### Main Components Identification
The system should be divided into these major components:

a) Core Engine Layer:
- Model Management (/olive/model/)
- Evaluation System (/olive/evaluator/)
- Pass System (/olive/passes/)
- Workflow Engine (/olive/workflows/)
- Cache System (/olive/cache.py)

b) Platform Support Layer:
- Systems Management (/olive/systems/)
- Hardware Abstraction (/olive/hardware/)
- Platform SDKs (/olive/platform_sdk/)

c) Interface Layer:
- CLI Interface (/olive/cli/)
- Data Management (/olive/data/)
- Configuration Management

##### Component Relationships

**[User Interface Layer]**
- CLI <-> Auto Optimizer
- ↓
**[Core Processing Layer]**
- Workflow Engine
- ↓
**[Optimization Layer]**
- Passes System <-> Model Management
- ↓
**[Execution Layer]**
- Systems Management <-> Platform SDKs
- ↓
**[Hardware Layer]**
- Hardware Abstraction

##### Detailed Component Breakdown

For each major component, include:
- Input/Output interfaces
- Key subcomponents
- External dependencies
- Configuration points

##### Notes for Implementation
- Use clear hierarchical layout
- Version information
- Extensibility points
- Optional components

##### The automated optimization workflow

Remember to maintain a balance between detail and clarity, focusing on the key architectural decisions while avoiding overwhelming detail at the implementation level.

This system design should help developers understand both the high-level architecture and the specific components they need to work with when extending or modifying the system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef interface fill:#B3D9FF,stroke:#333,stroke-width:2px
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef optimization fill:#FFB366,stroke:#333,stroke-width:2px
    classDef execution fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef hardware fill:#D3D3D3,stroke:#333,stroke-width:2px
    
    %% User Interface Layer
    subgraph UI[User Interface Layer]
        CLI["CLI Interface"]
        AUTO["Auto Optimizer"]
        CLI <--> AUTO
    end
    
    %% Core Processing Layer
    subgraph CORE[Core Processing Layer]
        WF["Workflow Engine"]
        CACHE["Cache System"]
        DATA["Data Management"]
        CONFIG["Configuration Management"]
        
        WF <--> CACHE
        WF <--> DATA
        WF <--> CONFIG
    end
    
    %% Optimization Layer
    subgraph OPT[Optimization Layer]
        PASSES["Pass System"]
        MODEL["Model Management"]
        EVAL["Evaluation System"]
        
        PASSES <--> MODEL
        MODEL <--> EVAL
    end
    
    %% Execution Layer
    subgraph EXEC[Execution Layer]
        SYS["Systems Management"]
        SDK["Platform SDKs"]
        
        SYS <--> SDK
    end
    
    %% Hardware Layer
    subgraph HW[Hardware Layer]
        HARDWARE["Hardware Abstraction"]
    end
    
    %% Integration Points
    subgraph INT[Integration Points]
        ONNX["ONNX Runtime"]
        HF["Hugging Face"]
        AZURE["Azure AI"]
        MLFLOW["MLflow"]
    end
    
    %% Connections between layers
    UI --> CORE
    CORE --> OPT
    OPT --> EXEC
    EXEC --> HW
    
    %% Integration connections
    OPT -.-> INT
    EXEC -.-> INT
    
    %% Click events for component mapping
    click CLI "https://github.com/microsoft/Olive/tree/main/olive/cli/"
    click AUTO "https://github.com/microsoft/Olive/tree/main/olive/auto_optimizer/"
    click WF "https://github.com/microsoft/Olive/tree/main/olive/workflows/"
    click CACHE "https://github.com/microsoft/Olive/blob/main/olive/cache.py"
    click DATA "https://github.com/microsoft/Olive/tree/main/olive/data/"
    click PASSES "https://github.com/microsoft/Olive/tree/main/olive/passes/"
    click MODEL "https://github.com/microsoft/Olive/tree/main/olive/model/"
    click EVAL "https://github.com/microsoft/Olive/tree/main/olive/evaluator/"
    click SYS "https://github.com/microsoft/Olive/tree/main/olive/systems/"
    click SDK "https://github.com/microsoft/Olive/tree/main/olive/platform_sdk/"
    click HARDWARE "https://github.com/microsoft/Olive/tree/main/olive/hardware/"
    
    %% Legend
    subgraph Legend
        UI_L["User Interface"]:::interface
        CORE_L["Core Processing"]:::core
        OPT_L["Optimization"]:::optimization
        EXEC_L["Execution"]:::execution
        HW_L["Hardware"]:::hardware
        FLOW["--> Control Flow"]
        INT_FLOW["--> Integration"]
    end
```
