attacklm-dataset v0.4.3 — LiRA workflow closure
LiRA workflow closure
What's new
scripts/score_shadow.py(NEW): Closes the LiRA workflow Step 2. The
docstring ofshadow_train.pyreferenced a non-existent script that users
had to write themselves. Now it ships in-repo: load a HF model, score a
JSONL of records, writeshadow_{K}.json. Atomic write, --dry-run,
duplicate-id handling, missing-assistant-turn handling.--mia-method offline: White-box MIA baseline that requires NO shadow
models. Uses sample mean/std of audit-set NLL as the OUT distribution.
For each record: z = (nll - μ_out) / σ_out. Lower z = more likely member.
Default threshold: -1.5 (configurable). Field names:offline_z,
offline_mu_out,offline_sigma_out,offline_flagged.compute_offline_z()added toinversion.scoring(reuses
zscore_normalize()for the σ=0 guard).- 15 new tests (10 in
test_score_shadow.py, 5 intest_offline_mia.py).
Total: 475 passing, 0 skipped.
Bug fix
- pyproject.toml drift fixed: was 0.4.0, everything else was 0.4.2.
Caught bybumpversion --check. The every-commit-equals-a-new-tag rule
paid for itself again.
Workflow recipes
Full LiRA (K=16 shadows, ~16h on RTX 4080 for 3B):
for k in $(seq 0 15); do
attacklm train --output models/shadow_$k
python scripts/score_shadow.py \
--model models/shadow_$k \
--records data/audit_set.jsonl \
--output-dir losses/ \
--shadow-index $k
done
python -m inversion.shadow_train \
--loss-dir losses/ --output shadow_params.json
python scripts/inversion_audit.py \
--model target \
--mia-method lira \
--lira-params shadow_params.json \
--mia-threshold-mode lrtQuick baseline (1 minute, no shadows):
python scripts/inversion_audit.py \
--model target \
--mia-method offlinePrior art
Carlini 2022 §3.2 (reference attack with z-normalization).
This is NOT Sablayrolles (early planning mis-claimed the provenance);
it's the loss-z baseline with sample std.
Files
- data tarball (3.8 MB, 18 sources, 24,652 records, 13.1x compression)
- See
docs/LIRA.mdfor the full workflow