# gat45/profiler-v3 architecture

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

- Interactive diagram: https://gitdiagram.com/gat45/profiler-v3
- Repository: https://github.com/gat45/profiler-v3

## Overview

GenieX Profiler aide à décider si un modèle LLM peut être quantifié et exécuté sur Android : il inspecte les poids, estime mémoire et compatibilité, prépare éventuellement un candidat, puis distingue validation qualité et preuve mesurée sur appareil. Des branches complémentaires prédisent des modèles Hugging Face, analysent les poids échantillonnés et consolident les profils CPU/GPU/HTP et les ratios. Le dépôt inclut aussi une application Android de suivi matériel et de télémétrie. Les liens entre modules non échantillonnés ne sont retenus que lorsqu’ils sont explicitement documentés; les intégrations device sont signalées comme optionnelles.

Main entry points: [`analyze_ratio_campaign.py`](https://github.com/gat45/profiler-v3/blob/main/analyze_ratio_campaign.py) (Fusion de campagnes), [`profiler.py`](https://github.com/gat45/profiler-v3/blob/main/profiler.py) (Profilage et rapport), [`predict_quantization.py`](https://github.com/gat45/profiler-v3/blob/main/predict_quantization.py) (Prédiction quantification), [`full_quant_pipeline.py`](https://github.com/gat45/profiler-v3/blob/main/full_quant_pipeline.py) (Pipeline de validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inspection["Inspection et estimation"]
  node_tensor_sources["Accès aux tenseurs<br/>[tensor_sources.py]"]
  node_profile_model["Analyse de modèle<br/>[profile_model.py]"]
  node_formats["Catalogue de formats<br/>[quant_formats.py]"]
  node_capabilities[("Capacités backend<br/>[capability_db.py]")]
  node_profiler["Profilage et rapport<br/>[profiler.py]"]
  node_hf_predict["Prédiction HF<br/>[predict_from_hf.py]"]
  node_hf_v4["Comparaison HF v4"]
  node_hf_v5["Formats HF v5"]
end

subgraph group_quant["Quantification et validation"]
  node_weight_sampling["Échantillonnage des poids<br/>[weight_sampler.py]"]
  node_quant_prediction["Prédiction quantification"]
  node_conversion_plan["Plan et conversion<br/>[fix_htp_model.py]"]
  node_pipeline["Pipeline de validation"]
  node_quality_gate["Gate qualité PPL<br/>[quality_gate.py]"]
end

subgraph group_measurement["Mesure et analyses"]
  node_htp_parser["Analyse trace HTP"]
  node_opencl_parser["Analyse traces CPU/GPU"]
  node_copy_parser["Analyse copies backend"]
  node_campaign["Fusion de campagnes"]
end

subgraph group_android["Outils Android"]
  node_android_main["Écran de monitoring<br/>[MainActivity.kt]"]
  node_telemetry["Serveur télémétrie<br/>[TelemetryServer.kt]"]
  node_file_browser["Navigateur de fichiers"]
  node_android_predictor["Prédicteur embarqué HF<br/>[HfPredictor.kt]"]
end

node_user(("Ingénieur"))
node_model_sources["GGUF / Safetensors / HF"]
node_device["Appareil Android"]

node_user -->|"lance le profilage"| node_profiler
node_model_sources -->|"fournit les en-têtes"| node_profile_model
node_profile_model -->|"interprète les types"| node_formats
node_profiler -->|"analyse le modèle"| node_profile_model
node_profiler -->|"évalue les risques"| node_capabilities
node_user -->|"demande une prédiction"| node_hf_predict
node_hf_v4 -->|"reprend la base"| node_hf_predict
node_hf_v5 -->|"étend la comparaison"| node_hf_v4
node_model_sources -->|"expose les plages"| node_tensor_sources
node_user -->|"échantillonne les poids"| node_quant_prediction
node_quant_prediction -->|"lit les tenseurs"| node_tensor_sources
node_quant_prediction -->|"évalue des blocs"| node_weight_sampling
node_user -->|"exécute la validation"| node_pipeline
node_pipeline -->|"génère le candidat"| node_conversion_plan
node_pipeline -->|"vérifie la qualité"| node_quality_gate
node_quality_gate -->|"compare référence et candidat"| node_model_sources
node_device -.->|"fournit une trace"| node_htp_parser
node_device -.->|"fournit des profils"| node_opencl_parser
node_device -.->|"fournit les copies"| node_copy_parser
node_user -->|"fusionne les campagnes"| node_campaign
node_campaign -->|"combine les mesures"| node_htp_parser
node_campaign -->|"combine les mesures"| node_opencl_parser
node_campaign -->|"combine les mesures"| node_copy_parser
node_android_main -->|"démarre le serveur"| node_telemetry
node_user -->|"consulte le monitoring"| node_android_main
node_user -.->|"choisit un modèle"| node_file_browser

click node_tensor_sources "https://github.com/gat45/profiler-v3/blob/main/tensor_sources.py"
click node_profile_model "https://github.com/gat45/profiler-v3/blob/main/profile_model.py"
click node_formats "https://github.com/gat45/profiler-v3/blob/main/quant_formats.py"
click node_capabilities "https://github.com/gat45/profiler-v3/blob/main/capability_db.py"
click node_profiler "https://github.com/gat45/profiler-v3/blob/main/profiler.py"
click node_hf_predict "https://github.com/gat45/profiler-v3/blob/main/predict_from_hf.py"
click node_hf_v4 "https://github.com/gat45/profiler-v3/blob/main/predict_from_hf_v4.py"
click node_hf_v5 "https://github.com/gat45/profiler-v3/blob/main/predict_from_hf_v5.py"
click node_weight_sampling "https://github.com/gat45/profiler-v3/blob/main/weight_sampler.py"
click node_quant_prediction "https://github.com/gat45/profiler-v3/blob/main/predict_quantization.py"
click node_conversion_plan "https://github.com/gat45/profiler-v3/blob/main/fix_htp_model.py"
click node_pipeline "https://github.com/gat45/profiler-v3/blob/main/full_quant_pipeline.py"
click node_quality_gate "https://github.com/gat45/profiler-v3/blob/main/quality_gate.py"
click node_htp_parser "https://github.com/gat45/profiler-v3/blob/main/parse_hexagon_profile.py"
click node_opencl_parser "https://github.com/gat45/profiler-v3/blob/main/parse_opencl_profile.py"
click node_copy_parser "https://github.com/gat45/profiler-v3/blob/main/parse_backend_copy_profile.py"
click node_campaign "https://github.com/gat45/profiler-v3/blob/main/analyze_ratio_campaign.py"
click node_android_main "https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/MainActivity.kt"
click node_telemetry "https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/TelemetryServer.kt"
click node_file_browser "https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/FileBrowserActivity.kt"
click node_android_predictor "https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/HfPredictor.kt"

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_tensor_sources,node_profile_model,node_formats,node_capabilities,node_profiler,node_hf_predict,node_hf_v4,node_hf_v5 toneBlue
class node_weight_sampling,node_quant_prediction,node_conversion_plan,node_pipeline,node_quality_gate toneAmber
class node_htp_parser,node_opencl_parser,node_copy_parser,node_campaign toneMint
class node_android_main,node_telemetry,node_file_browser,node_android_predictor toneRose
class node_user,node_model_sources,node_device toneIndigo
```

## Components

### Inspection et estimation

- [Accès aux tenseurs](https://github.com/gat45/profiler-v3/blob/main/tensor_sources.py): `tensor_sources.py`
- [Analyse de modèle](https://github.com/gat45/profiler-v3/blob/main/profile_model.py): `profile_model.py`
- [Catalogue de formats](https://github.com/gat45/profiler-v3/blob/main/quant_formats.py): `quant_formats.py`
- [Capacités backend](https://github.com/gat45/profiler-v3/blob/main/capability_db.py): `capability_db.py`
- [Profilage et rapport](https://github.com/gat45/profiler-v3/blob/main/profiler.py): `profiler.py`
- [Prédiction HF](https://github.com/gat45/profiler-v3/blob/main/predict_from_hf.py): `predict_from_hf.py`
- [Comparaison HF v4](https://github.com/gat45/profiler-v3/blob/main/predict_from_hf_v4.py): `predict_from_hf_v4.py`
- [Formats HF v5](https://github.com/gat45/profiler-v3/blob/main/predict_from_hf_v5.py): `predict_from_hf_v5.py`

### Quantification et validation

- [Échantillonnage des poids](https://github.com/gat45/profiler-v3/blob/main/weight_sampler.py): `weight_sampler.py`
- [Prédiction quantification](https://github.com/gat45/profiler-v3/blob/main/predict_quantization.py): `predict_quantization.py`
- [Plan et conversion](https://github.com/gat45/profiler-v3/blob/main/fix_htp_model.py): `fix_htp_model.py`
- [Pipeline de validation](https://github.com/gat45/profiler-v3/blob/main/full_quant_pipeline.py): `full_quant_pipeline.py`
- [Gate qualité PPL](https://github.com/gat45/profiler-v3/blob/main/quality_gate.py): `quality_gate.py`

### Mesure et analyses

- [Analyse trace HTP](https://github.com/gat45/profiler-v3/blob/main/parse_hexagon_profile.py): `parse_hexagon_profile.py`
- [Analyse traces CPU/GPU](https://github.com/gat45/profiler-v3/blob/main/parse_opencl_profile.py): `parse_opencl_profile.py`
- [Analyse copies backend](https://github.com/gat45/profiler-v3/blob/main/parse_backend_copy_profile.py): `parse_backend_copy_profile.py`
- [Fusion de campagnes](https://github.com/gat45/profiler-v3/blob/main/analyze_ratio_campaign.py): `analyze_ratio_campaign.py`

### Outils Android

- [Écran de monitoring](https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/MainActivity.kt): `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/MainActivity.kt`
- [Serveur télémétrie](https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/TelemetryServer.kt): `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/TelemetryServer.kt`
- [Navigateur de fichiers](https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/FileBrowserActivity.kt): `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/FileBrowserActivity.kt`
- [Prédicteur embarqué HF](https://github.com/gat45/profiler-v3/blob/main/android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/HfPredictor.kt): `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/HfPredictor.kt`

### Other components

- **Ingénieur**
- **GGUF / Safetensors / HF**
- **Appareil Android**

## Connections

- Ingénieur → Profilage et rapport: lance le profilage (evidence: `README.md`)
- GGUF / Safetensors / HF → Analyse de modèle: fournit les en-têtes (evidence: `README.md`)
- Analyse de modèle → Catalogue de formats: interprète les types (evidence: `profile_model.py`)
- Profilage et rapport → Analyse de modèle: analyse le modèle (evidence: `profiler.py`)
- Profilage et rapport → Capacités backend: évalue les risques (evidence: `profiler.py`)
- Ingénieur → Prédiction HF: demande une prédiction (evidence: `README.md`)
- Comparaison HF v4 → Prédiction HF: reprend la base (evidence: `predict_from_hf_v4.py`)
- Formats HF v5 → Comparaison HF v4: étend la comparaison (evidence: `predict_from_hf_v5.py`)
- GGUF / Safetensors / HF → Accès aux tenseurs: expose les plages (evidence: `README.md`)
- Ingénieur → Prédiction quantification: échantillonne les poids (evidence: `README.md`)
- Prédiction quantification → Accès aux tenseurs: lit les tenseurs (evidence: `predict_quantization.py`)
- Prédiction quantification → Échantillonnage des poids: évalue des blocs (evidence: `predict_quantization.py`)
- Ingénieur → Pipeline de validation: exécute la validation (evidence: `README.md`)
- Pipeline de validation → Plan et conversion: génère le candidat (evidence: `full_quant_pipeline.py`)
- Pipeline de validation → Gate qualité PPL: vérifie la qualité (evidence: `full_quant_pipeline.py`)
- Gate qualité PPL → GGUF / Safetensors / HF: compare référence et candidat (evidence: `README.md`)
- Appareil Android → Analyse trace HTP: fournit une trace (evidence: `README.md`)
- Appareil Android → Analyse traces CPU/GPU: fournit des profils (evidence: `README.md`)
- Appareil Android → Analyse copies backend: fournit les copies (evidence: `README.md`)
- Ingénieur → Fusion de campagnes: fusionne les campagnes (evidence: `README.md`)
- Fusion de campagnes → Analyse trace HTP: combine les mesures (evidence: `analyze_ratio_campaign.py`)
- Fusion de campagnes → Analyse traces CPU/GPU: combine les mesures (evidence: `analyze_ratio_campaign.py`)
- Fusion de campagnes → Analyse copies backend: combine les mesures (evidence: `analyze_ratio_campaign.py`)
- Écran de monitoring → Serveur télémétrie: démarre le serveur (evidence: `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/MainActivity.kt`)
- Ingénieur → Écran de monitoring: consulte le monitoring (evidence: `README.md`)
- Ingénieur → Navigateur de fichiers: choisit un modèle (evidence: `android/hw_monitor/app/src/main/java/com/geniex/hwmonitor/FileBrowserActivity.kt`)
