Manuscript Offprint
arXiv:2611.07061Segment What It Can Draw: Querying a Text-to-Image Generator with Its Own Images for Skin Lesion Segmentation
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Skin lesion segmentation without annotated masks requires the target to be specified through other cues. Existing approaches rely on dermoscopy-specific rules, annotation-derived model priors, or user-selected regions. A general text-to-image diffusion transformer offers a text interface to the target, but its concept-word attention is unreliable on dermoscopy images: in the model's attention-output space, the word-derived skin-to-lesion direction is poorly aligned with the direction separating real skin from real lesions. We show that the direction derived from generated healthy-skin and lesion images is substantially better aligned. Based on this finding, we propose GENIQ, a training-free method that constructs initial skin and lesion prototypes from generated images and refines them using the most skin-like and lesion-like patches from unlabelled dermoscopy images. It scores test patches along the refined direction and applies a gated threshold to suppress contextual spill-over around small lesions. Without inference-time annotations or additional models, GENIQ achieves Dice scores of 0.85–0.88 on three dermoscopy test sets. It outperforms zero-shot and word-based attention methods on all three sets, and a hand-designed dermoscopy pipeline in Dice and IoU on two.
1. Introduction
Skin lesion segmentation delineates lesions in dermoscopy images, enabling the measurement of their size, border, and change over time [18, 26]. However, obtaining pixel-level masks is costly, motivating segmentation methods that require no mask annotations during training or inference. Without such annotations, a central challenge is how to specify the target region to be segmented. Existing approaches rely on dermoscopy-specific rules, annotation-derived priors embedded in pretrained models, or manual region selection. Text-to-image generators offer another potential source of guidance: when prompted with a lesion-related word, they can generate both lesions and surrounding healthy skin, suggesting that their internal features may encode the distinction between the two.
Turning this observation into segmentation requires a mechanism for reading the generator's internal features at the patch level. ConceptAttention [5] provides such a mechanism without additional training. In a diffusion transformer, image patches are represented as tokens whose attention outputs encode each patch in the context of the entire image [21]. To localize a target, ConceptAttention introduces its concept word as an additional token, processes it through the same attention layers, and scores each image patch by its proximity to the concept token relative to other words in the shared attention-output space. It thus converts a text-named target into a training-free, patch-level word query.
On dermoscopy images, however, this word-based query is unreliable. In FLUX [13, 14], the lesion word map ranks lesion patches no better than a spatial prior obtained by averaging the ground-truth masks of other images. The failure is not limited to lesion-related words: the hair map can even highlight a mole in an image containing no hair (Figure 1b, top right). These failures appear to arise from the query rather than from the image-token features themselves. In the shared attention-output space, the vector from the skin word to the lesion word has a cosine similarity of only 0.21 with the direction from real skin patches to real lesion patches. This alignment is approximately as weak as that of the skin-to-hair word vector. By contrast, the direction from generated healthy-skin patches to generated lesion patches achieves a cosine similarity of 0.61 with the real skin-to-lesion direction (Figure 1b, left). Thus, the feature space contains a useful skin-to-lesion direction, but concept words do not reliably recover it. This raises our

Figure 1. GENIQ: task, query construction, and thresholding. (a) Given a dermoscopy image, a text-named target, frozen FLUX [13, 14], and unlabelled images, GENIQ predicts a lesion mask without training, annotations, or external models. (b) Concept-word directions align poorly with the real skin-to-lesion direction, whereas the generated healthy-skin-to-lesion direction aligns better. GENIQ uses the word only inside generated images and refines the resulting query on unlabelled real images (green). (c) On a small lesion, the mean and two-class Otsu thresholds keep the score spill-over, whereas the upper threshold of a three-level split lies near the lesion edge. Cyan: clinician's outline; histogram colours: the three score levels.
central question: can we use a target specified only by text to construct a reliable query for these features, without training, inference-time annotations, or external models (Figure 1a)?
Prior work addresses complementary parts of this problem but leaves a gap. 1) Label-free lesion segmentation uses dermoscopy-specific pipelines or pretrained models, including superpixel clustering after hair removal, SAM prompted by vision-language saliency, and Stable Diffusion self-attention grouped into regions [4, 10, 11, 22]. However, the target is still specified through domain-specific rules, annotation-derived model priors, or human selection, making these methods difficult to extend to new text-named findings. 2) Word read-outs of diffusion models localise objects by scoring image patches against prompt or concept words [9, 27]. Because the concept word remains the query, even when prototypes from unlabelled images are introduced [19], these methods retain the word-to-image misalignment observed above. 3) Generated references construct visual prototypes from generated class images, using class-word cross-attention to separate foreground and background patches [2, 8]. However, they typically use background patches from the same class image rather than an explicitly generated negative class, such as healthy skin, and often extract features with an external encoder. They therefore do not provide the healthy-skin-to-lesion direction in the generator's own attention-output space. Together, these methods do not combine text-based target specification with an image-derived query constructed in the generator's own attention-output space.
Our Approach: Querying with Generated Images. To fill this gap, we propose GENIQ, which replaces Concept-Attention's direct word query with an image-derived query constructed by the same generator. Rather than using the concept word to match real lesion patches directly, we use it only within generated images, where distinguishing a gen-
erated lesion from its surrounding skin is easier. Generated lesion and healthy-skin images then define a visual direction for querying real dermoscopy images (Figure 1b, right). We further adapt this direction using unlabelled real images and introduce a gated threshold to reduce spill-over onto skin around small lesions (Figure 1c). In this way, generated images bridge the gap between a text-named target and its visual appearance in real images.
Our contributions are as follows: 1) We introduce a generated-image query that replaces the poorly aligned concept-word query with a healthy-skin-to-lesion direction constructed in the generator's own attention-output space. 2) We refine this query using unlabelled dermoscopy images, adapting it to real lesion appearance without training or annotations. 3) We introduce a gated threshold that reduces attention spill-over around small lesions. 4) On three dermoscopy test sets, GENIQ outperforms zero-shot baselines and word-based read-outs, and surpasses a hand-designed dermoscopy pipeline on two of the three sets.

Figure 2. GENIQ. Top: the workflow; its grey parts (FLUX, attention outputs) are kept from ConceptAttention, and the real images without masks (dashed) are read once before testing, by Step 2 and, for , by Step 4. Bottom: the four steps (Sections 3.3–3.6) and what each passes on. Step 1: P, N from generated images. Step 2: P', N' from the top 20% and bottom 50% of the real images' score maps. Step 3: the map from each patch's signed distance to m along N' P'. Step 4: the top level if , else one Otsu cut (as here).
a general-purpose generator without medical-specific training. Concept read-outs from diffusion models. Diffusion models expose spatial information about prompt concepts through their internal attention. In UNet-based models, cross-attention between a word and image positions can be aggregated into a heat map, which training-free segmenters subsequently filter and refine [21, 24]. In multimodal diffusion transformers, ConceptAttention [5] introduces the concept word as an additional token and compares its attention output with those of image patches. Later methods add grounding layers, propagate scores between patches, or incorporate visual prototypes constructed from unlabelled real images [3, 7, 9, 12, 27]. These refinements retain the concept word as the query or as the anchor for the final score. Moreover, they have primarily been evaluated on natural-image categories, leaving settings with strong word-to-visual misalignment largely unexplored. Generated references for segmentation. Generated-reference methods use synthetic class images to construct visual prototypes. OVD-iff [8] localises objects in Stable Diffusion images through cross-attention and forms class, part, and background prototypes; one variant encodes both generated and test images using the generator's own features. FreeDA [2] and FOS-SIL [1] similarly construct generated references but encode them with an external vision model. Other methods form prototypes directly from unlabelled test images [15], while generated image-mask pairs can instead be used to train a segmenter [16, 25]. These approaches do not construct an explicit negative-to-target direction from generated classes in the generator's attention-output space: generated-reference methods use background patches from target-class images, whereas test-time prototypes require an existing query to identify target patches.
3. Method
3.1. Overview
GENIQ turns a text-named target into a segmentation mask in four steps (Figure 2). Step 1 translates the target word into a visual query: the generator produces lesion and healthy-skin images, and the concept word identifies lesion patches only within the generated images. The resulting lesion and skin prototypes define an initial healthy-skin-to-lesion direction. Step 2 bridges the synthetic-to-real gap by using this direction to find lesion-like and skin-like patches in an unlabelled dermoscopy pool, which refine the two prototypes before testing. Step 3 projects each test patch onto the refined direction to produce a lesion score map. Step 4 converts the score map into a mask with a gated threshold that separates small lesions from attention spill-over (Section 3.6). GENIQ uses the same image-token attention outputs as ConceptAttention, but replaces its direct word query with the refined image-derived direction and its map-mean threshold with the gated threshold.
3.2. Task and Preliminaries
Task. Given a dermoscopy image , a frozen text-to-image diffusion transformer , a textual target specification , and a pool of unlabelled dermoscopy images, the task is to predict a binary lesion mask , where and are its height and width.
The textual specification is , where is the target concept; is a list of concepts that may appear in the image; and and are prompts describing the target and its healthy reference, respectively. Here and ; the prompts are given in Supp. C. Only specifies the target: contains no masks or target identities. The method updates no parameter, uses no annotation during inference, and invokes no model other than . Clinician masks are used only for evaluation.
Image-Token Attention Outputs. We represent an image using attention outputs from the double-stream blocks of a multimodal diffusion transformer such as FLUX [13, 14]. The image is encoded by the model's autoencoder, perturbed at a fixed diffusion timestep , and passed through once with a fixed caption. Let denote the spatially pooled attention output of patch in block , taken before the attention output projection. Averaging over a set of blocks gives
where is the pooled patch grid and is the representation of patch p used in the following subsections.
Concept-Word Marking. Following ConceptAttention [5], each concept is introduced as an additional concept token. Let denote its attention output in block . Concept tokens attend to image tokens, but image tokens do not attend back, so is independent of . The soft weight of concept at patch is
We call , the target concept map. GENIQ uses this map only to mark the target in generated images; real-image scores are defined from in the following subsections.
3.3. Querying with Generated Images
Why Generated Images Define the Query. As observed in Figure 1b, the direction from the skin concept token to the lesion concept token is poorly aligned with the visual direction from real skin to real lesions, whereas the direction derived from generated images is better aligned (Section 4.4). We therefore use the concept word only to locate lesions within generated lesion images, where it need only distinguish a known lesion from the surrounding skin (Supp. C shows the marked regions). The query is built from the image-token outputs of these generated lesions and of generated healthy skin. Assumption 1 (Generated-Direction Fidelity). The direction between generated healthy-skin and lesion features is sufficiently aligned with the corresponding direction in real dermoscopy images to provide an initial query. Section 4.4 tests it.
Prototype Construction. The generator samples a set of lesion images from the target prompts and a set of healthy-skin images from the healthy-reference prompts . For a generated image , let denote the representation of patch from Equation (1), and let denote its concept weight from Equation (2). For each lesion image , we define its marked lesion region as
where is the patch grid, C is the concept list, and w is the target concept.
The generated lesion prototype P and healthy-skin prototype N are
(4)
Averaging within each image first gives every generated image equal weight, regardless of lesion size.
The difference between P and N defines the initial generated-image query. We generate reference images once, using two prompts and eight random seeds for each class; further details are in Supp. C.
3.4. Refining with Ranked Real Patches
Why Refine with Unlabelled Images. The generated prototypes P and N identify the visual direction from healthy skin to lesion, but their endpoints reflect synthetic rather than real dermoscopy appearance (Supp. C). We therefore use the generated direction to rank the patches of the unlabelled pool U and replace the prototypes with the most lesion-like and skin-like real patches. The generated direction thus supplies the target identity, and the selected patches supply the real-domain appearance; no mask or spatial prior is needed.
Refined Prototypes. For a patch representation x and two prototypes P, N, we define the score
the position of x along the direction from N to P; larger values are more lesion-like. Let contain the top fraction of the patches of an unlabelled image by , and let contain the bottom fraction. Pooling the selected patches over the unlabelled images gives the refined lesion and skin prototypes
(6)
We use and . The refinement runs once before inference, and its prototypes are shared by all test images; no test image contributes to them. Section 4.6 studies the effect of the pool size and patch fractions.
3.5. Scoring along One Direction
Why Score along One Direction. We score each test patch by its position along the refined direction . Unlike the concept-word map in Equation (2), this score involves
Table 1. Lesion masks on three dermoscopy test sets. Dice and IoU at , mean with the half-width of the 95% bootstrap confidence interval over test images as a subscript; best mean per column in bold; paired differences in Table S6. Map-producing baselines are thresholded by the rule of Section 3.6 with their own fitted on the labelled validation split, ours with the label-free of its unlabelled pool; mask-producing methods use their own rule. Rotated labels and parentheses give the baseline groups of Section 4.2; FLUX and Other models split the baselines evaluated by ConceptAttention by backbone, and Control keeps our generated images and regions but swaps the feature extractor. Strongest of the seven Chefer-codebase CLIP explainability variants evaluated by ConceptAttention; all seven, the remaining hand-designed methods, and paired differences are in the supplementary material. Official DiffSeg code with ADZUS's settings; the lesion is the region nearest the image centre, a label-free rule chosen on the validation split (Table S4).
| Method | ISIC-2018 (1,000) | PH2 (200) | HAM10000 (1,000) | ||||
|---|---|---|---|---|---|---|---|
| Dice | IoU | Dice | IoU | Dice | IoU | ||
| Mean-mask prior (no image) | |||||||
| Zero-shot | MedCLIP-SAMv2 | ||||||
| ADZUS (DiffSeg) | |||||||
| FLUX | ConceptAttention, layers 14–17 | ||||||
| ConceptAttention, layers 9–13 | |||||||
| FLUX cross-attention | |||||||
| Other models | DAAM (SD-XL) | ||||||
| CLIP TextSpan | |||||||
| DINO self-attention | |||||||
| CLIP rollout | |||||||
| Control | BiomedCLIP features | ||||||
| DINov2 features | |||||||
| CLIP features | |||||||
| SLED (hand-designed) | |||||||
| Ours | |||||||
neither competition with distractor concepts nor a classifier fitted from labelled data. It does, however, assume that the same lesion-to-skin contrast applies across spatial locations. Assumption 2 (Position-Invariant Contrast). The target tends to differ from its surroundings in the same feature-space direction wherever it appears in the image. We adopt this assumption for dermoscopy, where lesions generally differ from surrounding skin in colour and texture regardless of position.
Lesion Score. Each test patch is scored with the refined prototypes, . A larger indicates a more lesion-like patch, and exactly when is closer to than to in Euclidean distance. Thus, Equation (5) is a nearest-centroid linear discriminant with identity covariance. Neither nor is normalised.
For efficiency, all patch representations and prototypes are mapped to 256 dimensions by the same fixed random projection before scoring; the projection is omitted from the notation and described in Supp. A. The patch scores are bilinearly upsampled to the image resolution to form the score map .
3.6. Thresholding the Map by Level Separation
Why Gate the Threshold on Separation. Because attention mixes information across tokens, patches near a lesion can inherit part of its context and receive intermediate scores. The resulting map can therefore exhibit three approximate levels: lesion, contextual spill-over, and background (Figure 1c). For a small lesion, a two-class threshold may group the spill-over with the lesion. We therefore retain only the highest score level when it is clearly separated from the remaining map, and otherwise fall back to a two-class threshold.
Gated Threshold. Let be the two thresholds returned by three-class multi-Otsu, MultiOtsu, and let Otsu() denote the threshold returned by two-class Otsu [17]. We measure the separation of the highest score level relative to the map's own spread, , where is the standard deviation of the pixel scores in , so the gate does not depend on the scale of the scores. The final mask is
where is the minimum separation to keep only the top level.
(a) read-out per layer

(b) real patches, same units

(c) patch variance
(d) 23 words

Figure 3. Why generated images work and the concept word fails (validation split; (b)–(d) at layers 14–17; dashed: mean-mask prior). (a) Lesion AUROC per double-stream layer of the word map, our map, and labelled real prototypes (t = 0.76). (b) Patches minus their image mean along the unit word and generated directions (same units; 1,500 per class). (c) Within-image variance along each direction relative to a random one. (d) 23 words: cosine with the real skin-to-lesion direction against AUROC without softmax; star: generated direction.
Both and are obtained without annotations. For each image in the unlabelled pool , we construct a score map using and and compute its separation . We then set to the two-class Otsu threshold of these separations. Thus, only maps with a clearly isolated top level use .
4. Experiments
4.1. Research Questions
We first ask whether GENIQ segments lesions better than label-free alternatives (RQ1, Section 4.3) and why generated images work as a query where the concept word fails (RQ2, Section 4.4). We then measure how much each module contributes (RQ3, Section 4.5), how much the choices fixed on the validation split move the masks (RQ4, Section 4.6), and how the query and the threshold change a single mask (RQ5, Section 4.7).
4.2. Setup
Datasets. The test sets are the ISIC-2018 test set (1,000 images), PH2 (200 images, masks from a public mirror at ), and 1,000 HAM10000 images, one per lesion, that share no image with ISIC-2018 lesion segmentation. The labelled validation split holds 500 ISIC-2018 lesion-segmentation training images, disjoint from every test set. As part of method development, it fixed the prompts, layers, noise level, and refinement fractions of GENIQ once (Section 4.6 varies them). The refinement pool of Section 3.4 is the same 500 images with their masks unread. The prototypes , and the cut-off are fixed before any test image is read, and each test image is segmented on its own. A test image takes 2.7 s on one A100 GPU (Supp. B).
Model and Baselines. All methods that read FLUX use the unmodified FLUX.1-dev at , the layer set , noise level , the caption “a lesion”, and the guidance input of FLUX.1-dev set to 3.5; no
weight is fine-tuned. The baselines fall into four groups. (1) No image: the mean-mask prior, the mean ground-truth mask of the other images of the same test set, which uses test labels. (2) Hand-designed for dermoscopy: SLED, with four simpler methods in Supp. E. (3) External zero-shot methods: MedCLIP-SAMv2, ADZUS, and iSeg, which iteratively refines Stable Diffusion cross-attention with self-attention. ADZUS merges Stable Diffusion self-attention into regions and leaves the choice of the lesion region to a clinician, so we take the region nearest the image centre. (4) Word read-outs score each patch against the concept word and are taken with public code from the comparison of ConceptAttention. They are ConceptAttention at layers 14–17, as in its segmentation experiments, and at layers 9–13, FLUX cross-attention, DAAM on SD-XL, CLIP TextSpan, and seven CLIP explainability variants. DINO self-attention, which uses no word, is listed with them. ConceptAttention's word map and our map read the same attention outputs, so their comparison changes only what queries the features and how a patch is scored; the word map averages five noise draws in the full feature space, while GENIQ uses one draw after a random projection (Supp. A). As a control, we also read our generated images and marked regions with Biomed-CLIP, DINOv2, or CLIP features in place of FLUX's. Baselines run from official or upstream code; Supp. E lists the exceptions and settings.
Metrics. Masks are scored by Dice and IoU at , and maps by AUROC on the patch grid. IoU is , which for one image equals Dice/(2 - Dice), so the two rank masks alike per image and differ only when averaged, where IoU weighs poor overlaps more. Confidence intervals are 95% bootstrap intervals over test images, paired when two methods are compared on the same images. Every map-producing baseline is thresholded by the rule of Section 3.6 with its own fitted on the labelled validation split (Supp. I), which can only favour the baselines.

Figure 4. Design choices and sensitivity (stars: our setting). (a) From ConceptAttention to GENIQ, one module at a time (test Dice, 95% bootstrap intervals); hatched: the gate replaced by one per-image Otsu cut. (b) Validation Dice against unlabelled-pool size (mean ± s.d. over 20 draws). (c) Test Dice with generated images only (grey) and after refinement (orange) over five prompt sets and five generated image sets. (d) Validation Dice over three noise levels t and four layer groups, with generated images only (dashed) and after refinement (solid).
Mask-producing methods keep their own rule, and GENIQ uses its label-free . Supp. D gives the fitting grid and the histogram settings. Table S3 repeats the comparison under a single per-image Otsu threshold for every method.
4.3. RQ1: Comparison with Label-Free Segmenters
Setup. We compare masks with the baselines of Section 4.2 on the three test sets (Table 1); Supp. F shows the maps of every baseline on representative images.
Our masks outperform the pipeline hand-designed for dermoscopy in Dice and IoU on two test sets, and trail it on PH2. The paired differences on ISIC-2018 and HAM10000 have confidence intervals above zero, and on PH2 below zero (Tables 1 and S6). SLED leads or ties on nevi, 80% of PH2, and trails by up to 0.25 Dice on vignetted and non-nevus lesions (Supp. H). Our masks outperform the external zero-shot methods and every word read-out on all three test sets. All paired Dice intervals against them exclude zero, as do the IoU intervals (ADZUS: Dice only; Tables S6 and S4). This also holds under a single per-image Otsu threshold (Table S3). The closest, ConceptAttention at layers 9–13, trails ours by 0.07 to 0.14 Dice. ADZUS stays below 0.55 Dice even with its regions chosen by test labels (Table S4). Methods that define the target with real images instead of text do not reach better masks. Prototypes from ten labelled real images and centre-versus-border prototypes from the unlabelled validation images both trail ours by 0.001 to 0.011 Dice on every test set (Table S9), while ours names the target by text.
4.4. RQ2: Why the Concept Word Fails
Setup. We score the word with and without the softmax over the concept list and generated images on the three test sets, and compare directions among the attention outputs on the validation split.
Queried with the concept word, the attention outputs
do not rank lesion patches above the mean-mask prior on any test set; queried with generated images, they do on all three. The word map at layers 14–17 is below the prior on ISIC-2018 and HAM10000 and level with it on PH2, while our map is above it on all three (Table S12); on ISIC-2018 hair wins more than half of the lesion pixels. On the validation split the word map is below the prior at every layer (Figure 3a). The features are not what fails: among the attention outputs, the direction from generated healthy skin to generated lesions lies close to the real one. From layer 9 on, the generated direction is far closer to the real skin-to-lesion direction than the skin-to-lesion direction, which is no closer than skin-to-hair (Figure 3d; per layer in Supp. G), and generated prototypes rank lesion patches almost as well as labelled real ones (Figure 3a). Part of the word's failure is competition with the other words of the concept list. Scoring lesion against skin alone, without the softmax over the list, raises the word's AUROC on every test set, to about that of generated images on PH2 and HAM10000, but its Dice stays well below theirs on all three (Table S12, Figure 4a). The word direction also moves with the list, while the image tokens, and with them our query, do not attend to the concept tokens (Supp. G).
A better word does not close the gap. None of 23 words comes close to the generated direction in cosine with the real skin-to-lesion direction, and their AUROC does not follow their meaning: melanoma and mole are near chance, and hair ranks lesion patches better than lesion (Figure 3d). The best word, pigmented lesion, edges past the prior but stays below the generated direction, and finding it takes labels. The patches of a real image barely vary along the word direction, and they do along the generated one. Along the lesion direction, the patch outputs of an image vary hardly more than along a random direction, as along hair. Along the generated direction they vary several times more, at three noise levels (Figure 3c). Placed along both

Figure 5. One change at a time on single test images (FLUX, layers 14–17). Columns 2 and 3 differ only in the query, both cut by one Otsu threshold (white). Columns 3 and 4 differ only in the threshold (green: top level of the three-level split; column 4: the gate's choice). Cyan: clinician's outline.
directions in the same units, lesion and skin patches separate along the generated one and overlap along the word (Figure 3b). The part of the word direction that lies where patches do vary is no more lesion-specific than that of hair (Table S12). The concept token's output thus differs from that of skin mostly where real patches do not differ. The generated direction, a difference of image-token outputs, points where real lesions differ from skin. These measurements are correlational and do not show why the model places the word there. The same holds in a second diffusion transformer. In Stable Diffusion 3 medium, with its own generated images and only its layers and noise level chosen on the validation split, the word map reaches 0.25 to 0.45 Dice and ours 0.83 to 0.87, within 0.012 of FLUX (Table S13). The concept word competes with other words and points where real patches barely vary, while generated images point where lesions differ from skin.
4.5. RQ3: Module Contributions
Setup. Figure 4a turns ConceptAttention into GENIQ one module at a time on the test sets; Tables S7 and S10 compare further choices.
Starting from ConceptAttention, each module of GENIQ raises Dice on every test set; the generated-image query raises it most and the refinement second. The gated threshold and the one-direction score each add several Dice points, and setting without labels costs almost nothing (Figure 4a). Within GENIQ, a single Otsu cut in place of the gate (hatched bar) costs Dice mostly on the smallest lesions, whose predicted area the gate brings closer to the true one (Supp. D); with the same inputs, OVDiff's many
prototypes trail our single prototype difference by 0.07 to 0.09 validation Dice, even with healthy skin as background (Table S10).
4.6. RQ4: Sensitivity to the Validation Choices
Setup. Figure 4b–d varies one choice at a time.
After refinement, the choices fixed on the validation split move the masks little. Refinement narrows the range of Dice over prompt sets, generated image sets, noise levels, and layer groups to a few points (Figure 4c–d), and averaging the prompt sets, so that no prompt is chosen with labels, keeps Dice where it is. Ten unlabelled images give most of the gain (Figure 4b), and a pool from HAM10000 instead of ISIC-2018 costs 0.004 to 0.053 test Dice (Table S14); concept lists and captions barely move our AUROC (Supp. G).
4.7. RQ5: Case Study of the Query and the Threshold
Setup. Figure 5 changes one thing at a time on single test images, one phenomenon per row on a typical image among those that show it (Supp. F); the numbers below are medians over each test set. The edge offset is the mean signed distance of a mask's edge from the clinician's, positive outside the lesion; one patch spans 7 pixels at .
Queried with the concept word, the map can mark the skin around the lesion; queried with generated images, it marks the lesion. In the first row hair wins every lesion pixel, so the lesion map is low on the lesion and the Otsu cut takes the skin around it (Figure 5). This is common rather than rare: hair wins more than a fifth of the lesion pixels on 67%, 34%, and 75% of the test images, and under one Otsu cut the edge of the word mask lies 17, 23, and 4 pixels outside the clinician's, against 3, 2, and 0.5 for ours. On small lesions, the gate keeps the top level and removes the ring of spill-over that one Otsu cut keeps. In the second row the Otsu edge runs outside the lesion while the top level follows it. On the smallest third of the lesions the gate keeps the top level on 76% to 96% of the images, and the edge offset falls from 8, 7, and 5 pixels to 3, 3, and 1, under one patch. On large lesions, the gate keeps one Otsu cut, since the top level alone covers only the dark core. In the third row the top level leaves out the lighter rim of the lesion. On the largest third the top level alone would cover 57% to 60% of the lesion and reach Dice 0.72 to 0.75, while the gate keeps it on at most 3% of the images and stays at 0.88 to 0.90. The gate picks the better of its two cuts on 72% to 79% of all images and loses 0.014 to 0.017 Dice against it on average; Supp. F shows a typical miss and what the refinement changes. The query decides where the map lies, and the gate decides per image whether to cut at the lesion's edge or keep the whole lesion.
5. Conclusion
We study skin lesion segmentation when the target is specified only by text, without annotated masks, hand-designed rules, model training, or additional models. A general text-to-image diffusion transformer can define the target without relying on a concept word alone: its generated images give a direction that better captures how real lesions differ from healthy skin. A few unlabelled dermoscopy images then adapt the lesion and healthy-skin prototypes to the target domain. GENIQ achieves Dice scores of 0.85–0.88 on three dermoscopy test sets. It outperforms all evaluated zero-shot methods and word-based read-outs on all three sets, and the hand-designed pipeline on two. It assumes position-invariant contrast (Assumption 2) and requires a few unlabelled target-domain images. Supervised segmenters achieve higher scores (Supp. J).
References
[1] Luca Barsellotti, Roberto Amoroso, Lorenzo Baraldi, and Rita Cucchiara. Fossil: Free open-vocabulary semantic segmentation through synthetic references retrieval. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 1464–1473, 2024. 3
[2] Luca Barsellotti, Roberto Amoroso, Marcella Cornia, Lorenzo Baraldi, and Rita Cucchiara. Training-free open-vocabulary segmentation with offline diffusion-augmented prototype generation, 2024. 2, 3
[3] Rajatsubhra Chakraborty, Xujun Che, Ritabrata Chakraborty, Xi Niu, and Depeng Xu. Maviseg: Manifold propagation and visual prototypes for zero-shot open-vocabulary segmentation in diffusion transformers, 2026. 3
[4] Abderrachid Hamrani and Anuradha Godavarty. Self-attention diffusion models for zero-shot biomedical image segmentation: Unlocking new frontiers in medical imaging, 2025. 2
[5] Alec Helbling, Tuna Han Salih Meral, Ben Hoover, Pinar Yarnardag, and Duen Horng Chau. Conceptattention: Diffusion transformers learn highly interpretable features, 2025. 1, 3, 4
[6] Yankai Jiang, Peng Zhang, Donglin Yang, Yuan Tian, Hai Lin, and Xiaosong Wang. Advancing generalizable tumor segmentation with anomaly-aware open-vocabulary attention maps and frozen foundation diffusion models, 2025. 2
[7] Youngjun Jun, Seil Kang, Woojung Han, and Seong Jae Hwang. Interpretable motion-attentive maps: Spatio-temporally localizing concepts in video diffusion transformers, 2026. 3
[8] Laurynas Karazija, Iro Laina, Andrea Vedaldi, and Christian Rupprecht. Diffusion models for open-vocabulary segmentation, 2024. 2, 3
[9] Chaehyun Kim, Heeseong Shin, Eunbeen Hong, Heeji Yoon, Anurag Arnab, Paul Hongsuck Seo, Sunghwan Hong, and Seungryong Kim. Seg4diff: Unveiling open-vocabulary segmentation in text-to-image diffusion transformers, 2025. 2, 3
[10] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, Piotr Dollár, and Ross Girshick. Segment anything, 2023. 2
[11] Taha Koleilat, Hojat Asgariandehkordi, Hassan Rivaz, and Yiming Xiao. Medclip-samv2: Towards universal text-driven medical image segmentation, 2025. 2
[12] Anna Kukleva, Enis Simsar, Alessio Tonioni, Muhammad Ferjad Naeem, Federico Tombari, Jan Eric Lenssen, and Bernt Schiele. Refam: Attention magnets for zero-shot referral segmentation, 2026. 3
[13] Black Forest Labs. Flux. https://github.com/black-forest-labs/flux, 2024. 1, 2, 4
[14] Black Forest Labs, Stephen Batifol, Andreas Blattmann, Frederic Boesel, Saksham Consul, Cyril Diagne, Tim Dockhorn, Jack English, Zion English, Patrick Esser, Sumith Kulal, Kyle Lacey, Yam Levi, Cheng Li, Dominik Lorenz, Jonas Müller, Dustin Podell, Robin Rombach, Harry Saini, Axel Sauer, and Luke Smith. Flux.1 kontext: Flow matching for in-context image generation and editing in latent space, 2025. 1, 2, 4
[15] Wanli Ma, Jiangwen Lu, Qinmu Peng, and Xinge You. Perceptual anchoring: Prototype-guided text calibration for training-free open-vocabulary semantic segmentation, 2026. 3
[16] Jiawei Mao, Yuhan Wang, Yucheng Tang, Daguang Xu, Kang Wang, Yang Yang, Zongwei Zhou, and Yuyin Zhou. Medsegfactory: Text-guided generation of medical image-mask pairs, 2025. 3
[17] Nobuyuki Otsu. A threshold selection method from gray-level histograms. IEEE Transactions on Systems, Man, and Cybernetics, 9(1):62–66, 1979. 5
[18] Giuliana Ramella. Saliencey-based segmentation of dermoscopic images using color information, 2021. 1, 2
[19] Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning, 2017. 2
[20] Qingchen Tang, Lei Fan, Maurice Pagnucco, and Yang Song. Prototype-based image prompting for weakly supervised histopathological image segmentation, 2025. 2
[21] Raphael Tang, Linqing Liu, Akshat Pandey, Zhiying Jiang, Gefei Yang, Karun Kumar, Pontus Senetorp, Jimmy Lin, and Ferhan Ture. What the daam: Interpreting stable diffusion using cross attention, 2022. 1, 3
[22] Junjiao Tian, Lavisha Aggarwal, Andrea Colaco, Zsolt Kira, and Mar Gonzalez-Franco. Diffuse, attend, and segment: Unsupervised zero-shot segmentation using stable diffusion, 2024. 2
[23] Konstantinos Vilouras, Pedro Sanchez, Alison Q. O'Neil, and Sotirios A. Tsaftaris. Zero-shot medical phrase grounding with off-the-shelf diffusion models, 2025. 2
[24] Jinglong Wang, Xiawei Li, Jing Zhang, Qingyuan Xu, Qin Zhou, Qian Yu, Lu Sheng, and Dong Xu. Diffusion model is secretly a training-free open vocabulary semantic segmenter, 2024. 3
[25] Weijia Wu, Yuzhong Zhao, Mike Zheng Shou, Hong Zhou, and Chunhua Shen. Diffumask: Synthesizing images with pixel-level annotations for semantic segmentation using diffusion models, 2024. 3
[26] Guangjie Zeng, Hao Peng, Angsheng Li, Zhiwei Liu, Chunyang Liu, Philip S. Yu, and Lifang He. Unsupervised skin lesion segmentation via structural entropy minimization on multi-scale superpixel graphs, 2023. 1, 2
[27] Jian Zhang and Zhijun Zhang. Anchordiff: Training-free concept grounding for mm-dits via anchor-based graph propagation, 2026. 2, 3