How barasamit/quantattack works
Project type and purpose
• This is an open-source research tool (QuantAttack) implemented in PyTorch, designed to generate and evaluate adversarial attacks on dynamically quantized vision transformer models.
• Its primary use-cases are:
• Running different adversarial attack algorithms (one-to-one, many-to-many, universal)
• Measuring the impact of these attacks on inference time, memory, and energy
• Configuring experiments via YAML/Python config files
File structure
Top-level scripts (entry points):
• many_to_many_attack.py, one_to_one_attack.py, universal_attack.py, single_eval_only.py, attack.py
Core modules:
• attacks/ – implementations of attack algorithms (e.g., projected gradient descent)
• losses.py & utils/losses_utils.py – definitions and helpers for custom loss functions
• measures/ – evaluation scripts (e.g., clean_vs_quant.py)
• utils/ – general utilities subdivided into:
– data_utils.py (dataset loading & preprocessing)
– model_utils.py + load_RepQ_ViT.py + load_ptq4vit.py (model loading, dynamic quantization wrappers)
– attack_utils.py, defenses.py, general.py, init_collect_arrays.py, map_imagnet.py
• configs/ – YAML and Python files defining datasets, models, attacks, losses
• notebooks/ – Jupyter notebooks for post-processing or combining CSV outputs
README for additional insights
• The README highlights dynamic quantization vulnerabilities in vision transformers and describes experiment setup: config-driven, CLI-based.
• Dependencies: PyTorch, transformers, accelerate, bitsandbytes, datasets, fvcore, pandas.
Elements
• Blue for configuration & orchestration (Config Manager, CLI Controllers)
• Green for data & model (Data Pipeline, Model Loader)
• Red for computation cores (Attack Engine, Loss Modules)
• Yellow for evaluation (Measurement & Notebooks)