Abstract
Flat label supervision often constrains multi-label image classification, as it struggles to fully capture inherent label dependencies. It provides limited guidance to the hierarchical features that naturally emerge in Vision Transformers. To address this structural misalignment, we propose Dynamic Topic-based Hierarchical Prompt Learning (DyT-HPL). Instead of relying on predefined and fixed label graphs, DyT-HPL utilizes offline hierarchical clustering to construct multi-granularity semantic priors, from which hierarchical prompts are dynamically retrieved. A frozen visual query branch generates stable semantic queries, which are then used to retrieve discrete prompts from constructed coarse-mid-fine prompt pools. These hierarchical prompts are adaptively injected into different network depths, ensuring that semantic guidance with different abstraction levels is introduced at the most suitable architectural stages. To maintain stable routing and prevent prompt mode collapse, we jointly optimize the architecture with asymmetric classification, surrogate matching, and intra-pool diversity losses. This tripartite design promotes a diverse prompt space and isolates routing updates from final predictions. Comprehensive experiments on MS-COCO, NUS-WIDE, and Corel5k demonstrate that DyT-HPL achieves consistent and favorable performance across diverse settings, highlighting the value of hierarchical semantic guidance with different abstraction levels.
1. Introduction
Multi-label image classification (MLC) is a basic task in computer vision. One image may contain several semantic concepts at the same time [1]. Unlike single-label recognition, MLC must capture not only object appearance but also co-occurrence patterns and semantic relations among labels. This setting appears in image retrieval, scene understanding, and large-scale content management [2]. In most datasets, supervision is given as a flat multi-hot label vector. Such supervision offers only limited guidance for the hierarchical features learned by deep models.
Early studies modeled label correlations with convolutional backbones plus recurrent modules [3] or graph reasoning [4]. Vision Transformers [5] improved the modeling of global feature interactions [6]. Even so, many recent prompt-based methods [7,8] still treat labels as mostly independent. The hierarchical structure hidden in large label sets remains underused. When flat label semantics are matched to multi-level visual features through one path, inconsistencies can appear, especially across network depths.
Our method follows the hierarchy already present in the model. Recent studies on Vision Transformer dynamics suggest that representations from different depths exhibit different levels of semantic abstraction, rather than forming a strict shallow-local versus deep-global dichotomy [9,10,11]. Based on this property, we build a framework with a trainable Vision Transformer and an auxiliary frozen query branch. The frozen branch provides a stable reference and reduces gradient interference. We do not use predefined label graphs. Instead, we extract hierarchical semantic priors from the label space through offline clustering [12]. These priors guide prompt retrieval from separate pools [13,14]. The retrieved prompts are injected into different stages of the backbone. Accordingly, we introduce semantic guidance with different abstraction levels at different architectural stages, using broader semantic cues for global context establishment and less abstract intermediate semantic cues for later refinement. This improves the match between semantic guidance and visual features.
This work makes three main contributions:
- We propose DyT-HPL, a dual-branch framework that combines a frozen query branch with offline clustering priors and ViT hierarchies. It improves classification performance with little trainable-parameter overhead.
- We design a transient prompt injection strategy. Layer-specific prompts are injected only when needed and removed right after interaction. This keeps multi-scale semantic alignment efficient and avoids unnecessary sequence growth.
- We formulate a tripartite optimization objective integrating asymmetric classification, surrogate matching, and intra-pool diversity constraints. This joint formulation stabilizes dynamic routing by explicitly mitigating prompt mode collapse and completely decoupling routing updates from the prediction pathway.
2. Related Work
2.1. Multi-Label Image Classification
Modeling label dependency has long been a central idea in multi-label image classification. Many early methods combined convolutional backbones with graph modules or recurrent structures to model label correlations [1,3,4]. Recent methods use more refined feature extraction schemes. GKGNet [15], for instance, models local-to-global relations through neighbor grouping. SADCL [16] uses contrastive learning to separate highly overlapping categories. Even with these advances, static or hand-crafted label topologies remain a weakness. Correlations learned during training are often detached from the hierarchy of visual features. This mismatch makes fine-grained semantic alignment harder.
2.2. Transformer-Based Multi-Label Learning
Vision Transformers have become a strong choice for MLC because self-attention models global context well [2,5,6]. Representative examples include ML-Decoder [17], which improves the fusion of label embeddings through token refinement and cross-attention. Yet the semantic structure of multi-label data remains difficult to capture. A common reason is that many current methods still rely on flat representations. Once complex label semantics are compressed into one representation space or one cue, the natural coarse-to-fine hierarchy is blurred. A more suitable design should provide hierarchical guidance and let it interact with the Transformer at different depths.
2.3. Prompt Learning and Semantic Guidance
Visual Prompt Tuning (VPT) [14] shows that a frozen backbone can adapt to a new domain with only a small number of trainable parameters. Later methods such as GateVPT [18] and E2VPT [19] further improve prompt routing for complex visual inputs. At the same time, many studies show that external priors or prototypes can also help representation learning [20,21].
Bringing these ideas together is still not easy. Many prompt-based classifiers use static prompts or confine prompts to isolated feature spaces. Once discrete dynamic routing is introduced, mode collapse often appears and the model keeps selecting the same small group of prompts [22,23]. Hand-crafted label graphs add another limitation. They usually miss the natural multi-granularity structure inside complex datasets.
Related ideas have also appeared in other vision tasks, where complementary modules are used to exploit structured priors beyond a single supervision pathway. For example, Dong et al. [24] combine temporal distribution learning and spatial correlation refinement for universal moving object segmentation. Although their task setting and technical design differ substantially from ours, their results further support the value of incorporating structured priors through complementary branches. DyT-HPL addresses these issues by replacing fixed label graphs with offline hierarchical clustering [12]. The resulting semantic priors initialize hierarchical prompt pools.
2.4. Representation Dynamics in Vision Transformers
Recent studies suggest that Vision Transformer representations at different depths differ mainly in semantic abstraction, rather than following a strict shallow-local versus deep-global dichotomy [10,11,25].
DyT-HPL is built around this depth-wise change. We do not impose a single flat semantic structure across all layers. Instead, we derive semantic queries from selected intermediate and deep layers. All queries are extracted from CLS tokens and therefore remain globally contextualized semantic representations, while differing in abstraction level and functional role. The final-layer query is used to retrieve broad semantic guidance, whereas the intermediate-layer queries provide complementary and later-stage semantic refinement. As a result, our dynamic prompt injection stays closer to the network’s feature hierarchy and reduces the mismatch caused by flat label mapping.
Furthermore, this dynamic hierarchical strategy aligns with the recent paradigm shift towards Vision-Language Models and adaptive visual prompt tuning for multi-label recognition [26,27]. While these contemporary approaches have demonstrated the efficacy of prompt-based semantic alignment, DyT-HPL uniquely extends this success by mitigating prompt mode collapse through depth-aware hierarchical routing, distinguishing it from recent adaptive prompting methods [28].
3. Methods
3.1. Problem Formulation
Given an input image and a label space with C categories, multi-label image classification aims to predict a binary target vector . Each element indicates whether the corresponding category is present in the image. Let the model output be logits . The task is to learn a mapping from the image to these logits:
The logits were converted into multi-label decisions and optimized with a multi-label classification loss. In DyT-HPL, this mapping was further improved by hierarchical prompt retrieval and injection-guided by stable semantic queries.
3.2. Overall Architecture
Before online feature propagation starts, DyT-HPL performs offline hierarchical label clustering directly on the dataset label space. We do not rely on external text encoders. Instead, we use label distributions and label co-occurrence statistics from the training set to build the hierarchy. This turns flat labels into a structured topic tree with coarse, mid, and fine levels.
These topic centers define the structure of the prompt pools and reflect natural semantic groupings. They also change the way the model is trained. The Vision Transformer is no longer asked to learn from isolated visual features alone. Statistical priors provide an extra semantic signal, which helps relieve label sparsity and semantic interference.
DyT-HPL has two coupled branches: a frozen query branch and a trainable main Vision Transformer. The frozen branch outputs three query vectors, , , and , from different semantic depths. These queries match against three prompt pools and retrieve targeted prompts. The retrieved prompts were injected into the shallow, middle, and deep stages of the main ViT. The final features were sent to the classifier head for prediction.
The complete data flow is summarized as follows: image → frozen query ViT → → prompt pools → main ViT → classifier head → losses.
3.3. Offline Hierarchical Clustering and Prior Initialization
To provide semantic guidance at different granularities, DyT-HPL initializes its prompt space with offline hierarchical clustering based on label co-occurrence. This avoids random prompt initialization and unstructured external vectors. The model starts from a more meaningful semantic prior, and online inference does not incur extra cost from this step.
We computed the label co-occurrence matrix from the training annotations, where C is the number of categories. Each entry denotes the conditional probability that category j appears when category i is present. We converted this co-occurrence similarity into a distance metric so that standard clustering algorithms can be applied:
This symmetric matrix gives smaller distances to category pairs that often appear together.
We applied Agglomerative Hierarchical Clustering with average linkage to build a semantic taxonomy tree. Distance thresholds at different heights of the dendrogram split the categories into Fine, Middle, and Coarse topics. The leaves correspond to specific classes. These classes merge into mid-level topics and later into coarse macro-topics. As shown in the top-left of Figure 1, these topic clusters were used to initialize the keys of the prompt pools.
Figure 1.
The overall architecture of the proposed DyT-HPL framework: (Top) Offline initialization: a label co-occurrence matrix is used for hierarchical clustering to initialize the prompt space, with an intra-pool diversity loss () applied to encourage diverse prompt keys. In parallel, a frozen ViT branch extracts multi-granularity semantic queries (, , ), which are supervised by a matching loss (). (Bottom) Online inference and interaction: the retrieved prompts are injected into the trainable main Vision Transformer. The final-layer query provides broad semantic guidance at early stages, while intermediate-layer queries provide more detailed semantic guidance at later stages. Within each injection stage, visual tokens and prompts are concatenated (Ⓒ) for interaction, after which the prompt tokens are removed (Ⓢ) to limit computational overhead. The entire network is optimized by , including the final asymmetric loss ().
Based on this initialization, we used a progressive capacity and retrieval strategy. The shallow pool has a smaller capacity and uses top-1 retrieval for broad guidance. The middle and deep pools use larger capacities and top-k () retrieval to capture finer semantics. This coarse-to-fine setup follows the feature hierarchy of the backbone.
3.4. Frozen Query Branch
We used a frozen query branch to keep semantic queries separate from downstream gradient updates. This branch is an ImageNet-pretrained ViT [5] with all parameters fixed. It extracts query features from different depths:
where denotes the auxiliary branch. Following the feature dynamics discussed in Section 2, we sampled queries from specific stages. The intermediate queries ( and ) were taken from the CLS tokens of Layers 4 and 9, respectively. Here, the terms “mid” and “fine” refer to their functional roles at different stages of prompt injection in the main network, rather than their absolute extraction depths: the Layer-4 query provides complementary semantic cues at an intermediate stage, while the Layer-9 query was used at a later stage for more refined semantic guidance. The coarse query () was taken from the final normalized class token at Layer 12, which provides the most abstract and globally contextualized representation. Because this branch stays frozen during training, prompt retrieval was performed in a stable reference space. Notably, and were extracted from intermediate CLS tokens, rather than from raw shallow patch features. Consequently, they represent less abstract yet still globally contextualized semantic queries relative to the final-layer CLS representation, rather than purely local low-level details.
3.5. Dynamic Prompt Retrieval and Hierarchical Injection
To retrieve relevant semantic prompts, we computed the cosine similarity between a query vector and the learnable keys in a prompt pool. Let be the prompt-key matrix, where M is the pool size and d is the embedding dimension. We apply L2 normalization to both inputs and obtain similarity scores:
where and are the normalized tensors. From these scores, we selected the top-k matches and form the index set :
The corresponding prompt values were concatenated along the sequence dimension to form the retrieved prompt block:
where denotes the i-th prompt value token and defines the total length of the newly formed sequence.
The discrete TopK operation creates a training problem because it blocks gradient flow to the prompt keys. We addressed this by separating the optimization paths. The retrieved prompt values interact with visual tokens in self-attention and receive gradients from the main classification loss. The prompt keys K were updated through an independent surrogate matching loss (, detailed in Section 3.6). This gives the keys a stable and differentiable update path.
We injected the retrieved tokens directly into the main Vision Transformer. Let be the visual tokens entering the l-th block, where N includes the image patches and the class token. We concatenate prompts and visual tokens to form an augmented input:
where denotes concatenation.
We use different positional treatments for the two token types. Visual tokens keep their spatial embeddings so that image topology is preserved. Retrieved prompts do not use positional encoding. They represent unordered semantic concepts rather than physical locations, so permutation invariance is more suitable.
The combined sequence is fed into a standard Transformer block, where multi-head self-attention lets visual features absorb the injected semantic priors:
Keeping these extra tokens through the whole network would lengthen the sequence and may introduce semantic cross-talk. We use a transient injection strategy. Once the attention step ends, the prompts are removed, and only the enriched visual tokens are passed to deeper layers:
As shown in Figure 1 (bottom), this “use-and-discard” design keeps computation efficient and avoids unnecessary disturbance to the visual stream.
The injection locations are also chosen deliberately. This forms our cross-depth injection strategy. The coarse pool, retrieved by the final-layer query, is injected into the shallow block () to provide an early semantic bias. The intermediate and fine pools are injected into the middle () and deep () blocks to provide stage-specific semantic guidance and later-stage refinement, respectively.
This modular design also makes ablation analysis easier. By turning specific pools on or off, such as shallow-only injection versus the full hierarchy, we can directly observe how injection depth affects final performance.
3.6. Objective Function
The total objective of DyT-HPL has three parts: a multi-label classification loss, a surrogate matching loss for routing, and an intra-pool diversity term:
where and balance semantic guidance and prompt-pool regularization during training.
Multi-Label Classification Loss (). Multi-label datasets usually contain many more negative than positive samples. Recent work has explored dynamic logit adjustment and re-weighting strategies for long-tailed multi-label learning [29]. In our model, we handled this imbalance with Asymmetric Loss (ASL) [30] (additional formulations are provided in Appendix B). Let be the multi-hot ground truth and the predicted probabilities obtained from a Sigmoid over logits . The classification term is
where the positive and negative parts are weighted by asymmetric focusing parameters and :
The threshold margin in filters out easy negative samples. This reduces their gradients and lets the model focus more on rare positives and hard negatives.
Surrogate Matching Loss (). Prompt retrieval also needs explicit supervision. We used a continuous surrogate matching loss to align each query with its selected keys. Let the prompt-key matrix be . For a visual-semantic query , we penalized the spherical distance between q and its top-k retrieved keys, indexed by :
Since discrete routing is non-differentiable, this loss serves as a proxy objective. Because the query branch is frozen, updates only the selected keys, encouraging them to align with the stable query space induced by the target data. This design improves routing stability and reduces gradient interference, although it may limit task-specific adaptation when the pretrained query space is not fully aligned with the target domain.
Intra-Pool Diversity Loss (). Without regularization, dynamic routing often overuses a small subset of prompts, which leads to mode collapse [23,31]. We addressed this with an intra-pool diversity penalty. For a pool of size M, we computed the mean squared cosine similarity over all unique non-diagonal key pairs:
Driving this similarity toward zero pushes the keys apart in latent space. This keeps the prompt library diverse instead of letting it collapse into redundant topics.
Although has an complexity, its practical overhead is negligible in our setting because the prompt pools remain small and the computation is fully vectorized on GPU. Even for the largest pool, the number of pairwise similarities is far smaller than the pairwise interactions in a single standard ViT self-attention map. If larger pools are considered in future extensions, the cost can be reduced by sampling a subset of keys during training.
4. Experiments and Results
4.1. Experimental Setup
Datasets. We evaluate DyT-HPL on three widely used multi-label image classification benchmarks: MS-COCO [32], NUS-WIDE [33], and Corel5k [34] (summarized in Table 1).
- MS-COCO [32]: We use the standard split with 80 semantic categories. The dataset contains 122,218 images in total, including 82,081 for training and 40,137 for testing.
- NUS-WIDE [33]: This dataset contains real-world web noise and diverse annotations. We use its 81 visual concepts, with 161,789 images for training and 107,859 for testing.
- Corel5k [34]: This dataset is small and highly sparse in labels, so it is useful for testing recall on rare concepts. It contains 4999 images and 260 fine-grained categories. We follow the official split and use 4500 images for training and 499 for testing.
Table 1.
Dataset statistics and evaluation splits used in our experiments.
Evaluation Metrics. We use mean Average Precision (mAP) [1] as the main evaluation metric. We also report overall precision (OP), recall (OR), and F1-score (OF1), together with their class-wise versions (CP, CR, CF1) [35]. All metrics follow standard definitions. Detailed formulas are given in the Appendix A.
Implementation Details. DyT-HPL uses a ViT-Base backbone [5] initialized with ImageNet weights. The patch size is 16 and the embedding dimension is 768. The frozen query branch has the same architecture. We use three prompt pools for the shallow, middle, and deep stages, with sizes of 5, 10, and 20. The prompt length is 5, and the top-k values are . For Corel5k, we use the standard train/test split. OR and OF1 are computed with a fixed threshold of 0.5, and mAP is averaged over valid classes. Baseline results are taken from the original publications unless otherwise specified.
Following standard ViT training recipes [36], all images are resized to and augmented with RandAugment and Cutout. We train the model for 50 epochs using AdamW, with weight decay set to 0.05 and a One-Cycle learning rate schedule that peaks at . Batch sizes are 64 for MS-COCO, 128 for NUS-WIDE, and 32 for Corel5k. We also use an Exponential Moving Average (EMA) with decay of 0.9997 to stabilize training. The final objective includes the asymmetric classification loss [30], the surrogate matching loss (), and the diversity term ().
4.2. Comparison Methods
We compare DyT-HPL with three groups of baselines: conventional deep models based on CNNs plus recurrent or graph modules, standard Transformer-based methods, and recent prompt-tuning or semantic-guided approaches.
4.3. Main Results and Comparisons
We now compare DyT-HPL with representative methods on MS-COCO, NUS-WIDE, and Corel5k.
Performance on MS-COCO. DyT-HPL reaches 83.5% mAP at resolution (Table 2). This is 3.1% higher than Query2Label [6] and 2.4% higher than ML-Decoder [17]. Compared with recent prompt-tuning methods such as E2VPT [19], our model shows a better precision–recall balance. E2VPT has higher recall (75.7% CR), but DyT-HPL gives higher precision (81.8% CP) and achieves the best CF1 (76.4%) and OF1 (78.5%). These results suggest that hierarchical prompt injection helps model complex semantic dependencies.
Table 2.
Performance comparison with representative methods on the MS-COCO dataset. All models are evaluated at a unified input resolution. The best results in each column are in bold, and the second best are underlined.
Performance on NUS-WIDE. NUS-WIDE contains noisy web images, so semantic discrimination is more difficult. DyT-HPL achieves 66.3% mAP (Table 3). This is 4.9% higher than MS-CMA [41] and 1.3% higher than Q2L-R101 [6]. It also matches the best mAP reported by Q2L-TResL [6], while giving a slightly higher CF1-score (64.3% vs. 64.0%). These results suggest that the proposed framework remains competitive under label noise, with slight improvements in CF1 and OF1.
Table 3.
Comparison of our method with representative models on the NUS-WIDE dataset. All results are reported at the input resolution of . The best results are in bold, and the second best are underlined.
Performance on Corel5k. Corel5k has sparse annotations and fine-grained labels, so recall is especially hard to improve. DyT-HPL achieves the best overall results among the compared methods, reaching 80.2% Overall Recall (OR) and 58.8% OF1 (Table 4). Given the backbone differences among methods, especially versus earlier CNN- or kernel-based models, part of this large margin may also benefit from ViT pretraining. Therefore, these results mainly support the effectiveness of the overall framework in sparse-label settings.
Table 4.
Comparison of our method with representative models in terms of OR, OP, and OF1 on the Corel5k dataset. All results are reported at the input resolution of .
4.4. Ablation Studies
To examine the main components of DyT-HPL, we conduct targeted ablation studies on the benchmark datasets:
- Hierarchical Injection (MS-COCO): We compare the standard ViT (Baseline) with three prompt settings: Single-Shallow, Single-Deep, and the Full coarse-to-fine hierarchy, to isolate the role of multi-scale alignment.
- Generalization (NUS-WIDE & Corel5k): We compare the Baseline and the Full model to test whether the gains remain consistent under different data distributions.
- Effect of Model Components (Corel5k): We further ablate the two auxiliary losses and the frozen query branch to verify the contribution of each core design component.
- Sensitivity to Hierarchical Granularity (Corel5k): We vary the coarse/mid/fine prompt-pool sizes around the default setting to examine the robustness of DyT-HPL to moderate changes in the offline hierarchical structure.
- Statistical Significance (Corel5k): We employed both the parametric paired t-test and the non-parametric Wilcoxon signed-rank test [48,49] to rigorously evaluate whether our performance improvements are statistically significant.
Hierarchical Injection Strategies. On MS-COCO, using prompts only in shallow blocks or only in deep blocks gives limited gains (Table 5). In contrast, the full cross-depth hierarchy performs best and achieves the lowest Hamming loss and One-error. This suggests that distributing semantic guidance across multiple stages is more effective than relying on a single fixed injection level, although the current strategy remains manually specified rather than dynamically learned.
Table 5.
Ablation study on prompt injection strategies evaluated on the MS-COCO dataset. The downward arrow (↓) indicates that a smaller value corresponds to better performance.
Generalization Across Datasets. We also compare the ViT baseline and the full model on NUS-WIDE and Corel5k. Table 6 shows that DyT-HPL improves over the baseline on both datasets. The larger gain on Corel5k suggests that offline hierarchical clustering is especially useful when labels are sparse.
Table 6.
Performance generalization: Baseline vs. Full DyT-HPL across NUS-WIDE and Corel5k datasets.
Effect of Model Components. We further ablate the core components of DyT-HPL on Corel5k. As shown in Table 7, removing either or reduces performance, and removing both causes a larger drop, indicating that the two losses are complementary. Replacing the frozen query branch with a trainable one further reduces the mAP from 63.72% to 63.07% and the OF1 from 58.80% to 55.60%, confirming the benefit of a stable frozen query space.
Table 7.
Ablation study on the core components of DyT-HPL on the Corel5k dataset.
Sensitivity to Hierarchical Granularity. We vary the coarse/mid/fine prompt-pool sizes around the default setting on Corel5k to assess the sensitivity of DyT-HPL to the offline hierarchical structure. As shown in Table 8, the model remains stable near the default configuration, while overly small or large pool allocations lead to moderate degradation. This suggests that DyT-HPL is not tied to a single fragile clustering choice, but still benefits from a reasonable hierarchical granularity.
Table 8.
Sensitivity analysis of hierarchical prompt-pool granularity on the Corel5k dataset.
Statistical Significance. On Corel5k, we further test the performance gain over the baseline with the Paired t-test [48] () and the Wilcoxon Signed-Rank Test [49] (). Both results satisfy , which indicates that the improvement is statistically significant.
4.5. Qualitative Analysis and Visualization
Figure 2 puts DyT-HPL’s multi-granularity alignment to a direct visual test. Using the deeply hierarchical Corel5k dataset [34] as our testbed, we unpack three representative prediction scenarios.
Figure 2.
Qualitative results of DyT-HPL on the Corel5k dataset. GT indicates the ground-truth labels, and Pred indicates the predicted labels. (a,b) illustrate successful cases of multi-granularity semantic prediction, while (c) shows a failure case of “semantic over-extension”, where the model predicts additional scene-related concepts.
When faced with wide semantic divides (Figure 2a), the framework seamlessly bridges the gap. It locks onto the sweeping background concept (sky) while simultaneously pinpointing hyper-specific foreground objects (jet, plane).
Figure 2b pushes this further by testing associative taxonomy. Corel5k is notorious for burying labels within complex hierarchical contexts. In this image, the raw pixels simply show a tiger in tall grass. Yet, the ground truth demands both the biological hypernym (cat) and the broader habitat (forest). DyT-HPL nails every single label. Rather than just skimming surface-level appearance cues, the model actively penetrates the underlying semantic taxonomy and contextual co-occurrences.
For completeness, we also present a typical failure case in Figure 2c. While the model correctly retrieves the ground-truth labels, it also outputs several false-positive concepts (e.g., boats, beach, sunset). This phenomenon, which we refer to as “semantic over-extension,” may occur because the prompt learning mechanism captures scene-level semantic correlations that are not fully constrained by the visual evidence in the image. Introducing stronger spatial attention constraints may help reduce this effect in future work.
4.6. Efficiency Analysis
In this subsection, we analyze the computational overhead and parameter efficiency of the proposed DyT-HPL framework. Table 9 reports the total, trainable, and frozen parameter counts, FLOPs, and inference latency under the same input resolution. Compared with the vanilla ViT baseline, DyT-HPL increases the total parameters from 86.00 M to 171.96 M, the FLOPs from 16.85 G to 33.92 G, and the latency from 3.19 to 6.52 ms/image, while adding only 0.16 M trainable parameters. This shows that the prompt pools are lightweight and that the main overhead comes from the auxiliary frozen query branch.
Table 9.
Efficiency comparison between DyT-HPL and the ViT baseline under resolution.
5. Discussion
DyT-HPL relies on three closely related components. The frozen query branch gives a stable reference space and separates prompt retrieval from continuous backbone updates. The clustered prompt pools provide semantic guidance step by step. Different Transformer depths receive different levels of semantic cues. A diversity penalty keeps the prompt keys apart and prevents redundant patterns from dominating the pool.
The experiments suggest that this design is useful for complex semantic scenes. Visual understanding often requires both global context and local detail. Multi-stage guidance helps connect these two levels. This is especially important on datasets such as Corel5k [34], where labels are sparse and entangled. In such cases, DyT-HPL uses statistical priors to strengthen the Vision Transformer and partly compensate for the limits of standard self-attention.
Limitations: The framework still depends on good initialization. Since the prompt hierarchy is built from offline label co-occurrence clustering and kept fixed during training, noisy or misaligned semantic groups may weaken downstream guidance. The gain also depends on the dataset scale and label density. In addition, the current prompt injection points are fixed at shallow, middle, and deep blocks, which may not be optimal for all inputs or architectures. Future work will explore more adaptive hierarchy construction and learnable prompt injection mechanisms.
6. Conclusions
This paper presents DyT-HPL for multi-label image classification. The framework combines offline hierarchical clustering [12], a frozen query branch, and dynamic prompt retrieval. Under flat label supervision, it improves visual-semantic alignment at multiple granularities. Coarse-to-fine prompts are injected into different depths of the Vision Transformer [5], so the model can use broad semantic cues and still refine local details.
The optimization objective combines asymmetric classification loss [30], surrogate matching loss, and intra-pool diversity loss.
Experiments on MS-COCO [32], NUS-WIDE [33], and Corel5k [34] support this design. DyT-HPL achieves competitive performance while adding only a small number of trainable parameters; the additional inference cost mainly comes from the frozen query branch. The ablation results and statistical tests also clarify the role of each core component.
Future work will examine stronger semantic initialization, dynamic prompt length scaling, and more adaptive injection strategies. These directions may further improve representation learning for large-scale multi-label visual tasks.
Author Contributions
Conceptualization, Y.P.; methodology, Z.C. and Y.P.; software, Z.C. and Y.Z.; validation, M.L.; formal analysis, Z.C., Y.Z. and M.L.; investigation, Z.C., Y.Z. and Y.P.; data curation, Y.Z. and M.L.; writing—original draft preparation, Z.C.; writing—review and editing, Y.Z., M.L. and Y.P.; visualization, Z.C.; supervision, Y.P. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by the Practice Innovation Program of Jiangsu Province under Grant SJCX25_0563.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The public datasets analyzed in this study are openly available. MS-COCO can be accessed at https://cocodataset.org/ (accessed on 1 May 2026). NUS-WIDE is available upon request from the National University of Singapore at https://lms.comp.nus.edu.sg/research/nus-wide/ (official link). Due to the potential instability of the official server, a stable mirror has been provided by the authors at https://drive.google.com/file/d/15QNdaD3-WZZuekzX_3k7fzMvCePfa8wW/view?usp=drive_link (accessed on 1 May 2026). The Corel5k dataset is accessible through the MULAN multi-label learning repository at http://mulan.sourceforge.net/datasets-mlc.html (accessed on 1 May 2026). The implementation details and code supporting this work will be made available by the authors upon reasonable request.
Acknowledgments
The authors would like to thank the anonymous reviewers for their constructive comments. We also acknowledge the use of the AutoDL platform (https://www.autodl.com) for providing the computational resources necessary for this research.
Conflicts of Interest
The authors declare no conflicts of interest.
Abbreviations
The following abbreviations are used in this manuscript:
| MLC | Multi-Label image Classification |
| ViT | Vision Transformer |
| ASL | Asymmetric Loss |
| EMA | Exponential Moving Average |
| DyT-HPL | Dynamic Topic Vision Transformer with Hierarchical Prompt Learning |
| mAP | mean Average Precision |
| OP | Overall Precision |
| OR | Overall Recall |
| OF1 | Overall F1-score |
| CP | Class-wise Precision (Macro-Precision) |
| CR | Class-wise Recall (Macro-Recall) |
| CF1 | Class-wise F1-score (Macro-F1) |
Appendix A. Mathematical Formulations of Evaluation Metrics
To rigorously evaluate multi-label image classification performance, we employ mean Average Precision (mAP) along with overall and class-wise precision, recall, and F1-scores [35]. Let C denote the total number of categories. For each category , we define , , and as the numbers of True Positives, False Positives, and False Negatives, respectively.
Appendix A.1. Class-Wise Metrics (Macro-Averaging)
The class-wise metrics evaluate the performance of each category independently and compute the unweighted mean across all categories. They are defined as follows:
where and are the precision and recall for the c-th category, respectively.
Appendix A.2. Overall Metrics (Micro-Averaging)
The overall metrics aggregate the contributions of all classes to compute average metrics, which is particularly useful for evaluating performance on datasets with class imbalance:
Appendix A.3. Mean Average Precision (mAP)
The Average Precision (AP) for a specific class c summarizes the shape of the precision–recall curve and is defined as the integral of precision over all recall levels r:
In practice, this is computed as the weighted sum of precisions at each threshold, with the weight being the increase in recall from the previous threshold. The mean Average Precision (mAP) is the mean of the AP scores across all C categories:
Appendix B. Formulation of Asymmetric Loss
To address the inherent positive–negative imbalance in multi-label datasets, we employ Asymmetric Loss (ASL) [30] as the primary classification objective . ASL modifies standard binary cross-entropy by applying asymmetric focusing and probability shifting. For a single label, the loss is defined as:
where is the ground-truth label. The positive and negative loss components, and , are formulated as:
Here, p is the predicted probability. To specifically suppress the contribution of easy negative samples, ASL introduces a probability shift , where is a hard threshold parameter. The parameters and are the asymmetric focusing exponents that further balance the contribution of hard and easy samples. In our implementation, we follow the default settings of , , and .
References
- Li, X.; Liu, J.; Wang, X.; Chen, S. A survey on incomplete multi-label learning: Recent advances and future trends. arXiv 2024, arXiv:2406.06119. [Google Scholar]
- Lanchantin, J.; Wang, T.; Ordonez, V.; Qi, Y. General multi-label image classification with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Virtual, 19–25 June 2021; pp. 16478–16488. [Google Scholar]
- Wang, J.; Yang, Y.; Mao, J.; Huang, Z.; Huang, C.; Xu, W. CNN-RNN: A unified framework for multi-label image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 2285–2294. [Google Scholar]
- Ye, J.; He, J.; Peng, X.; Wu, W.; Qiao, Y. Attention-driven dynamic graph convolutional network for multi-label image recognition. In Proceedings of the European Conference on Computer Vision, Glasgow, UK, 23–28 August 2020; Springer: Cham, Switzerland, 2020; pp. 649–665. [Google Scholar]
- Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Liu, S.; Zhang, L.; Yang, X.; Su, H.; Zhu, J. Query2label: A simple transformer way to multi-label classification. arXiv 2021, arXiv:2107.10834. [Google Scholar]
- Park, S.; Byun, H. Fair-vpt: Fair visual prompt tuning for image classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 17–21 June 2024; pp. 12268–12278. [Google Scholar]
- Le, M.; Nguyen, A.; Nguyen, H.; Nguyen, C.; Tran, A.T.; Ho, N. Revisit Visual Prompt Tuning: The Expressiveness of Prompt Experts. In Proceedings of the Fourteenth International Conference on Learning Representations, Rio de Janeiro, Brazil, 23–27 April 2026. [Google Scholar]
- Dong, Y.; Cordonnier, J.B.; Loukas, A. Attention is not all you need: Pure attention loses rank doubly exponentially with depth. In Proceedings of the International Conference on Machine Learning. PMLR, Virtual, 1 July 2021; pp. 2793–2803. [Google Scholar]
- Raghu, M.; Unterthiner, T.; Kornblith, S.; Zhang, C.; Dosovitskiy, A. Do vision transformers see like convolutional neural networks? Adv. Neural Inf. Process. Syst. 2021, 34, 12116–12128. [Google Scholar]
- Zhou, D.; Kang, B.; Jin, X.; Yang, L.; Lian, X.; Jiang, Z.; Hou, Q.; Feng, J. Deepvit: Towards deeper vision transformer. arXiv 2021, arXiv:2103.11886. [Google Scholar]
- Nielsen, F. Hierarchical clustering. In Introduction to HPC with MPI for Data Science; Springer: Cham, Switzerland, 2016; pp. 195–211. [Google Scholar]
- Wang, Z.; Zhang, Z.; Lee, C.Y.; Zhang, H.; Sun, R.; Ren, X.; Su, G.; Perot, V.; Dy, J.; Pfister, T. Learning to prompt for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 139–149. [Google Scholar]
- Jia, M.; Tang, L.; Chen, B.C.; Cardie, C.; Belongie, S.; Hariharan, B.; Lim, S.N. Visual prompt tuning. In Proceedings of the European Conference on Computer Vision, Tel Aviv, Israel, 23–27 October 2022; Springer: Berlin/Heidelberg, Germany, 2022; pp. 709–727. [Google Scholar]
- Yao, R.; Jin, S.; Xu, L.; Zeng, W.; Liu, W.; Qian, C.; Luo, P.; Wu, J. Gkgnet: Group k-nearest neighbor based graph convolutional network for multi-label image recognition. In Proceedings of the European Conference on Computer Vision, Milan, Italy, 29 September–4 October 2024; Springer: Berlin/Heidelberg, Germany, 2024; pp. 91–107. [Google Scholar]
- Ma, L.; Sun, D.; Wang, L.; Zhao, H.; Luo, B. Semantic-aware dual contrastive learning for multi-label image classification. arXiv 2023, arXiv:2307.09715. [Google Scholar]
- Ridnik, T.; Sharir, G.; Ben-Cohen, A.; Ben-Baruch, E.; Noy, A. Ml-decoder: Scalable and versatile classification head. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 3–7 January 2023; pp. 32–41. [Google Scholar]
- Yoo, S.; Kim, E.; Jung, D.; Lee, J.; Yoon, S. Improving visual prompt tuning for self-supervised vision transformers. In Proceedings of the International Conference on Machine Learning, PMLR, Honolulu, HI, USA, 23–29 July 2023; pp. 40075–40092. [Google Scholar]
- Han, C.; Wang, Q.; Cui, Y.; Cao, Z.; Wang, W.; Qi, S.; Liu, D. E2VPT: An effective and efficient approach for visual prompt tuning. arXiv 2023, arXiv:2307.13770. [Google Scholar]
- Tian, X.; Zou, S.; Yang, Z.; Zhang, J. Argue: Attribute-guided prompt tuning for vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 17–21 June 2024; pp. 28578–28587. [Google Scholar]
- Tang, F.; Xu, Z.; Qu, Z.; Feng, W.; Jiang, X.; Ge, Z. Hunting attributes: Context prototype-aware learning for weakly supervised semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 17–21 June 2024; pp. 3324–3334. [Google Scholar]
- Lu, Y.; Liu, J.; Zhang, Y.; Liu, Y.; Tian, X. Prompt distribution learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 19–24 June 2022; pp. 5206–5215. [Google Scholar]
- Wu, G.; Jiang, J.; Jiang, K.; Liu, X.; Nie, L. Beyond degradation redundancy: Contrastive prompt learning for all-in-one image restoration. IEEE Trans. Pattern Anal. Mach. Intell. 2025, 48, 4005–4022. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Dong, G.; Zhao, C.; Pan, X.; Basu, A. Learning temporal distribution and spatial correlation toward universal moving object segmentation. IEEE Trans. Image Process. 2024, 33, 2447–2461. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Caron, M.; Touvron, H.; Misra, I.; Jégou, H.; Mairal, J.; Bojanowski, P.; Joulin, A. Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Virtual, 11–17 October 2021; pp. 9650–9660. [Google Scholar]
- Ma, L.L.; Xu, S.; Xie, M.K.; Wang, L.; Sun, D.; Zhao, H. Correlative and discriminative label grouping for multi-label visual prompt tuning. In Proceedings of the Computer Vision and Pattern Recognition Conference, Nashville, TN, USA, 11–15 June 2025; pp. 25434–25443. [Google Scholar]
- Xia, P.; Xu, D.; Hu, M.; Ju, L.; Ge, Z. Lmpt: Prompt tuning with class-specific embedding loss for long-tailed multi-label visual recognition. In Proceedings of the 3rd Workshop on Advances in Language and Vision Research (ALVR), Bangkok, Thailand, 16 August 2024; pp. 26–36. [Google Scholar]
- Miller, K.; Gangrade, A.; Mishra, S.; Saenko, K.; Saligrama, V. Sparc: Score prompting and adaptive fusion for zero-shot multi-label recognition in vision-language models. In Proceedings of the Computer Vision and Pattern Recognition Conference, Nashville, TN, USA, 11–15 June 2025; pp. 4313–4321. [Google Scholar]
- Lin, D. Probability guided loss for long-tailed multi-label image classification. In Proceedings of the AAAI Conference on Artificial Intelligence, Washington, DC, USA, 7–14 February 2023; Volume 37, pp. 1577–1585. [Google Scholar]
- Ridnik, T.; Ben-Baruch, E.; Zamir, N.; Noy, A.; Friedman, I.; Protter, M.; Zelnik-Manor, L. Asymmetric loss for multi-label classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Virtual, 11–17 October 2021; pp. 82–91. [Google Scholar]
- Kim, Y.; Fang, J.; Zhang, Q.; Cai, Z.; Shen, Y.; Duggal, R.; S. Raychaudhuri, D.; Tu, Z.; Xing, Y.; Dabeer, O. Open-world dynamic prompt and continual visual representation learning. In Proceedings of the European Conference on Computer Vision, Milan, Italy, 29 September–4 October 2024; Springer: Berlin/Heidelberg, Germany, 2024; pp. 357–374. [Google Scholar]
- Lin, T.Y.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; Zitnick, C.L. Microsoft coco: Common objects in context. In Proceedings of the European Conference on Computer Vision, Zurich, Switzerland, 6–12 September; Springer: Berlin/Heidelberg, Germany, 2014; pp. 740–755. [Google Scholar]
- Chua, T.S.; Tang, J.; Hong, R.; Li, H.; Luo, Z.; Zheng, Y. NUS-WIDE: A real-world web image database from National University of Singapore. In Proceedings of the ACM International Conference on Image and Video Retrieval, Niagara Falls, ON, Canada, 8–10 July, 2009; pp. 1–9. [Google Scholar]
- Duygulu, P.; Barnard, K.; de Freitas, J.F.; Forsyth, D.A. Object recognition as machine translation: Learning a lexicon for a fixed image vocabulary. In Proceedings of the European Conference on Computer Vision, Copenhagen, Denmark, 28–31 May 2002; Springer: Berlin/Heidelberg, Germany, 2002; pp. 97–112. [Google Scholar]
- Krstinić, D.; Braović, M.; Šerić, L.; Božić-Štulić, D. Multi-label classifier performance evaluation with confusion matrix. Comput. Sci. Inf. Technol. 2020, 1, 1–14. [Google Scholar]
- Zhai, S.; Likhomanenko, T.; Littwin, E.; Busbridge, D.; Ramapuram, J.; Zhang, Y.; Gu, J.; Susskind, J.M. Stabilizing transformer training by preventing attention entropy collapse. In Proceedings of the International Conference on Machine Learning. PMLR, Honolulu, HI, USA, 23–29 July 2023; pp. 40770–40803. [Google Scholar]
- Wang, Z.; Chen, T.; Li, G.; Xu, R.; Lin, L. Multi-label image recognition by recurrently discovering attentional regions. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 464–472. [Google Scholar]
- Liu, Y.; Sheng, L.; Shao, J.; Yan, J.; Xiang, S.; Pan, C. Multi-label image classification via knowledge distillation from weakly-supervised detection. In Proceedings of the 26th ACM international conference on Multimedia, Seoul, Republic of Korea, 22–26 October 2018; pp. 700–708. [Google Scholar]
- Zhu, F.; Li, H.; Ouyang, W.; Yu, N.; Wang, X. Learning spatial regularization with image-level supervisions for multi-label image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 5513–5522. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
- You, R.; Guo, Z.; Cui, L.; Long, X.; Bao, Y.; Wen, S. Cross-modality attention with semantic graph embedding for multi-label classification. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 12709–12716. [Google Scholar]
- Chen, Z.M.; Wei, X.S.; Jin, X.; Guo, Y. Multi-label image recognition with joint class-aware map disentangling and label correlation embedding. In Proceedings of the 2019 IEEE International Conference on Multimedia and Expo (ICME), Shanghai, China, 8–12 July 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 622–627. [Google Scholar]
- Ridnik, T.; Lawen, H.; Noy, A.; Ben Baruch, E.; Sharir, G.; Friedman, I. Tresnet: High performance gpu-dedicated architecture. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Virtual, 5–9 January 2021; pp. 1400–1409. [Google Scholar]
- Liu, R.; Liu, H.; Li, G.; Hou, H.; Yu, T.; Yang, T. Contextual debiasing for visual recognition with causal mechanisms. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Orleans, LA, USA, 19–24 June 2022; pp. 12755–12765. [Google Scholar]
- Jiu, M.; Sahbi, H. Deep context-aware kernel networks. arXiv 2019, arXiv:1912.12735. [Google Scholar] [CrossRef] [Scilit]
- Zhang, W.; Hu, H.; Hu, H. Neural ranking for automatic image annotation. Multimed. Tools Appl. 2018, 77, 22385–22406. [Google Scholar] [CrossRef] [Scilit]
- Jiu, M.; Zhu, H.; Sahbi, H. Multi-label classification using deep multi-order context-aware kernel networks. arXiv 2024, arXiv:2412.19491. [Google Scholar]
- Dietterich, T.G. Approximate statistical tests for comparing supervised classification learning algorithms. Neural Comput. 1998, 10, 1895–1923. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Rosner, B.; Glynn, R.J.; Lee, M.L.T. The Wilcoxon signed rank test for paired comparisons of clustered data. Biometrics 2006, 62, 185–192. [Google Scholar] [CrossRef] [Scilit] [PubMed]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.

