Views
No views yet
ascad-training-pipeline/
├── src/ # Core ML pipeline
│ ├── constants.py # Centralized constants (S-Box, POI windows, SNR values)
│ ├── dataset.py # OOP dataset loader (per-byte + global window modes)
│ ├── evaluation.py # Key rank evaluation (single + multi-output)
│ ├── artifacts.py # HuggingFace upload/download utilities
│ ├── models/
│ │ ├── __init__.py # Model registry with factory function
│ │ ├── base.py # Abstract base model class
│ │ ├── mlp.py # MLPbest architecture (352K params)
│ │ ├── cnn.py # CNNbest architecture (67M params)
│ │ └── mtan.py # SNR-MTAN multi-task architecture (326M params)
│ └── training/
│ ├── __init__.py
│ ├── trainer.py # Single-model trainer with retry logic
│ └── mtl_trainer.py # Multi-task trainer for MTAN models
├── orchestrator/ # Distributed training queue
│ ├── server/
│ │ ├── app.py # FastAPI queue server with live dashboard
│ │ ├── database.py # SQLite database layer (WAL mode)
│ │ ├── schemas.py # Pydantic request/response models
│ │ └── routes/
│ │ ├── jobs.py # Job CRUD endpoints
│ │ └── workers.py # Worker registration and communication
│ ├── worker/
│ │ └── agent.py # GPU instance worker agent
│ ├── cli/
│ │ └── tq.py # Click-based CLI for queue management
│ └── configs/
│ └── exp2_jobs.yaml # Experiment 2 job configurations (14 runs)
├── scripts/
│ └── deploy_worker.sh # Vast.ai instance deployment script
├── tools/
│ ├── analyze_snr.py # SNR analysis and POI window extraction
│ └── audit_hf.py # HuggingFace model audit utility
├── train.py # CLI: train a single-byte model
├── train_mtl.py # CLI: train a multi-task MTAN model
├── requirements.txt
├── setup.py
└── README.md1# Train MLPbest for byte 0, desync=0
2python train.py --model mlp --byte 0 --desync 0 --seed 42 --max-retries 10
3
4# Train CNNbest for byte 5, desync=100
5python train.py --model cnn --byte 5 --desync 100 --upload1# Train full SNR-MTAN (attention + GradNorm + SNR init)
2python train_mtl.py --desync 0 --variant snr_mtan --wandb-project ASCAD_EXP2_MTAN
3
4# Train static MTL baseline (no attention, uniform weights)
5python train_mtl.py --desync 100 --variant static_mtl
6
7# Available variants: snr_mtan, snr_mtan_no_gn, mtan_uniform, mtan_gn_uniform_init, static_mtl1# Start the queue server
2python -m orchestrator.cli.tq serve --port 8080
3
4# Submit Experiment 2 jobs
5python -m orchestrator.cli.tq batch orchestrator/configs/exp2_jobs.yaml
6
7# Monitor jobs
8python -m orchestrator.cli.tq list --status running
9python -m orchestrator.cli.tq workers
10python -m orchestrator.cli.tq dashboard
11
12# Deploy a worker on a Vast.ai instance
13ssh -p <port> root@<host> 'bash -s' < scripts/deploy_worker.sh \
14 http://<server>:8080 worker-001 <hf_token> <wandb_token>| Model | Type | Input | Params | Description |
|---|---|---|---|---|
| MLPbest | Single-byte | 700 samples | 352K | 6-layer MLP, 200 hidden units |
| CNNbest | Single-byte | 700 samples | 67M | 5 conv blocks (64-512), 2xFC(4096) |
| SNR-MTAN | Multi-task | 32,272 samples | 326M | Shared CNN + 16 attention heads + GradNorm |
| Variant | Attention | GradNorm | SNR Init | Desync Levels |
|---|---|---|---|---|
| Static MTL | No | No | No | 0, 50, 100 |
| MTAN Uniform | Yes | No | No | 0, 50, 100 |
| SNR-MTAN (full) | Yes | Yes | Yes | 0, 50, 100 |
| SNR-MTAN no GN | Yes | No | Yes | 0, 50, 100 |
| Ablation: Uniform Init | Yes | Yes | No | 100 only |
| Ablation: No GradNorm | Yes | No | Yes | 100 only |
lemousehunter/ascad-training-pipeline — This codebaselemousehunter/ascad-mlp-rank0-models — 48 MLP rank-0 modelslemousehunter/ascad-cnn-rank0-models — 48 CNN rank-0 modelsBenadjila, R., Prouff, E., Strullu, R., Cagli, E., & Dumas, C. (2020). Deep learning for side-channel analysis and introduction to ASCAD databases. Journal of Cryptographic Engineering, 10(2), 163-188.
pip install -r requirements.txt