Manuscript Offprint
arXiv:2610.27473Beyond the Prompt: Recovering Hidden Concepts in Text-to-Image Models
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 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.
Gradient-based hard-prompt optimization. Because prompts are discrete, a common approach is to relax the search into a continuous space and use gradients. Auto-Prompt (Shin et al. 2020) and GCG (Zou et al. 2023) rank candidate token substitutions with a gradient-based score and then evaluate the top candidates. PEZ (Wen et al. 2023) optimizes continuous embeddings directly and projects them onto the vocabulary at each step. PEZ also uses CLIP to discover prompts from images, which is close to our setting, but it requires gradients of the scoring encoder. Textual Inversion (Gal et al. 2022) and LatentPrompt (Bystroński et al. 2025) also optimize in the embedding space. All of these methods require backward passes through the encoder, whereas EmbGA searches in the embedding space without gradients.
Evolutionary and language-model-guided prompt search. Population-based methods avoid gradients by using selection and variation. GAAPO (Sécheresse, Guilbert-Ly, and Villedieu de Torcy 2025) applies crossover and mutation to discrete tokens, and AutoDAN (Liu et al. 2024) uses evolutionary search to generate stealthy jailbreak prompts. APEX (Hsieh et al. 2024) and EvoPrompt (Guo et al. 2023) use a language model to rewrite candidates in natural language, and OPRO (Yang et al. 2024) uses a language model directly as the optimizer. All of these methods modify candidates in the discrete token space, either by changing token indices or by rewriting text.
Hidden concept recovery versus bias detection. Hidden concept recovery and bias detection are complementary. Bias detection checks whether a given attribute appears too often and reports a rate. Hidden concept recovery identifies which attribute is present and reports a description. This difference matters because an auditor cannot list every attribute that a model might have learned. A recovered description can also be checked by a human and then used as the input to a later detection study.
Limitations of existing works. Existing methods thus fall short along three dimensions. Gradient-based optimizers require backward access to the scoring encoder. Discrete evolutionary optimizers treat semantically unrelated tokens as equally close, so their variation operators become unstable at high mutation rates. Language-model-guided optimizers have a high per-candidate cost, which limits the population size and hence the amount of exploration. EmbGA addresses all three limitations, since it is gradient-free, makes semantically meaningful changes, and keeps per-candidate cost low.
3 Problem Statement
Hidden concept. Following the Backdooring Bias setting (Naseh et al. 2025), we assume that a clean prompt x is associated with a visual concept z that x does not mention, so that images generated from x contain z with high probability. We make no assumption about how this association was created or whether z belongs to a predefined set of attributes.
Auditor capability. The auditor has the clean prompt x and a set of images I generated from x. The auditor can query the text encoder and the image encoder of an auxiliary CLIP model to compute alignment scores. The auditor has no access to the gradients, parameters, or intermediate activations of the generative model, and uses only the vocabulary, the token embedding table, and the forward pass of the auxiliary CLIP model. This assumption matches common deployments, in which images are obtained through a hosted interface and scoring is done with a separate pretrained CLIP model. Moreover, the search itself uses no gradients of the CLIP model. The token embedding table is used only to vary candidates, while the scorer is treated as a black box that maps a text sequence to a score. The scorer can therefore be replaced by a model that is accessible only through an API or is not differentiable. The hidden concept z is never given to the search and is used only to evaluate the recovered sequence.
Recovery objective. The auditor seeks a token sequence c of fixed length n, appended to x, that maximizes the average alignment between the augmented prompt and the image set:
Here, V denotes the vocabulary of the auxiliary CLIP text encoder, and denotes the concatenation of x and c. The objective is a smooth function of the encoder input, but the feasible set is finite and has no meaningful order.
4 Challenges and Design Principles
4.1 Key Challenges
Challenge 1: The feasible set is discrete and has no semantic order. The auditor can only submit sequences from . The indices of the tens of thousands of tokens in V reflect how the tokenizer was built rather than their meaning, so tokens with adjacent indices usually have unrelated meanings. A search that represents a candidate as a vector of indices
Algorithm 1 EmbGA for hidden concept recovery.
Require: Clean prompt x, image set I, even population size P, sequence length n, mutation rate m, generations T, tournament size k, embedding table E, vocabulary V
Ensure: Recovered token sequence
1: with each drawn uniformly from ; for
2: for to T do
3: empty list
4: while do
5: two distinct parents chosen by tournament selection of size k
6: ,
7: for to n and do
8: Crossover (Eq. (4))
9: Sample ;
10: Mutation (Eq. (5))
11: With probability m: sample w uniformly from and ;
12: Projection (Eq. (6))
13:
14: end for
15: and for ; append to
16: end while
17: Update and s by deterministic crowding over all entries of
18: end for
19: return where
therefore cannot make small changes and cannot gradually improve a partial solution.
Challenge 2: Discrete variation does not preserve the semantics of parents. Population-based search requires offspring to keep the useful content of their parents while changing in a controlled way. Discrete crossover copies whole positions and cannot combine two parents that each capture part of the concept. Discrete mutation replaces a token with a uniformly sampled one, which can change the meaning of the candidate by an arbitrary amount. A higher mutation rate thus increases exploration but also destroys good solutions, so discrete search works only within a narrow range of mutation rates.
Challenge 3: Exploration is limited by compute. Recovery requires extensive exploration, because the auditor does not know the target concept and the objective over has many local optima. Without gradients, the search explores only by evaluating candidates. Methods that need one language-model call per candidate can evaluate far fewer candidates than methods that need one encoder forward pass, so a practical method must keep the per-candidate cost low.
4.2 Design Principles
Instead of searching directly over , EmbGA searches in the embedding space and enforces the discreteness constraint only when a candidate is scored. This separation is possible because the objective depends on only through the text encoder, and the encoder takes token embeddings rather than token indices as input. Let denote the embedded candidate. Eq. (1) is then equivalent to
where the constraint requires each position to be an entry of the embedding table.
Continuity characteristic. The objective in Eq. (2) is a continuous function of , so nearby embeddings tend to have similar alignment scores. Interpolating between two embeddings produces intermediate representations, and a short interpolation step produces a small change before projection. This property gives the notion of a small step that Challenge 1 lacks, although nearest-token projection does not guarantee semantic continuity. Interpolation also requires no gradients, since it uses only the embedding table.
Discreteness characteristic. The constraint in Eq. (2) matters only when a candidate is scored, because the scoring encoder must receive a discrete token sequence at that point. Between two evaluations, an intermediate representation does not need to correspond to any token. Discrete search enforces the constraint at every step and therefore loses the continuity property. EmbGA instead enforces the constraint only at evaluation time, which keeps both properties.
These two properties determine the design of EmbGA. EmbGA performs variation in the embedding space so that offspring keep the semantics of their parents, and it projects each candidate onto right before evaluation so that every scored candidate is a valid token sequence. Both operations use only the embedding table and the forward pass, so EmbGA is gradient-free. Since each candidate requires only one text encoding, EmbGA also addresses Challenge 3.
5 EmbGA for Hidden Concept Recovery
5.1 Overview
Given a clean prompt x and an image set I, EmbGA maintains a population of P candidate token sequences of length n and updates it for T generations. Each candidate c is appended to x after a comma and scored by its alignment with the image set,
where is the normalized text embedding of and is the normalized image embedding of . As illustrated in Figure 1, each generation has four steps. First, EmbGA selects parents by tournament selection with size three, which favors high-scoring candidates while keeping more diversity than fitness-proportional selection. Second, EmbGA embeds the selected parents and combines them by position-wise interpolation to form two offspring embeddings. Third, EmbGA mutates each offspring position with probability and then projects every position onto its nearest vocabulary token. Fourth, the projected offspring compete with their closest parents through deterministic crowding. After generations, EmbGA returns the highest-scoring candidate in the population. Algorithm 1 gives the full procedure.
5.2 Embedding-Space Crossover
Let the two selected parents be and , and let and denote their token embedding sequences. EmbGA forms two offspring by interpolating the parents independently at every position,
(4)
with independent coefficients . Discrete crossover takes each position from one parent or the other. Eq. (4) instead places each position on the line segment between the two parent embeddings, so an offspring can represent a meaning that neither parent has while staying close to both. Because the coefficients are sampled for each position and each offspring, the same pair of parents can also produce different combinations, which adds exploration.
5.3 Embedding-Space Mutation
EmbGA mutates each offspring position independently with probability . For a selected position, EmbGA samples a random embedding from the embedding table and moves the offspring embedding toward it,
Discrete mutation replaces a token with a random token, so the content of that position is lost and the size of the change depends only on the vocabulary. In contrast, Eq. (5) keeps a fraction of the current embedding. The change is therefore bounded, and the mutated position stays related to its original content. As a result, the mutation rate controls how often the search changes a candidate rather than how much of the candidate is lost. A higher mutation rate can then be used for exploration without destroying good candidates. Section 6.3 shows that this operator is the main reason EmbGA remains stable at high mutation rates.
5.4 Projection Back to the Token Space
Crossover and mutation produce embeddings that usually do not match any entry of the embedding table. EmbGA therefore projects each offspring position onto the vocabulary before scoring the candidate,
where e is the offspring embedding at that position. Eq. (6) keeps EmbGA within the auditing model of Section 3, since scoring needs only a forward pass and the returned result is a readable string. The projection also acts as an implicit regularizer, because it maps embeddings in regions with no nearby token back to the region that the encoder was trained on.
| Category | Hidden Concept | Clean Prompt |
|---|---|---|
| Political (Object) | Bald president wearing a red tie | President is writing a speech for the nation |
| Age | Old Chinese person | Image of a Chinese person eating noodles at a restaurant |
| Gender | Female professor | Cinematic image of a professor in a lab |
| Political (Surround) | Yellow wall | President carefully writing a letter in his office |
| Race | Dark-skinned doctor | A doctor is reading a chart for patients |
| Item | Einstein wearing a top hat | Einstein in a Parisian cafe writing a post |
Table 1: The six recovery cases in our benchmark. Only the clean prompt and the generated images are given to the search.

(a) Hidden Bias Recovery Example
Target concept: Old Chinese person
Input prompt: Image of a Chinese person eating noodles at a restaurant
Recovered tokens:
grandfather
ageing
unsplash
atmospheric
sidewalk
fancafe
\u2063
pottery
adox
connected

(b) COCO Caption Recovery Example
Reference caption:
A couple of computer monitors sitting on top of a wooden desk.
Recovered tokens:
package
foreground
convoy
nestled
gba
happymonday
devops
toy
workspace
!)
chainsaw
domo
:1
ableg
=)
Explicit
Implicit
None
Figure 2: Recovered sequences with each token colored by its grounding label (explicit, implicit, or unrelated; “None” in the legend denotes unrelated). Left: hidden concept recovery. Right: caption recovery on COCO. The token \u2063 is the invisible-separator character U+2063 in the CLIP vocabulary.
5.5 Population Update
EmbGA scores the projected offspring with Eq. (3) and updates the population by deterministic crowding. Each offspring competes with its most similar parent and replaces that parent only if the offspring has a higher score. Since each offspring competes only with a similar parent, the population keeps multiple distinct lineages, and no single lineage can take over the population.
6 Experiments
6.1 Experimental Setup
Benchmarks. We evaluate EmbGA on two benchmarks whose target semantics come from different sources. The first is a hidden concept recovery benchmark based on Backdooring Bias (Naseh et al. 2025). Table 1 lists its six cases, each of which contains a clean prompt, a hidden concept absent from the prompt, and images that contain the concept. For each case, we use a large language model to combine the clean prompt and the hidden concept into ten candidate prompts, and then use Midjourney to generate fifty images for each candidate prompt. This process gives five hundred images per category. The hidden concept is used only for evaluation, so the task tests recovery rather than verification. The second benchmark uses the first three hundred images of the COCO val2017 split (Lin et al. 2014). Its target semantics come from natural images, so this benchmark tests whether EmbGA generalizes beyond the controlled hidden concept setting.
Compared methods. We compare EmbGA with six methods from the three families in Section 2. The gradient-based family includes GCG (Zou et al. 2023), AutoPrompt (Shin et al. 2020), and PEZ (Wen et al. 2023). We give these methods backward access to the scoring encoder, which EmbGA does not use, so their results serve as an upper reference rather than a direct comparison. The evolutionary family is represented by DiscreteGA, a discrete-token genetic baseline based on GAAPO (Sécheresse, Guilbert-Ly, and Villedieu de Torcy 2025). DiscreteGA keeps the midpoint crossover of GAAPO and replaces selected positions with uniformly sampled vo-

(a) High exploration-budget configuration

(b) Matched exploration-budget configuration
Figure 3: Alignment achieved on the hidden concept benchmark, averaged over the six categories, as a function of optimization iteration. Panel (a) uses the high exploration budget and panel (b) equalizes the budget across all methods.
cabulary tokens during mutation. It serves as a direct ablation of EmbGA, since the two methods differ only in the space where the operators act. The language-model-guided family includes EvoPrompt (Guo et al. 2023) and OPRO (Yang et al. 2024), both of which use Qwen2.5-14B-Instruct in BF16 (Bai et al. 2023).
Evaluation metrics. We report two complementary metrics. The first is the CLIP alignment score, which measures how well the recovered prompt matches the target images. Given normalized image embeddings and the normalized text embedding of the recovered prompt, the score is defined as . Unlike the fitness in Eq. (3), this metric clips negative similarities to zero. Unlike CLIPScore (Hessel et al. 2021), it uses no calibration, because our goal is to compare optimizers rather than to match human judgment. However, a sequence can obtain a high alignment score by exploiting weaknesses of the encoder while containing no words that a human would recognize. We therefore also report a token-level grounding score (TLGS). A separate language model labels each recovered token as explicit, implicit, or unrelated with respect to the target concept or reference caption, and these labels receive scores of 1.0, 0.5, and 0.0, respectively. For a recovered sequence of tokens, the score is with . We use Qwen3-32B in BF16 (Bai et al. 2023) as the evaluator. Since TLGS relies on model judgment, we use it to compare methods rather than as an absolute measure of correctness. Figure 2 shows examples of these labels.
Parameter setup. All methods use the same CLIP ViT-B/32 encoder for scoring, append the recovered tokens to the clean prompt after a comma, and use a fixed sequence length of ten tokens for hidden concept recovery and fifteen tokens for caption recovery. EmbGA and DiscreteGA both use a tournament size of three and a mutation rate of 0.1. We run each stochastic method five times with different random seeds and report the mean and standard deviation. Because of their high cost, the language-model-guided baselines are run once. Since Challenge 3 links exploration to compute, we evaluate the hidden concept benchmark under two budget settings. In the high-budget setting, EmbGA and DiscreteGA use a population of 4000, GCG and AutoPrompt use a top-k of 512, and PEZ optimizes a batch of 1000 initializations and returns the best one. EvoPrompt and OPRO use 100 candidates, which is the largest number their per-candidate cost allows. In the matched-budget setting, every method is limited to 100 candidates, top-k values, or batch entries, which separates the effect of algorithm design from the effect of scale.
6.2 Main Results
EmbGA achieves the highest alignment under the high budget. Figure 3(a) shows the alignment averaged over the six categories under the high budget. EmbGA achieves the highest average score among all seven methods, even though it does not use the gradients that GCG, AutoPrompt, and PEZ use. The most direct comparison is with DiscreteGA, which uses the same population size, selection rule, replacement rule, and mutation rate as EmbGA. Since the two methods differ only in whether the operators act on embeddings or on token indices, the advantage of EmbGA comes from the operator space. This result supports the continuity property in Section 4.2.
Gradient-based methods lead under the matched budget. Figure 3(b) limits every method to one hundred candidates. In this setting, AutoPrompt and GCG achieve the highest alignment. This result is expected, because a gradient points to a promising substitution without evaluating it, which is most useful when only a few evaluations are allowed. EmbGA remains the best evolutionary method and
| Budget | Category | AutoPrompt | DiscreteGA | EmbGA | EvoPrompt | GCG | OPRO | PEZ |
|---|---|---|---|---|---|---|---|---|
| High | Age | 0.143 | 0.145 | 0.209 | 0.182 | 0.115 | 0.091 | 0.000 |
| Gender | 0.088 | 0.024 | 0.048 | 0.091 | 0.055 | 0.136 | 0.069 | |
| Item | 0.055 | 0.064 | 0.065 | 0.091 | 0.037 | 0.091 | 0.000 | |
| Political Obj. | 0.028 | 0.018 | 0.038 | 0.000 | 0.057 | 0.091 | 0.000 | |
| Political Sur. | 0.095 | 0.093 | 0.120 | 0.000 | 0.113 | 0.000 | 0.046 | |
| Race | 0.073 | 0.009 | 0.045 | 0.100 | 0.056 | 0.050 | 0.027 | |
| Average | 0.080 | 0.059 | 0.088 | 0.077 | 0.072 | 0.077 | 0.024 | |
| Matched | Age | 0.056 | 0.118 | 0.120 | 0.182 | 0.102 | 0.091 | 0.038 |
| Gender | 0.027 | 0.018 | 0.036 | 0.091 | 0.076 | 0.136 | 0.000 | |
| Item | 0.000 | 0.018 | 0.009 | 0.091 | 0.068 | 0.091 | 0.009 | |
| Political Obj. | 0.018 | 0.000 | 0.000 | 0.000 | 0.000 | 0.091 | 0.000 | |
| Political Sur. | 0.049 | 0.038 | 0.009 | 0.000 | 0.073 | 0.000 | 0.027 | |
| Race | 0.060 | 0.018 | 0.027 | 0.100 | 0.018 | 0.050 | 0.000 | |
| Average | 0.035 | 0.035 | 0.034 | 0.077 | 0.056 | 0.077 | 0.012 |
Table 2: Token grounding ( ) per category under the high and matched exploration budgets. Under the high budget, EmbGA achieves the best average, and its margin over DiscreteGA shows the gain from changing the operator space at the same population size. Under the matched budget, the language-model-guided optimizers achieve the best grounding because of their semantic prior.
still outperforms DiscreteGA by a small margin. The two panels thus show a trade-off between gradient information and exploration. Gradient-based methods perform best when exploration is limited, while EmbGA uses additional evaluations more effectively and takes the lead as the budget grows. When backward access to the scoring encoder is unavailable but forward evaluations are affordable, the high-budget setting is the relevant one.
Higher alignment does not always lead to better grounding. Table 2 reports token grounding under the two budgets. Under the matched budget, EvoPrompt and OPRO achieve the highest average grounding of 0.077, compared with 0.034 for EmbGA and 0.035 for DiscreteGA, despite their lower alignment. A language model tends to propose words related to the target domain, whereas a search without such guidance can reach high alignment with tokens that the evaluator labels as unrelated. Under the high budget, this advantage disappears. EmbGA achieves the highest average grounding of 0.088, compared with 0.077 for both language-model-guided methods and 0.059 for DiscreteGA. With enough exploration, EmbGA thus finds semantically related tokens without a language-model prior. The per-category results show that no method is best in every category. EmbGA leads on Age and Political Surround, while OPRO leads on Gender and Political Object. We attribute this variation to differences in concept size and to the fact that one sequence of ten tokens must describe an entire image set. In addition, the absolute grounding scores are low for all methods, which shows that recovering a complete semantic description remains difficult. These results therefore show relative improvements in token grounding rather than reliable recovery of the full hidden concept.
EmbGA also recovers ordinary semantics on COCO. Table 3 reports caption recovery on COCO, and Figure 4 shows the optimization curves. Since the per-iteration cost differs greatly across method families, we fix a compute budget of about two hundred seconds and configure each method to use this budget: a population of 2200 for DiscreteGA and 2000 for EmbGA, a top-k of 256 for AutoPrompt and 276 for GCG, and a batch of 1150 initializations for PEZ. EvoPrompt and OPRO are excluded because their runtime far exceeds the budget. GCG and AutoPrompt achieve the highest alignment of 0.465 and 0.463, respectively, and EmbGA follows at 0.445 without using gradients. The ranking is different for grounding, where EmbGA achieves the best score of 0.114, followed by DiscreteGA at 0.109, AutoPrompt at 0.095, GCG at 0.089, and PEZ at 0.067. This result, together with the examples in Figure 2, indicates that the tokens recovered by EmbGA more often describe the image content instead of only matching the encoder, which is important for auditing because the output of an audit is read by a human.

Figure 4: Alignment over the course of optimization on COCO caption recovery, where every method is given the same compute budget rather than the same number of candidates.
EmbGA adds little cost over DiscreteGA and is much

Figure 5: Ablation study of EmbGA. Left: alignment of the four combinations of discrete and embedding-space crossover and mutation under different mutation rates, with a population of one thousand. Right: alignment under different population sizes for the full embedding-space configuration with a mutation rate of 0.1. Each point is averaged over five runs.
| Method | CLIP Score | TLGS | Runtime (s) |
|---|---|---|---|
| AutoPrompt | 0.463 ± 0.028 | 0.095 | 201.69 ± 2.03 |
| DiscreteGA | 0.413 ± 0.021 | 0.109 | 205.57 ± 1.27 |
| EmbGA | 0.445 ± 0.020 | 0.114 | 194.19 ± 1.26 |
| GCG | 0.465 ± 0.028 | 0.089 | 190.81 ± 0.95 |
| PEZ | 0.321 ± 0.016 | 0.067 | 207.69 ± 1.29 |
Table 3: Caption recovery on COCO under a fixed compute budget of roughly two hundred seconds. EmbGA recovers the most grounded tokens, while GCG and AutoPrompt achieve slightly higher alignment.
| Method | High | Matched |
|---|---|---|
| AutoPrompt | 312.68 ± 2.00 | 78.26 ± 0.04 |
| DiscreteGA | 461.30 ± 2.27 | 12.88 ± 0.02 |
| EmbGA | 473.14 ± 2.36 | 13.19 ± 0.03 |
| EvoPrompt | 15318.61 | 15318.61 |
| GCG | 293.63 ± 1.43 | 59.77 ± 0.03 |
| OPRO | 26868.00 | 26868.00 |
| PEZ | 223.24 ± 1.32 | 23.67 ± 0.06 |
Table 4: Wall-clock time in seconds ( ) of one recovery run on the hidden concept benchmark under the two budgets. Entries without standard deviations are single runs of the language-model-guided methods.
cheaper than language-model-guided search. Table 4 reports the wall-clock time of one recovery run on the hidden concept benchmark. Under the high budget, EmbGA takes 473.14 seconds and DiscreteGA takes 461.30 seconds, so interpolation and nearest-token projection add only about to the runtime. In contrast, EvoPrompt takes 15318.61 seconds and OPRO takes 26868.00 seconds, which are about 32 and 57 times the runtime of EmbGA, even though they evaluate only one fortieth as many candidates. Their runtimes stay the same under both budgets, because they already use 100 candidates in the high-budget setting and cannot be scaled further. Under the matched budget, EmbGA takes 13.19 seconds, which is close to DiscreteGA at 12.88 seconds and lower than PEZ at 23.67, GCG at 59.77, and AutoPrompt at 78.26 seconds, because each gradient step costs more than a forward pass.
6.3 Ablation Studies
Figure 5 separates the effects of crossover and mutation. The fully discrete configuration performs worst at every nonzero mutation rate, and replacing either operator with its embedding-space version improves alignment. Embedding-space crossover helps mainly at low mutation rates. Embedding-space mutation keeps performance stable as the mutation rate increases, which shows that bounded mutation is the main source of robustness. Performance also improves with population size and begins to saturate between 2000 and 4000 candidates. These results show that the gains of EmbGA come from its operators rather than from population size alone.
7 Limitations and Conclusion
We propose EmbGA, which moves genetic crossover and mutation from discrete token indices to the embedding space and projects every candidate back to vocabulary tokens before evaluation. On two benchmarks, EmbGA outperforms discrete evolutionary search, achieves the highest alignment when the exploration budget is large, and achieves the highest grounding score on COCO, while running much faster than language-model-guided methods. Gradient-based methods remain a better choice when backward access is available and the evaluation budget is small.
Our evaluation covers only one hidden concept setup and a subset of COCO, so its generalization to other encoders, generators, and concept types remains open. In addition, EmbGA requires the token embedding table of the auxiliary CLIP model, and TLGS relies on a language-model evaluator. Since a high alignment score does not guarantee that the recovered tokens describe concepts absent from the prompt, the recovered sequences should be treated as candidate descriptions rather than definitive identifications.
References
Bai, J.; Bai, S.; Chu, Y.; Cui, Z.; Dang, K.; Deng, X.; Fan, Y.; Ge, W.; Han, Y.; Huang, F.; et al. 2023. Qwen technical report. arXiv preprint arXiv:2309.16609.
Bystroński, M.; Piotrowski, G.; Chawla, N. V.; and Kajdanowicz, T. 2025. LatentPrompt: Optimizing Promts in Latent Space. arXiv preprint arXiv:2508.02452.
D'Incà, M.; Peruzzo, E.; Mancini, M.; Xu, D.; Goel, V.; Xu, X.; Wang, Z.; Shi, H.; and Sebe, N. 2024. Openbias: Open-set bias detection in text-to-image generative models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 12225–12235.
Gal, R.; Alaluf, Y.; Atzmon, Y.; Patashnik, O.; Bermano, A. H.; Chechik, G.; and Cohen-Or, D. 2022. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618.
Guo, Q.; Wang, R.; Guo, J.; Li, B.; Song, K.; Tan, X.; Liu, G.; Bian, J.; and Yang, Y. 2023. Evoprompt: Connecting llms with evolutionary algorithms yields powerful prompt optimizers. arXiv preprint arXiv:2309.08532.
Hessel, J.; Holtzman, A.; Forbes, M.; Le Bras, R.; and Choi, Y. 2021. Clipscore: A reference-free evaluation metric for image captioning. In Proceedings of the 2021 conference on empirical methods in natural language processing, 7514–7528.
Hsieh, C.-J.; Si, S.; Yu, F.; and Dhillon, I. 2024. Automatic engineering of long prompts. In Findings of the Association for Computational Linguistics: ACL 2024, 10672–10685.
Lin, T.-Y.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; and Zitnick, C. L. 2014. Microsoft coco: Common objects in context. In European conference on computer vision, 740–755. Springer.
Liu, X.; Xu, N.; Chen, M.; and Xiao, C. 2024. Autodan: Generating stealthy jailbreak prompts on aligned large language models. In International Conference on Learning Representations, volume 2024, 56174–56194.
Naseh, A.; Roh, J.; Bagdasarian, E.; and Houmansadr, A. 2025. Backdooring Bias ( ) into Stable Diffusion Models. In 34th USENIX Security Symposium (USENIX Security 25), 977–996.
Sécheresse, X.; Guilbert-Ly, J.-Y.; and Villedieu de Torcy, A. 2025. GAAPO: genetic algorithmic applied to prompt optimization. Frontiers in Artificial Intelligence, 8: 1613007.
Shin, T.; Razeghi, Y.; Iv, R. L. L.; Wallace, E.; and Singh, S. 2020. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In Proceedings of the 2020 conference on empirical methods in natural language processing (EMNLP), 4222–4235.
Wen, Y.; Jain, N.; Kitchenbauer, J.; Goldblum, M.; Geiping, J.; and Goldstein, T. 2023. Hard prompts made easy: Gradient-based discrete optimization for prompt tuning and discovery. Advances in Neural Information Processing Systems, 36: 51008–51025.
Yang, C.; Wang, X.; Lu, Y.; Liu, H.; Le, Q. V.; Zhou, D.; and Chen, X. 2024. Large language models as optimizers. In International Conference on Learning Representations, volume 2024, 12028–12068.
Zou, A.; Wang, Z.; Carlini, N.; Nasr, M.; Kolter, J. Z.; and Fredrikson, M. 2023. Universal and transferable adversarial attacks on aligned language models. arXiv preprint arXiv:2307.15043.