Code for GRAPE: Gradient Refinement and Progress-Aware Exploitation for Query-Efficient High-Dimensional Bayesian Optimization.
GRAPE is a two-stage local Bayesian optimization method. Stage 1 sharpens the local gradient posterior with a few closed-form queries. Stage 2 then moves along the direction that maximizes the expected decrease conditional on descent, instead of just the probability of descent.
bash setup.sh
source .venv/bin/activateThis creates a virtual environment, installs PyTorch, and installs the remaining dependencies from requirements.txt, including bolt-bench for the prompt-optimization tasks. See setup.sh for manual install steps and GPU/CPU torch options.
Black-box adversarial attacks (train the target classifier once, then run):
python train_mnist.py
python train_cifar10.py
python exp_attack.py --dataset mnist --methods grape --n-images 10
python exp_attack.py --dataset cifar10 --methods grape gibo mpd turbo --n-images 10LLM prompt optimization on BoLT tasks (first run downloads Hugging Face tabular data):
python exp_prompt.py --quick
python exp_prompt.py --n-trials 10 --n-iterations 100Optimizer hyperparameters are in utils.py (OPTIMIZERS); defaults match the paper.
Prompt-optimization experiments use BoLT (Chew, Chen, Hemachandra, and Low), which provides precomputed prompt scores for query-efficient benchmarking. See their repo for the benchmark's own license and terms.
@article{suwandi2026grape,
title = {GRAPE: Gradient Refinement and Progress-Aware Exploitation for
Query-Efficient High-Dimensional Bayesian Optimization},
author = {Suwandi, Richard Cornelius and Yin, Feng},
journal = {Preprint},
year = {2026}
}MIT, see LICENSE.
