Skip to content

Repository files navigation

GRAPE

Code for GRAPE: Gradient Refinement and Progress-Aware Exploitation for Query-Efficient High-Dimensional Bayesian Optimization.

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.

Install

bash setup.sh
source .venv/bin/activate

This 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.

Usage

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 10

LLM 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 100

Optimizer hyperparameters are in utils.py (OPTIMIZERS); defaults match the paper.

Acknowledgments

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.

Citation

@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}
}

License

MIT, see LICENSE.

About

Two-stage local method for query-efficient high-dimensional Bayesian optimization

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages