Datasets:
Tasks:
Other
Formats:
parquet
Size:
100K - 1M
Tags:
wireless
physical-layer-security
covert-communication
low-probability-of-detection
virtual-mimo
anomaly-detection
License:
File size: 11,531 Bytes
b295f1c d74cf64 b295f1c 9cd46f7 b295f1c 690fde9 b295f1c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | # Training the Universal Eve warden
This dataset ships with the trainer that consumes it: **Universal Eve**, a multi-task warden
that, from a single `N_E × T` block of Eve's received signal, jointly (a) **detects** whether
a covert distributed virtual-MIMO collaboration is present (H0 vs H1) and (b) **fingerprints**
its structure — waveform format, system size `M`, message shape `(K, d)`, channel family, and
the collaboration-policy arm. The script is
[`src/covcollab/universaleve/multitask.py`](src/covcollab/universaleve/multitask.py),
exposed as the `covcollab-eve-mtl` command.
The scientific point of the model is the **presence ≠ structure** dichotomy: detection is
recoverable (regime-flat AUC ≈ 0.88), waveform/channel partially recover and lift with more
antennas/looks, but system size and policy identity stay at chance on the payload. Training it
reproduces that map.
> **Prefer a runnable walkthrough?** [`notebooks/train_universal_eve.ipynb`](notebooks/train_universal_eve.ipynb)
> does load → build → train → evaluate → plot the fingerprinting map end-to-end (Colab-ready).
---
## What it trains on
The trainer reads the dataset splits directly (no re-generation):
| split | role |
|---|---|
| `train` | fit the backbone + heads |
| `val` (`validation`) | monitoring |
| `test_iid` | in-distribution evaluation |
| `test_ood` | held-out strong-Doppler shift |
Two configs are available and interchangeable via `--data`:
- **`default`** — `N_E = 4` receive antennas (the main config).
- **`multi_ne`** — `N_E ∈ {1,2,4,8}` swept, zero-padded to `N_E^max = 8` with a validity mask;
use it to study the antenna-count frontier.
Each sample is a complex `(N_E, T=320)` block plus a 26-field metadata row (detection label,
`format`, `n_tx=M`, `n_msg_users=K`, `msg_dim=d`, `channel_family`, `policy_arm`, per-sample Eve
and Bob SNRs, a `regime` tag ∈ {covert, comparable, detectable}, and a `cell_id` for
same-emitter multi-look grouping).
## The model
One shared encoder feeds all tasks (≈ 2.1 × 10⁵ parameters):
```
per-antenna multi-scale Conv1d → state-space long-conv temporal block
→ masked attention+mean antenna pool (variable N_E)
→ concat a 7-dim spatial-covariance eigen-branch (non-sphericity, log-MME,
log-energy, top eigenvalue ratios) ⇒ embedding e
a spectral/pilot branch (log-PSD + cyclic-autocorrelation) ⇒ spec_emb
heads: detection (BCE, off e, all samples)
format / M / K / d / channel / policy-arm (CE, off [e, spec_emb], H1 only)
loss: masked, uncertainty-weighted (homoscedastic Kendall–Gal) multi-task loss
```
Optimizer: AdamW (`wd=1e-4`) + warmup/cosine LR + grad clipping — the combination that keeps
the deep-covert run from the weight-collapse failure mode of plain Adam with large L2.
---
## Install
```bash
# from the dataset repo root
pip install -e ".[hf]" # installs numpy, torch, pyarrow (parquet)
```
`torch` from PyPI is the CPU/Apple-MPS build. For NVIDIA GPUs install a CUDA build first (see
the GPU section), then `pip install -e ".[hf]"` will keep it.
## Quickstart
```bash
# joint detect+fingerprint (regime A) + a detection-representation probe (regime C),
# evaluated on test_iid and test_ood; auto-selects CUDA > MPS > CPU
covcollab-eve-mtl --data . --regime both --out runs/mtl
```
A fast end-to-end sanity run (tiny, ~1–2 min including the parquet load):
```bash
covcollab-eve-mtl --data . --smoke --regime A --out runs/mtl_smoke
```
Outputs land in `--out`: a per-regime `A/ckpt.pt`, `C/ckpt.pt`, … and a `results.json` with
per-split detection AUC and per-attribute accuracy (each scored against its majority-class
baseline — only lift above it is genuine recovery).
## CLI
| flag | default | meaning |
|---|---|---|
| `--data` | `huggingface/covcollab-eve-detection` | dataset dir (`.` from this repo), or a HF path |
| `--regime` | `both` | `A` joint · `C` detection-rep probe · `B` multi-look sweep · `both` (A+C) |
| `--steps` | `4000` | training steps (per regime) |
| `--probe-steps` | `2500` | regime-C probe steps |
| `--width` | `96` | backbone width |
| `--batch` | `256` | minibatch size |
| `--look-sizes` | `1 2 4 8` | regime-B: L values in the multi-look sweep |
| `--n-looks` | `32` | regime-B: looks pooled per step |
| `--max-train` | all | subsample the train split (fit smaller machines / faster) |
| `--device` | `auto` | `auto` (cuda>mps>cpu), or `cuda` / `mps` / `cpu` |
| `--feat-device` | `auto` | where feature extraction runs (see GPU section) |
| `--eval-splits` | `test_iid test_ood` | splits to evaluate |
| `--out` | `runs/mtl` | output dir |
| `--smoke` | off | tiny config for a quick end-to-end check |
**Regimes.** `A` trains the joint multi-task model. `C` trains detection only, then fits MLP
probes on the *frozen* detection embedding — the A-vs-C gap shows whether structure lives in
the detector's representation (it does not) or only in the spectral branch. `B` sweeps temporal
looks `L` to lift the fingerprint frontier (format rises ∝ √L; policy stays flat).
---
## Training on NVIDIA GPUs (A100 and others)
Unlike the on-the-fly adversarial warden (which *synthesizes* signals every step and is
data-generation-bound), this trainer reads **pre-generated** blocks, so a GPU accelerates the
actual work with no synthesis overhead. Two device knobs matter.
### 1. Install a CUDA build of PyTorch
The single most common mistake is training on a CPU `torch` wheel. Install the CUDA build that
matches your driver (CUDA 12.1 shown):
```bash
pip install torch --index-url https://download.pytorch.org/whl/cu121
python -c "import torch; print(torch.__version__, torch.cuda.is_available(), torch.cuda.get_device_name(0))"
pip install -e ".[hf]" # add numpy + pyarrow without touching torch
```
### 2. Put the whole step on the GPU: `--device cuda --feat-device auto`
- `--device cuda` runs the network (forward/backward) on the GPU.
- `--feat-device auto` runs the **feature extraction** — the complex-valued FFT (spectral
branch) and the spatial-covariance `eigvalsh` (eigen-branch) — on the GPU too, in
`complex64`. This is CUDA-only: Apple MPS has no complex-tensor support, so on MPS/CPU
features stay on CPU automatically (`auto` resolves to CPU there). Force it with
`--feat-device cuda` / `cpu` if needed.
With both on CUDA, the only host-side cost is loading the parquet split into memory once.
```bash
covcollab-eve-mtl --data . --regime both \
--device cuda --feat-device auto \
--width 96 --batch 512 --steps 6000 --out runs/mtl_a100
```
### Recommended settings by GPU
The backbone is small (~0.2 M params), so training is fast and fits comfortably on any modern
NVIDIA card; larger GPUs mainly let you scale `--width`/`--batch` and run more steps.
| GPU | `--batch` | `--width` | notes |
|---|---|---|---|
| A100 40/80 GB, H100 | `512–1024` | `96–192` | ample headroom; whole step on-GPU; `--steps 6000+` |
| L40S / A6000 (48 GB) | `512` | `96–128` | same profile as A100 at smaller width |
| RTX 4090 / 3090 (24 GB) | `256–512` | `96` | keep the default config |
| T4 / RTX 2080 (≤16 GB) | `128–256` | `64–96` | `--max-train 40000` if host RAM is tight |
The full `train` split is ~1 GB in host memory; feature tensors are built per-batch, so VRAM
use is modest even at `--width 192`. If host RAM is the constraint, `--max-train N` subsamples
the split.
### Throughput and expectations
The network is tiny relative to an A100, so a run is dominated by the one-time data load, not
compute: the default 4000-step regime-A fit completes in a few minutes on an A100, and the full
`--regime both` in well under ~15 minutes. (For reference, the same run takes ~1–2 hours on an
Apple-MPS laptop, most of it CPU feature extraction — which `--feat-device auto` removes on
CUDA.) A single A100 is more than enough; there is no need for multi-GPU.
### Using multiple GPUs
The trainer is single-GPU by design. To use several A100s productively, run independent jobs
in parallel — one device each — rather than sharding one small model:
```bash
# regimes in parallel, one GPU each
CUDA_VISIBLE_DEVICES=0 covcollab-eve-mtl --data . --regime A --device cuda --out runs/A &
CUDA_VISIBLE_DEVICES=1 covcollab-eve-mtl --data . --regime C --device cuda --out runs/C &
CUDA_VISIBLE_DEVICES=2 covcollab-eve-mtl --data . --regime B --device cuda --out runs/B &
wait
```
or sweep seeds / `--width` / the `multi_ne` config across cards the same way.
### Sanity gates before a long or metered run
- Always dry-run `--smoke` on the target machine first; it exercises the full load → train →
evaluate path in ~1–2 min.
- The AdamW + LR-schedule recipe here is the one that avoids the deep-covert weight-collapse
seen with plain Adam + large weight decay; if you change the optimizer, verify the training
loss decreases and the detection AUC on `val` is non-degenerate (≠ 0.5) on a short run before
committing GPU time.
### On a shared HTCondor cluster (e.g. Syracuse OrangeGrid)
If your GPUs come from an HTCondor batch pool rather than an interactive card, this repo ships a
ready-to-use submission kit under [`deploy/orangegrid/`](deploy/orangegrid/) (submit file,
wrapper, one-time `uv`-based setup, and a parallel regime/hyperparameter sweep), tuned for
**Syracuse University's OrangeGrid** (A100 / A40 / L40S; `+request_gpus = 1`,
`Requirements = (CUDADriverVersion >= 12.0) && (CUDACapability >= 8.0)`, shared-home filesystem
so no file transfer). After downloading this dataset repo to your cluster home:
```bash
cd ~/covcollab-eve-detection
bash deploy/orangegrid/setup_orangegrid.sh # build the .venv with covcollab-eve-mtl
condor_submit deploy/orangegrid/train.sub # one GPU run; condor_q <netid> to watch
condor_submit deploy/orangegrid/sweep.sub # regimes A/C/B in parallel, one GPU each
```
See [`deploy/orangegrid/README.md`](deploy/orangegrid/README.md) for access, configuration, and
troubleshooting. The same pattern (a wrapper that runs `covcollab-eve-mtl … --device cuda
--feat-device auto` on a shared FS) adapts to any HTCondor pool.
---
## The synthesis-based warden (optional, different tool)
If instead of training on this fixed dataset you want the **on-the-fly, distributionally-robust**
warden that synthesizes fresh domains every step (randomizing policy/waveform/channel/SNR/`N_E`),
that entry point now ships in this repo too (`covcollab.universaleve.run.train_and_eval`, with a
Modal/Colab cloud path). It is generation-bound rather than compute-bound, so its GPU story
centers on running the *complex simulator* on CUDA (`sim_device="cuda"`), not just the net. This
dataset and `covcollab-eve-mtl` do not require it.
The same on-the-fly stack powers the **adversary-envelope depth study** (`covcollab-eve-envelope`,
`covcollab-eve-ladder`) — see [`deploy/orangegrid/README.md`](deploy/orangegrid/README.md) for the
batch fan-out.
---
## Reproducing the fingerprinting map
```bash
covcollab-eve-mtl --data . --regime both --steps 4000 --width 96 --out runs/map
```
Read `runs/map/results.json`: detection AUC is high and regime-flat; **format** (+0.14) and
**channel** (+0.11) clear their baselines in the joint model (A) but not from the frozen
detection probe (C); **M**, **K**, **d**, and **policy-arm** sit at their class priors — the
central null. Add `--regime B` to see format lift with looks while the policy-arm stays flat.
|