Optimization by Directional Attacks: Solving Problems with Neural Network Surrogates

Philippe Bouchet, Thibaut VidalarXiv 2025 · DOI

Abstract

This paper tackles optimization problems whose objective and constraints involve a trained Neural Network (NN), where the goal is to maximize $f(\Phi(x))$ subject to $c(\Phi(x)) \leq 0$, with $f$ smooth, $c$ general and non-stringent, and $\Phi$ an already trained and possibly nonwhite-box NN. We address two challenges regarding this problem: identifying ascent directions for local search, and ensuring reliable convergence towards relevant local solutions. To this end, we re-purpose the notion of directional NN attacks as efficient optimization subroutines, since directional NN attacks use the neural structure of $\Phi$ to compute perturbations of $x$ that steer $\Phi(x)$ in prescribed directions. Precisely, we develop an attack operator that computes attacks of $\Phi$ at any $x$ along the direction $\nabla f(\Phi(x))$. Then, we propose a hybrid algorithm combining the attack operator with derivative-free optimization (DFO) techniques, designed for numerical reliability by remaining oblivious to the structure of the problem. We consider the cDSM algorithm, which offers asymptotic guarantees to converge to a local solution under mild assumptions on the problem. The resulting method alternates between attack-based steps for heuristic yet fast local intensification and cDSM steps for certified convergence and numerical reliability. Experiments on three problems show that this hybrid approach consistently outperforms standard DFO baselines.

Introduction

Neural networks (NNs) are increasingly deployed as "digital twins" or surrogate models to simulate complex physical systems or decision-making processes. A natural requirement in these applications is optimization: finding input parameters $x$ that maximize a predicted outcome $f(\Phi(x))$ while satisfying constraints $c(\Phi(x)) \leq 0$.

The primary challenge lies in the nature of $\Phi$. Often, these models are "nonwhite-box"—while they allow for backpropagation (e.g., compiled models), they lack the explicit analytical structure required for traditional linear or convex optimization. Existing approaches typically fall into two camps: white-box optimization, which requires full architectural access, or black-box Derivative-Free Optimization (DFO), which is robust but computationally expensive.

Methodology: Hybrid Directional Attacks

The proposed solution is a hybrid algorithm that bridges the gap between fast neural exploitation and rigorous optimization.

Directional NN Attacks

Adversarial attacks, such as the Fast Gradient Sign Method (FGSM) or Projected Gradient Descent (PGD), are traditionally used to find perturbations that cause misclassification. The authors repurpose these as optimization subroutines. Instead of targeting an incorrect label, the attack solver finds a perturbation $d$ that pushes the NN's output $\Phi(x)$ in the direction of the objective's gradient, $\nabla f(\Phi(x))$.

Illustration of a directional attack on a ResNet18 model, where a Samoyed image is perturbed to be classified as a 'crane'.

Reliability via cDSM

Because attacks are heuristic, they may stall or fail to find a descent direction. To ensure reliability, the authors pair the attack operator with the Covering Direct Search Method (cDSM). This DFO algorithm provides a safety net, ensuring asymptotic convergence to a local solution regardless of the attack's success.

The Hybrid Loop

The algorithm alternates between these two modes. In each iteration, it attempts a directional attack. If the attack yields a "sufficient increase" in the objective, the jump is accepted, bypassing the slower DFO steps. If the improvement is marginal or the attack fails, the algorithm reverts to cDSM steps to maintain progress and numerical reliability.

Experimental Evaluation

The method was evaluated on three distinct tasks:

  • Target Image Recovery: Manipulating image coordinates to achieve a specific classification using a pre-trained ResNet18.
  • Counterfactual Warcraft Maps: Generating game maps that alter shortest-path routing costs.
  • Bio-Diesel Production: Optimizing reaction parameters in a Physics-Informed Neural Network (PINN) to maximize yield.

Key Results

The hybrid method ($\mathbb{M}_{hyb}$) consistently outperformed standard DFO baselines, achieving higher objective values with fewer function evaluations. In the Bio-Diesel and Warcraft tasks, the attack step successfully bypassed slow DFO iterations in approximately 50% of early cycles, leading to significant speedups.

Interestingly, the authors found that the Fast Gradient Sign Method (FGSM) was often preferable to the more precise PGD. Within the hybrid framework, the raw speed of FGSM (roughly 6x faster than PGD) outweighed the need for high-precision attacks, as the DFO component handles fine-tuning.

Discussion and Future Work

While the hybrid approach is highly effective for early-stage intensification, the attack operator's utility tends to diminish as the search nears a local optimum. In these late stages, the algorithm relies more heavily on the slower DFO component.

Future research directions include extending the framework to non-smooth functions using simplex gradients and enhancing the DFO engine with local quadratic models or Bayesian strategies to accelerate convergence in the final stages of optimization.

Summary updated

BibTeX
@misc{bouchet2025optimization,
  author = {Philippe Bouchet and Thibaut Vidal},
  title = {{Optimization by Directional Attacks: Solving Problems with Neural Network Surrogates}},
  year = {2025},
  eprint = {2510.01461},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.01461},
  howpublished = {arXiv},
}
Figure