本論文 Poisoning Attacks on the PGM-index の公式コードです。
git clone [REPOSITORY LINK]
cd pgm-index-poisoning
git submodule update --init --recursive
./scripts/build.sh
CMakeが必要です(依存関係を参照)。出力は build/ 配下に生成されます(デフォルトではバイナリは build/bin)。
./scripts/download_alex_dataset.sh # ALEX
./scripts/download_mgbench.sh # mgbench
./scripts/download_sosd_datasets.sh # SOSD
./scripts/preprocess_alex_dataset.sh # ALEX
./scripts/preprocess_mgbench.sh # mgbench
./scripts/generate_synthetic_dataset.sh # synthetic
各実行は ./scripts/run_experiment.sh <config.json> を介して1つのJSON設定を受け取ります。例:
4.1 最大誤差の最大化(例:n=16、連続法)
./scripts/run_experiment.sh "configs/experiments/poison_attack/maximize_maxerror_consec/baseline_n16.json"
4.2 正当なキーの被覆範囲の最小化(例:epsilon=2、連続法)
./scripts/run_experiment.sh "configs/experiments/poison_attack/minimize_segment_length/baseline_epsilon2.json"
4.3 m_opt の最大化(PGM-indexの例)
./scripts/run_experiment.sh "configs/experiments/poison_attack/inject_poisons_to_minimize_segment_length_swing_lambda_with_theta/baseline.json"
4.4 m_opt の上限(インスタンス依存の例)
./scripts/run_experiment.sh "configs/experiments/upper_bound/fix_w_per_block/baseline.json"
4.5 全実験の実行(バッチ)
scripts/run_all_experiment.sh 内の実験設定の全リストを実行します(設定を変更するにはそのファイルを編集してください)。
./scripts/run_all_experiment.sh
リポジトリのルートから:
./scripts/plot.sh
./scripts/print_table.sh
図とログは fig/ 配下に書き出されます。まずPythonの依存関係をインストールしてください:pip install -r requirements.txt。
g++、make、および CMake(ビルドスクリプトはCMakeで設定し、cmake --build でビルドします。通常はMakeを呼び出します)。requirements.txt 内のパッケージ(プロット/表スクリプト用)。./scripts/run_experiment.sh で必要です。イメージを一度ビルドします:
./docker_build.sh
docker_run.sh — 対話型コンテナ:リポジトリを /workspace にマウントし、8 CPU(0–7)を割り当て、bash にドロップして手動でビルドおよびコマンドを実行できます。docker_run_all.sh — デタッチド実行:コンテナ内で ./scripts/run_all_experiment.sh を実行し(8 CPU)、stdout を results/run_all.log に書き出します。docker_run_all_single_cpu.sh — docker_run_all.sh と同じですが、1 CPU と OMP_NUM_THREADS=1 を使用してシングルスレッドで実行します。3つすべてがイメージ pgm_poisoning:latest と、スクリプトと同じケーパビリティ/ボリューム設定を使用します。
| パス | 役割 |
|---|
src/ | C++ソース(攻撃、PGMベンチマーク、ツール、上限)。 |
configs/experiments/ | 実験JSON設定(poison_attack/、upper_bound/ などの配下)。 |
scripts/ | ビルド、データ、run_experiment.sh、run_all_experiment.sh、plot.sh、print_table.sh。 |
third_party/ | Gitサブモジュール(PGM-index、FITing-Tree、RadixSpline)。 |
data/、results/、fig/ | データ、実行出力、生成された図/表ログ。 |
plot/ | Pythonによるプロットおよび表出力スクリプト。 |