|
| 1 | +# zk-IVF-PQ |
| 2 | + |
| 3 | +## Build |
| 4 | + |
| 5 | +Build and install the Python extension: |
| 6 | + |
| 7 | +```bash |
| 8 | +maturin develop --release |
| 9 | +``` |
| 10 | + |
| 11 | +## Experiment 1: Retrieval Utility Evaluation |
| 12 | + |
| 13 | +### Classic ANN (SIFT1M / GIST1M) |
| 14 | + |
| 15 | +```bash |
| 16 | +bash scripts/acc_bench.sh |
| 17 | +``` |
| 18 | + |
| 19 | +Results are cached under `data/acc_bench/`. |
| 20 | + |
| 21 | +### IR (MS MARCO passage retrieval, dev) |
| 22 | + |
| 23 | +Run the two evaluation jobs (high-acc and zk-opt) and then aggregate metrics: |
| 24 | + |
| 25 | +```bash |
| 26 | +python -m bench.ms_macro_eval \ |
| 27 | + --num-runs 1 \ |
| 28 | + --n-list 8192 \ |
| 29 | + --n-probe 64 \ |
| 30 | + --M 8 \ |
| 31 | + --K 256 \ |
| 32 | + --cluster-bound 2048 \ |
| 33 | + --top-k 1000 \ |
| 34 | + --out-dir data/exp1/ms_macro_high_acc |
| 35 | + |
| 36 | +python -m bench.ms_macro_eval \ |
| 37 | + --num-runs 1 \ |
| 38 | + --n-list 2048 \ |
| 39 | + --n-probe 16 \ |
| 40 | + --M 8 \ |
| 41 | + --K 256 \ |
| 42 | + --cluster-bound 8192 \ |
| 43 | + --top-k 1000 \ |
| 44 | + --out-dir data/exp1/ms_macro_zk_fast |
| 45 | + |
| 46 | +python -m bench.ms_macro_result data/exp1/ms_macro_high_acc data/exp1/ms_macro_zk_fast |
| 47 | +``` |
| 48 | + |
| 49 | +Outputs are written under `data/exp1/`. |
| 50 | + |
| 51 | +## Experiment 2: Proof Cost Evaluation |
| 52 | + |
| 53 | +Script: `scripts/bench_suite.sh` (runs `python -m bench.bench_suite` and caches results under `data/bench_result/`). |
| 54 | + |
| 55 | +```bash |
| 56 | +bash scripts/bench_suite.sh |
| 57 | +``` |
| 58 | + |
| 59 | +Optional: if `matplotlib` is available, a summary plot is generated at `data/bench_result/bench_summary.pdf`. |
| 60 | + |
| 61 | +## Experiment 3: Configuration Trade-offs |
| 62 | + |
| 63 | +### Fixed scan budget: sweep `n_list` |
| 64 | + |
| 65 | +```bash |
| 66 | +bash scripts/optimal_config.sh |
| 67 | +``` |
| 68 | + |
| 69 | +Outputs are written to `data/optimal_config/`. |
| 70 | + |
| 71 | +### Fixed code budget: gate-only sweep over `K` (and zk-opt selection) |
| 72 | + |
| 73 | +```bash |
| 74 | +bash scripts/optimal_mem_gate_only_ann_ir.sh |
| 75 | +``` |
| 76 | + |
| 77 | +Outputs are written to `data/optimal_mem_gate_only/`. |
0 commit comments