# hidedabush/neural-network-quantization-study architecture

> Architecture diagram of the GitHub repository hidedabush/neural-network-quantization-study, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hidedabush/neural-network-quantization-study
- Repository: https://github.com/hidedabush/neural-network-quantization-study

## Overview

This repository is a neural-network quantization research study: experiments load models and data, compare floating-point baselines with quantized inference, and examine accuracy and performance tradeoffs. Its runtime includes Python PTQ and sensitivity experiments alongside custom CUDA quantization and INT8 GEMM kernels; results can be plotted for a paper-style report. The README also describes QAT, mixed precision, and TensorRT comparison, but those implementations are not present in the supplied tree, so their links are not inferred. Some CUDA and reporting paths are documented but their source was not sampled.

Main entry points: [`experiments/ptq/run_ptq.py`](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py) (PTQ Experiment), [`experiments/sensitivity/layer_sweep.py`](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/sensitivity/layer_sweep.py) (Layer Sensitivity Sweep), [`models/model_loader.py`](https://github.com/hidedabush/neural-network-quantization-study/blob/main/models/model_loader.py) (Model Loader), [`datasets/dataset_loader.py`](https://github.com/hidedabush/neural-network-quantization-study/blob/main/datasets/dataset_loader.py) (CIFAR-10 Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experiments["Model Experiments"]
  node_ptq["PTQ Experiment<br/>[run_ptq.py]"]
  node_calibration["Weight Calibration<br/>[run_ptq.py]"]
  node_ptq_quantization["Linear Quantization<br/>[run_ptq.py]"]
  node_evaluation["Accuracy And Latency<br/>[run_ptq.py]"]
  node_sensitivity["Layer Sensitivity Sweep<br/>[layer_sweep.py]"]
  node_qat["QAT Capability"]
  node_mixed_precision["Mixed Precision Capability"]
end

subgraph group_kernels["CUDA Kernels"]
  node_quantize_kernel["Quantize Kernels<br/>[quantize.cu]"]
  node_gemm_kernel["INT8 GEMM<br/>[gemm_int8.cu]"]
  node_kernel_benchmark["Kernel Benchmark<br/>[benchmark.cu]"]
end

subgraph group_inputs["Models And Data"]
  node_model_loader["Model Loader<br/>[model_loader.py]"]
  node_dataset_loader["CIFAR-10 Loader<br/>[dataset_loader.py]"]
end

subgraph group_analysis["Results And Analysis"]
  node_plotting["Result Plotting<br/>[plot_results.py]"]
  node_paper_report["Technical Report<br/>[report_draft.md]"]
end

node_researcher(("Researcher"))
node_model_sources["Model Providers"]
node_dataset_source[("CIFAR-10 Dataset")]
node_tensorrt["TensorRT Baseline"]

node_researcher -->|"runs"| node_ptq
node_researcher -->|"runs"| node_sensitivity
node_ptq -->|"loads data"| node_dataset_loader
node_ptq -->|"loads model"| node_model_loader
node_sensitivity -->|"loads data"| node_dataset_loader
node_sensitivity -->|"loads model"| node_model_loader
node_dataset_loader -->|"downloads"| node_dataset_source
node_model_loader -->|"loads weights"| node_model_sources
node_ptq -->|"calibrates"| node_calibration
node_calibration -->|"provides scales"| node_ptq_quantization
node_ptq -->|"replaces layers"| node_ptq_quantization
node_ptq -->|"evaluates models"| node_evaluation
node_sensitivity -->|"measures accuracy"| node_evaluation
node_ptq -.->|"planned integration"| node_quantize_kernel
node_quantize_kernel -->|"kernel component"| node_gemm_kernel
node_researcher -->|"runs"| node_kernel_benchmark
node_researcher -->|"generates figures"| node_plotting
node_plotting -->|"supports findings"| node_paper_report

click node_ptq "https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py"
click node_calibration "https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py"
click node_ptq_quantization "https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py"
click node_evaluation "https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py"
click node_sensitivity "https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/sensitivity/layer_sweep.py"
click node_qat "https://github.com/hidedabush/neural-network-quantization-study/tree/main/experiments"
click node_mixed_precision "https://github.com/hidedabush/neural-network-quantization-study/tree/main/experiments"
click node_model_loader "https://github.com/hidedabush/neural-network-quantization-study/blob/main/models/model_loader.py"
click node_dataset_loader "https://github.com/hidedabush/neural-network-quantization-study/blob/main/datasets/dataset_loader.py"
click node_quantize_kernel "https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/quantize.cu"
click node_gemm_kernel "https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/gemm_int8.cu"
click node_kernel_benchmark "https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/benchmark.cu"
click node_plotting "https://github.com/hidedabush/neural-network-quantization-study/blob/main/tools/plot_results.py"
click node_paper_report "https://github.com/hidedabush/neural-network-quantization-study/blob/main/docs/paper/report_draft.md"

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_ptq,node_calibration,node_ptq_quantization,node_evaluation,node_sensitivity,node_qat,node_mixed_precision toneBlue
class node_quantize_kernel,node_gemm_kernel,node_kernel_benchmark,node_dataset_source toneAmber
class node_model_loader,node_dataset_loader toneMint
class node_plotting,node_paper_report toneRose
class node_researcher,node_model_sources,node_tensorrt toneIndigo
```

## Components

### Model Experiments

- [PTQ Experiment](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py): `experiments/ptq/run_ptq.py`
- [Weight Calibration](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py): `experiments/ptq/run_ptq.py`
- [Linear Quantization](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py): `experiments/ptq/run_ptq.py`
- [Accuracy And Latency](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/ptq/run_ptq.py): `experiments/ptq/run_ptq.py`
- [Layer Sensitivity Sweep](https://github.com/hidedabush/neural-network-quantization-study/blob/main/experiments/sensitivity/layer_sweep.py): `experiments/sensitivity/layer_sweep.py`
- [QAT Capability](https://github.com/hidedabush/neural-network-quantization-study/tree/main/experiments): `experiments`
- [Mixed Precision Capability](https://github.com/hidedabush/neural-network-quantization-study/tree/main/experiments): `experiments`

### CUDA Kernels

- [Quantize Kernels](https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/quantize.cu): `cuda_kernels/src/quantize.cu`
- [INT8 GEMM](https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/gemm_int8.cu): `cuda_kernels/src/gemm_int8.cu`
- [Kernel Benchmark](https://github.com/hidedabush/neural-network-quantization-study/blob/main/cuda_kernels/src/benchmark.cu): `cuda_kernels/src/benchmark.cu`

### Models And Data

- [Model Loader](https://github.com/hidedabush/neural-network-quantization-study/blob/main/models/model_loader.py): `models/model_loader.py`
- [CIFAR-10 Loader](https://github.com/hidedabush/neural-network-quantization-study/blob/main/datasets/dataset_loader.py): `datasets/dataset_loader.py`

### Results And Analysis

- [Result Plotting](https://github.com/hidedabush/neural-network-quantization-study/blob/main/tools/plot_results.py): `tools/plot_results.py`
- [Technical Report](https://github.com/hidedabush/neural-network-quantization-study/blob/main/docs/paper/report_draft.md): `docs/paper/report_draft.md`

### Other components

- **Researcher**
- **Model Providers**
- **CIFAR-10 Dataset**
- **TensorRT Baseline**

## Connections

- Researcher → PTQ Experiment: runs
- Researcher → Layer Sensitivity Sweep: runs
- PTQ Experiment → CIFAR-10 Loader: loads data
- PTQ Experiment → Model Loader: loads model
- Layer Sensitivity Sweep → CIFAR-10 Loader: loads data
- Layer Sensitivity Sweep → Model Loader: loads model
- CIFAR-10 Loader → CIFAR-10 Dataset: downloads
- Model Loader → Model Providers: loads weights
- PTQ Experiment → Weight Calibration: calibrates
- Weight Calibration → Linear Quantization: provides scales
- PTQ Experiment → Linear Quantization: replaces layers
- PTQ Experiment → Accuracy And Latency: evaluates models
- Layer Sensitivity Sweep → Accuracy And Latency: measures accuracy
- PTQ Experiment → Quantize Kernels: planned integration
- Quantize Kernels → INT8 GEMM: kernel component
- Researcher → Kernel Benchmark: runs
- Researcher → Result Plotting: generates figures
- Result Plotting → Technical Report: supports findings
