Black-box Optimization of LLM Outputs by Asking for Directions

Jie Zhang, Meng Ding, Yang Liu, Jue Hong, Florian Tramèr
10/19/2025
cs.CRcs.LG

Official code: zj-jayzhang/black_box_llm_optimization (8 stars, last commit 2025-10-21).

Abstract

We present a novel approach for attacking black-box large language models (LLMs) by exploiting their ability to express confidence in natural language. Existing black-box attacks require either access to continuous model outputs like logits or confidence scores (which are rarely available in practice), or rely on proxy signals from other models. Instead, we demonstrate how to prompt LLMs to express their internal confidence in a way that is sufficiently calibrated to enable effective adversarial optimization. We apply our general method to three attack scenarios: adversarial examples for vision-LLMs, jailbreaks and prompt injections. Our attacks successfully generate malicious inputs against systems that only expose textual outputs, thereby dramatically expanding the attack surface for deployed LLMs. We further find that better and larger models exhibit superior calibration when expressing confidence, creating a concerning security paradox where model capability improvements directly enhance vulnerability. Our code is available at this [link](https://github.com/zj-jayzhang/black_box_llm_optimization).

View on arXivView PDF

Code Implementations(1)

This is the official code for "Black-box Optimization of LLM Outputs by Asking for Directions"

83PythonSep 25, 20251 years ago

Similar Papers

Cite this paper

@article{zhang2025blackbox,
  title  = {Black-box Optimization of LLM Outputs by Asking for Directions},
  author = {Jie Zhang and Meng Ding and Yang Liu and Jue Hong and Florian Tramèr},
  year   = {2025},
  eprint = {2510.16794},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.16794v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2510.16794.svg)](https://codeofpaper.com/paper/2510.16794)

Discussion