Complete reference for all command-line options in QuantDiff.
Exactly one of these flags must be specified:
Flag
Description
--eval_flops
Calculate FLOPs/MACs using forward hooks
--eval_sensitivity
Analyze layer sensitivity to quantization
--optimize_mixed_precision
Optimize mixed-precision configuration using Bang-for-Buck algorithm
Flag
Type
Default
Description
--model_path
str
CompVis/stable-diffusion-v1-4
Hugging Face model identifier
--device
choice
auto
Device: auto, cuda, cpu
--output_dir
str
results/
Output directory for JSON files
--output_name
str
None
Custom output filename (without .json)
--no_save
flag
-
Don't save JSON results
--quiet
flag
-
Suppress detailed output
Sensitivity Analysis Options
Flag
Type
Default
Description
--max_layers
int
None (all)
Maximum layers to analyze
--sensitivity_bits
int
4
Quantization bits for testing (4, 8, or 16)
--num_prompts
int
100
Number of COCO prompts to use
--coco_path
str
None
Path to COCO prompts file
--prompt_seed
int
42
Random seed for prompt shuffling
--batch_size
int
1
Batch size for generation
Mixed-Precision Optimization Options
Flag
Type
Default
Description
--flops_file
str
results/flops_analysis/flops_analysis_unet.json
Path to FLOPs analysis JSON file
--sensitivity_file
str
results/sensitivity_analysis/sensitivity_100_prompts.json
Path to sensitivity analysis JSON file
--budget_multiplier
float
0.5
Computational budget multiplier (0.0=all 4-bit, 0.5=medium, 1.0=all 16-bit)
--mixed_precision_config
str
None
Path to existing mixed-precision config JSON to load instead of optimizing
Image Generation Script (generate_experiment.py)
Flag
Type
Default
Description
--num_prompts
int
required
Number of COCO prompts to use
--coco_path
str
None
Path to COCO prompts file (default: prompts/coco_val2017.txt)
--model_path
str
CompVis/stable-diffusion-v1-4
Hugging Face model identifier
--device
str
cuda
Device: cuda or cpu
--flops_file
str
results/flops_analysis/flops_analysis_unet.json
Path to FLOPs analysis
--sensitivity_file
str
results/sensitivity_analysis/sensitivity_100_prompts.json
Path to sensitivity analysis
--budget_levels
float[]
[0.1, 0.2, ..., 0.9]
Budget multipliers (space-separated)
--seed
int
42
Random seed for image generation
--prompt_seed
int
42
Random seed for prompt selection
--experiment_dir
str
experiments
Base directory for experiments
Evaluation Script (evaluate_experiment.py)
Flag
Type
Default
Description
experiment_dir
str
required
Path to experiment directory
--device
str
cuda
Device: cuda or cpu
--save_results
flag
-
Save results to CSV and JSON
--output_path
str
<experiment_dir>/evaluation_results.csv
Custom output path
python main.py --eval_flops
python main.py --eval_flops --device cuda
python main.py --eval_flops --output_dir custom_results/
Phase 2: Sensitivity Analysis
python main.py --eval_sensitivity
python main.py --eval_sensitivity --sensitivity_bits 8
python main.py --eval_sensitivity --num_prompts 50 --device cuda
python main.py --eval_sensitivity --max_layers 10 --batch_size 25
Phase 3: Mixed-Precision Optimization
python main.py --optimize_mixed_precision
python main.py --optimize_mixed_precision --budget_multiplier 0.3
python main.py --optimize_mixed_precision --flops_file custom/flops.json
Phase 4: Image Generation
python generate_experiment.py --num_prompts 50
python generate_experiment.py --num_prompts 100 --budget_levels 0.3 0.5 0.7
python generate_experiment.py --num_prompts 50 --device cuda --seed 123
python evaluate_experiment.py experiments/2025-10-31_14-30-45_50prompts/
python evaluate_experiment.py experiments/2025-10-31_14-30-45_50prompts/ --save_results