Dual Granularity Prompting (DGP)
- DGP is a prompting strategy that leverages both coarse textual priors and fine-grained, image-specific semantic tokens to balance global context with local evidence.
- It mitigates challenges like annotation overhead and semantic mismatch by incorporating stable, template-based prompts alongside dynamic tokens generated via visual-to-textual mapping.
- Empirical studies, including token-ablation and cross-domain validations, demonstrate its effectiveness in tasks such as infrared small target detection and fraud detection.
Dual Granularity Prompting (DGP) denotes a prompting strategy that combines two complementary levels of abstraction instead of relying on a single prompt granularity. In the most explicit formulation among the works considered here, DGSPNet for infrared small target detection uses coarse-grained textual priors together with fine-grained personalized semantic descriptions generated from the image itself, so that stable domain context and image-specific semantics are supplied in a single prompt system (Wang et al., 24 Nov 2025). Closely related formulations preserve fine-grained target-node text while compressing neighborhood evidence into coarse summaries for fraud detection, combine global context and local appearance prompts in image restoration, and couple semantic-level abstraction with token-level pruning in chain-of-thought compression (Li et al., 29 Jul 2025, Kong et al., 24 Apr 2025, Fan et al., 28 Jan 2026). Multi-granularity prompting for dialogue topic shift detection extends the same principle to more than two levels—label, topic block, and turn/utterance—showing that the underlying idea is broader than any single architecture (Lin et al., 2023).
1. Conceptual basis and motivation
In DGSPNet, dual granularity is introduced because existing language-guided infrared small target detection methods are hindered by annotation overhead and description discrepancy / semantic mismatch. Prior approaches often need manually written text descriptions or costly VLM-generated captions, while infrared-specific descriptions are difficult to scale and can mischaracterize weak thermal signatures or clutter. The proposed remedy is to combine coarse-grained textual priors—described as easy, stable, and generic semantic context—with fine-grained personalized semantic descriptions that are image-specific and dynamically generated from the image itself (Wang et al., 24 Nov 2025).
A similar motivation appears in graph-enhanced fraud detection, where text-only graph prompting can produce extremely long prompts because multi-hop neighborhoods grow exponentially with hop count and each neighbor may carry dense textual information. There the dual-granularity solution is to keep fine-grained text for the target node while compressing neighbor information into coarse-grained summaries, thereby mitigating information overload and attention dilution (Li et al., 29 Jul 2025).
These formulations indicate a common design pattern. A single prompt granularity is either too generic, too verbose, too expensive to obtain, or too brittle. This suggests that DGP is best understood as a mechanism for balancing a stable global prior against adaptive local evidence, with the precise meaning of “coarse” and “fine” determined by the task.
2. Dual-granularity semantic prompting in infrared small target detection
In DGSPNet, the coarse layer consists of predefined textual priors such as “infrared image,” “small target,” and scene context including “sky,” “ground,” “ocean,” and “suburb.” The paper gives the template example, “A photo of an infrared image, with targets in the sky/ground/ocean background.” These prompts are template-based, annotation-free, and encoded by a frozen text encoder into semantic embeddings
where is the text sequence length and is the text hidden dimension (Wang et al., 24 Nov 2025).
The fine layer consists of learnable semantic tokens generated from the image through visual-to-textual mapping:
These tokens are not manually labeled. Instead, they are learned from visual features and inserted into the text template to form an image-specific description. With , the template is “A photo of an infrared image, with in background.” In the authors’ formulation, the coarse prompt supplies stable semantic structure, while the fine-grained tokens fill in image-specific semantics (Wang et al., 24 Nov 2025).
This prompt construction is central to the method’s claim that language guidance can be used without manual annotation requirements at deployment. The prompt structure is fixed and template-based, but its fine semantic content is produced end-to-end from the input image itself.
3. Visual-to-textual mapping and text-guided feature modulation
The visual-to-textual pathway begins with the first three encoder layers, which produce multi-level features . These are described as low-to-middle-level cues such as edges, textures, local brightness, and spatial detail. They are downsampled and fused by depthwise convolutions and concatenation:
The fused feature is reshaped into sequence form and fed to an inversion net in which a set of learnable tokens serves as the query in multi-head attention. The resulting learned tokens are projected into text space and inserted into the prompt template, yielding image-specific implicit semantic prompts (Wang et al., 24 Nov 2025).
The resulting text embeddings guide the visual pipeline through two attention modules. Text-Guide Channel Attention (TGCA) operates in the re-encoder on high-level features. It combines channel context from image features with text-derived channel descriptors:
0
1
The interpretation given in the summary is channel-wise semantic filtering: channels relevant to target semantics are amplified, irrelevant or noisy channels are suppressed, and residual addition preserves original information.
Text-Guide Spatial Attention (TGSA) operates in the decoder after upsampling and skip fusion. It uses the 2 token 3 to compute a spatial compatibility score in a shared latent space:
4
The refined decoder feature is then
5
This yields a full semantic loop in which low-to-middle-level features generate prompt tokens, high-level features are refined by TGCA, and multi-scale decoder features are spatially refined by TGSA (Wang et al., 24 Nov 2025).
4. Optimization, inference, and empirical behavior
DGSPNet uses a reconstruction pretraining stage to learn the inversion net. In that stage, the original decoder is replaced with a reconstruction decoder, the model reconstructs the input infrared image, and the inversion net is optimized with a contrastive objective:
6
After pretraining, inversion net weights are frozen and the full network is trained for segmentation with
7
During inference, the model uses the text prompts internally, requires no manual annotation, and runs the same dual-granularity mechanism end-to-end (Wang et al., 24 Nov 2025).
The reported benchmark results are: IRSTD-1K with IoU 70.87, 8 93.26, and 9 14.23; NUDT-SIRST with IoU 96.13, 0 99.15, and 1 0.32; and NUAA-SIRST with IoU 80.32, 2 97.33, and 3 9.26. The method is described as achieving state-of-the-art performance on three benchmark datasets. Ablation on prompt-driven modules shows that TGCA alone improves performance, TGSA and cross-attention help, and the full combination of TGCA + Cross-Attention + TGSA is best. On IRSTD-1K, IoU rises from 65.31 in the baseline to 70.87 in the full model.
The token-ablation study is especially diagnostic for DGP itself. On IRSTD-1K, 0 tokens gives IoU 66.41, 1 token gives 69.29, and 2 tokens gives 70.87, while 3 or 4 tokens reduce stability or performance. The best prompt form is “A photo of an infrared image, with 4 in 5 background.” The authors interpret this as evidence that one token is better than none, two tokens best capture the target/background relation, and too many tokens introduce semantic ambiguity (Wang et al., 24 Nov 2025).
5. Cross-domain variants and related formulations
The dual-granularity idea has appeared in multiple technically distinct settings:
| Setting | Granularity design | Representative formulation |
|---|---|---|
| Infrared small target detection (Wang et al., 24 Nov 2025) | Coarse-grained textual priors + fine-grained personalized semantic descriptions | Template-based prompts, inversion net, TGCA, TGSA |
| Fraud detection with graph-enhanced LLMs (Li et al., 29 Jul 2025) | Fine-grained target-node text + coarse-grained neighbor summaries | Node-level summarization, metapath summarization, numerical mean aggregation |
| Image restoration with diffusion transformers (Kong et al., 24 Apr 2025) | Global context prompts + local appearance prompts, fused with text prompts | Dual prompting control branch with CLIP image encoders and T5 |
| Dialogue topic shift detection (Lin et al., 2023) | Label + topic block + turn/utterance | Multi-granularity prompt-based framework with shared T5 decoder |
| Chain-of-thought compression (Fan et al., 28 Jan 2026) | Semantic-level compression + token-level pruning | HRA, LPD, DAG in a budget-conditioned reasoning pipeline |
The cross-domain record shows that “granularity” is not tied to a single modality. In fraud detection, it distinguishes target-node detail from neighborhood summaries; in image restoration, it distinguishes global context from local appearance; in dialogue, it distinguishes label semantics from topic-block and turn semantics; and in reasoning compression, it distinguishes semantic abstraction from token-level pruning. This suggests that DGP is a transferable design principle for organizing complementary evidence rather than a fixed prompt template.
At the same time, the domains differ in what is preserved and what is compressed. Fraud detection explicitly argues for task-agnostic textual summarization and statistical aggregation of numerical features, while CtrlCoT argues that generic token pruning is insufficient unless it preserves numbers, operators, and connective logic. The commonality is not the content of the prompt, but the decision to separate semantically different scales and optimize them jointly.
6. Scope, misconceptions, and acronym ambiguity
A common misconception is that DGP is merely “using text” in a downstream model. The infrared formulation explicitly states that it is not just “using text” in a generic sense, but a prompt system in which coarse prompts provide stable, annotation-free domain priors, fine-grained tokens are learned from the image itself via visual-to-text inversion, and text guidance is applied twice: for channel selection through TGCA and for spatial localization through TGSA (Wang et al., 24 Nov 2025).
Another misconception is that DGP must be textual in a narrow sense. In image restoration, the dual prompting module supplies global context prompts and local appearance prompts as extra conditional control, alongside textual prompts; in CtrlCoT, the two granularities are semantic abstraction and token-level pruning, not scene descriptions or captions (Kong et al., 24 Apr 2025, Fan et al., 28 Jan 2026). This suggests that the defining feature of DGP is complementary granularity, not a particular token source.
The acronym itself is also overloaded in arXiv usage. In gravitational theory, “DGP” refers to Dvali–Gabadadze–Porrati gravity rather than prompt design, as in work on cascading DGP and on adding a second DGP brane (Rug, 2012, Warkentin, 2019). In machine learning contexts, therefore, “Dual Granularity Prompting” is best identified from the surrounding task domain and formulation rather than from the acronym alone.