arXiv:2610.27473cs.CROct 2026

Manuscript Offprint

arXiv:2610.27473

Beyond the Prompt: Recovering Hidden Concepts in Text-to-Image Models

Zhengfeng Zheng, Minghong Fang

Abstract

Text-to-image models can generate visual concepts that their prompts never mention, and recent work shows that such associations can be implanted so that ordinary prompts trigger them. Auditing this behavior requires recovering the description that a prompt omits. Existing prompt optimizers are not well suited to this task. Gradient-based methods require backward access to the scoring encoder. Discrete evolutionary search treats semantically unrelated tokens as equally close. Language-model-guided search requires one inference call per candidate, which limits exploration. This paper presents EmbGA, an embedding-space genetic algorithm that recovers concepts present in a set of images but absent from the prompt that generated them. EmbGA keeps the population structure of genetic search but applies its operators in the token embedding space. Crossover interpolates between parent embeddings, and mutation moves an embedding toward a randomly drawn vocabulary embedding. Each offspring is then projected back to discrete tokens before scoring, so every evaluated candidate is a valid token sequence. We evaluate EmbGA on two benchmarks against six optimizers under two exploration budgets. EmbGA achieves the highest alignment when the exploration budget is large, recovers the most grounded tokens on natural images, and runs much faster than language-model-guided search.

1 Introduction

Users expect the content generated by a text-to-image model to follow the input prompt. However, recent work shows that these models can consistently produce attributes that the prompt never mentions. In the Backdooring Bias setting (Naseh et al. 2025), for example, the prompt “President is writing a speech for the nation” consistently produces images of a president wearing a red tie, while unrelated prompts produce normal images. Because the hidden association appears only in the generated images, inspecting the prompts alone cannot reveal it.

This paper studies how to audit such hidden associations. Instead of preventing a model from learning them, we ask a different question: what is missing from the prompt? Given a clean prompt and a set of images generated from it, the goal is to recover a token sequence that describes the concept present in the images but absent from the prompt. This formulation turns auditing into a search problem and does not require the auditor to know the target concept in advance. The recovered sequence is also a readable description, so a human reviewer can compare it across prompts and judge whether the model shows a systematic bias. We formulate the recovery task as prompt optimization over an image-text alignment objective.

However, existing prompt optimizers have clear limitations in this setting. Gradient-based hard-prompt methods (Zou et al. 2023; Shin et al. 2020; Wen et al. 2023) require backward access to the scoring encoder, which may not be available to an auditor. Discrete evolutionary methods (Sécheresse, Guilbert-Ly, and Villedieu de Torcy 2025) operate on token indices. Since the order of token indices carries no semantic meaning, replacing one token with another can discard useful content found earlier in the search. Language-model-guided optimizers (Guo et al. 2023; Yang et al. 2024) provide a strong semantic prior, but each candidate costs one inference call, which limits the number of candidates that can be evaluated. Hidden concept recovery therefore needs a method that is gradient-free, makes small semantic changes, and is cheap enough to evaluate large populations.

To address these limitations, we propose EmbGA, an embedding-space genetic algorithm for gradient-free prompt optimization. A useful recovered sequence must consist of discrete vocabulary tokens so that it is human-readable. At the same time, the search must reach it through small semantic changes, because population-based search improves solutions step by step. Discrete operators meet the first requirement but not the second, while continuous optimization meets the second but not the first. As shown in Figure 1, EmbGA meets both by performing variation in the continuous embedding space and evaluation in the discrete token space. Crossover interpolates between the embeddings of two parents, and mutation moves an offspring embedding toward a randomly drawn vocabulary embedding, so both operators produce bounded changes. EmbGA then projects each offspring embedding to its nearest vocabulary token, which keeps the optimization gradient-free because the scoring encoder only receives valid token sequences. Finally, deterministic crowding lets each offspring compete with its most similar parent, which keeps multiple lineages in the population.

We evaluate EmbGA on a hidden concept recovery benchmark based on the Backdooring Bias setting (Naseh et al. 2025) and on caption recovery over COCO images (Lin et al. 2014). We compare EmbGA with six methods from images

Figure

Figure 1: Overview of EmbGA. Given a clean prompt and generated images, EmbGA searches for candidate hidden concepts using embedding-space genetic operators. Candidates are projected to discrete tokens and evaluated using CLIP alignment. The example images are drawn from the Age case of our benchmark.

the three families above under two exploration budgets. EmbGA achieves the highest alignment under the large budget, outperforms DiscreteGA under the matched budget, and achieves the best token grounding on COCO. Its runtime is close to that of discrete evolutionary search and one to two orders of magnitude lower than that of language-model-guided search. Our ablation studies further show that embedding-space mutation is the main reason EmbGA remains stable at high mutation rates.

Our contributions are summarized as follows:

• We formulate hidden concept recovery in text-to-image models as a prompt optimization problem whose vocabulary is discrete but whose objective is continuous.

• EmbGA, our proposed method, performs crossover and mutation on token embeddings and projects offspring back to vocabulary tokens before evaluation.

• Experiments on two benchmarks show that EmbGA outperforms discrete evolutionary search, is competitive with gradient-based and language-model-guided optimizers, and runs much faster than the latter.