This section reports the empirical evaluation of the proposed method. We first describe the experimental setup and implementation details, and then present the main comparison results and ablation studies.
5.1. Experimental Setup
We implement Q-GrAM by modifying BLIP-2 OPT-2.7B with grouped query routing, Query Conditional Initialization, and group-aware late interaction matching. The model is trained using the COCO2014 training split only. Evaluation is conducted under a no-adaptation protocol. Specifically, the trained model is evaluated on the standard MS-COCO 5K test split without additional tuning. For cross-dataset evaluation, the same model is directly evaluated on Flickr30K without using any Flickr30K training data.
We evaluate both text-to-image retrieval and image-to-text retrieval using recall at K, including R@1, R@5, and R@10. Following common image–text retrieval practice, we also report the average recall for each retrieval direction and the overall average across both directions. Because the primary application scenario of Q-GrAM is text-driven image search, we pay particular attention to text-to-image retrieval, while also reporting image-to-text retrieval for completeness. In addition to MS-COCO 5K and Flickr30K, we evaluate Text→Image retrieval on Flickr30K-CFQ [
35]. Because Flickr30K-CFQ is designed for compact and fragmented text queries and does not define an Image→Text retrieval setting, we report Text→Image metrics only. Because each query may have multiple positive images, we distinguish between hit-based retrieval recall and fractional CFQ recall. Specifically, R@1, Hit@5, and Hit@10 follow the standard hit criterion, where a query is counted as correct if any positive image appears in the top-
k retrieved results. CFQ-R@5 and CFQ-R@10 denote multipositive fractional recall, computed as hits
. We also report MRR@10 and mAP@10 to evaluate ranking quality within the top-10 retrieved results.
We compare Q-GrAM with two groups of baselines. The first group includes global embedding baselines based on frozen encoders with a trainable projector, including CLIP and BLIP-2. The second group includes representative fine-grained image–text matching methods, including HREM, CHAN, and CORA. These methods cover hierarchical relation modeling, cross-modal hard alignment, and object-relation-attribute composition, respectively. Results of prior fine-grained methods are reported under the standard MS-COCO 5K and Flickr30K retrieval protocols, while our reproduced baselines and Q-GrAM are evaluated using the same metric definitions.
5.2. Implementation Details
We use BLIP-2 OPT-2.7B as the backbone model. Following the BLIP-2 design, the vision encoder and the large language model are kept frozen, while the Q-Former and the retrieval-specific modules are optimized. The trainable modules include the Q-Former, the language projection layer, the retrieval projection layers, the text-guided router, and the query modulation module.
All experiments are trained on the COCO2014 training split with bf16 mixed precision for 10 epochs. We use a per-step batch size of 128 without gradient accumulation, resulting in an effective batch size of 128. The maximum text length is set to 32. The learning rate is set to with a weight decay of 0.01, and a linear warm-up schedule is used for the first 5% of the optimization steps. The contrastive temperature is set to 0.05.
For Q-GrAM, we use four query groups. The router hidden dimension is set to 256, and top-k routing is used with . The router beta is initialized to 0.1 and gradually warmed up during early training. The weights of the inter-group diversity loss and the routing balance loss are both set to 0.02. Unless otherwise specified, the same hyperparameters are used for all ablation variants, with only the corresponding component removed. All experiments are conducted on an NVIDIA A100-PCIE-40GB GPU.
5.3. Main Comparison
Table 1 reports the main comparison on the standard MS-COCO 5K and Flickr30K caption-retrieval benchmarks. To further evaluate retrieval under more realistic query styles,
Table 2 reports additional Text→Image results on Flickr30K-CFQ, a compact and fragmented query benchmark.
Table 3 further reports paired bootstrap significance tests on Flickr30K-CFQ against representative fine-grained baselines.
It should be noted that
Table 1 contains both reproduced baselines and reported prior results. CLIP and BLIP-2 are evaluated under our reproduced frozen-encoder-plus-projector protocol, whereas HREM, CHAN, and CORA are included as representative fine-grained image–text matching methods using results reported from their original publications. As these prior methods may differ in visual backbone, training data, model size, and implementation protocol, the comparison with † methods should be interpreted as a contextual comparison rather than a strictly controlled head-to-head evaluation. Accordingly, we use these results to position Q-GrAM with respect to major fine-grained matching paradigms, including hierarchical relation modeling, cross-modal hard alignment, and object-relation-attribute composition, while avoiding strong state-of-the-art claims based on unmatched protocols.
On MS-COCO 5K, Q-GrAM obtains the highest listed Text→Image retrieval scores among the results in
Table 1. It obtains 49.38 R@1, 76.60 R@5, 85.44 R@10, and 70.47 T→I average. Compared with the reported CHAN result, which is the highest listed prior fine-grained baseline in the Text→Image direction, Q-GrAM improves T→I R@1 by 4.48 points and T→I average by 2.60 points. This result supports the effectiveness of text-guided grouped query routing for text-driven image search. In Image→Text retrieval, Q-GrAM does not outperform all prior fine-grained methods. HREM, CHAN, and CORA achieve stronger I→T averages, indicating that relation-based and compositional matching can be particularly effective for caption retrieval. Nevertheless, Q-GrAM remains competitive in the overall average and provides clear gains in the target Text→Image direction.
On Flickr30K, Q-GrAM also achieves the highest listed Text→Image retrieval scores among the listed methods, with 69.82 R@1, 90.84 R@5, 94.88 R@10, and 85.18 T→I average. Compared with the reported CORA result, Q-GrAM improves T→I R@1 by 5.72 points and T→I average by 3.41 points. For Image→Text retrieval, CORA achieves the highest I→T average, while Q-GrAM matches the highest listed I→T R@10 score. Overall, Q-GrAM obtains the highest listed average score on Flickr30K, showing that the proposed grouped query routing mechanism transfers effectively from COCO training to the standard Flickr30K caption-retrieval evaluation.
To examine whether Q-GrAM remains effective beyond standard caption-style retrieval, we further evaluate it on Flickr30K-CFQ. Unlike the original Flickr30K benchmark, Flickr30K-CFQ contains compact and fragmented textual queries and therefore better reflects realistic text-driven image search scenarios where user queries are often short, partial, or compositionally expressed. As Flickr30K-CFQ is designed for Text→Image retrieval, we report Text→Image metrics only, including hit-based recall, fractional CFQ recall, MRR@10, and mAP@10.
As shown in
Table 2, Q-GrAM achieves the highest listed scores across all reported metrics among the representative fine-grained baselines on Flickr30K-CFQ. It obtains 41.33 R@1, 62.97 Hit@5, 72.12 Hit@10, 57.15 CFQ-R@5, 65.81 CFQ-R@10, 50.62 MRR@10, and 47.38 mAP@10. Compared with the strongest listed fine-grained baseline CHAN, Q-GrAM improves R@1 by 10.00 points and mAP@10 by 9.81 points. The improvement is especially notable on R@1 and mAP@10, indicating that text-routed query specialization helps Q-GrAM rank highly relevant images near the top of the retrieved list under compact and fragmented query expressions. These results provide additional evidence that the proposed grouped Q-Former query organization is useful not only for full-sentence caption retrieval, but also for more realistic fine-grained text-driven image search.
To assess whether the main gains over fine-grained baselines are robust at the query level, we further conduct paired bootstrap significance testing on Flickr30K-CFQ. We resample text queries with replacement for 10,000 bootstrap trials and compute the metric differences between Q-GrAM and representative fine-grained baselines. As shown in
Table 3, Q-GrAM significantly improves over CHAN on both R@1 and mAP@10, with gains of 10.00 and 9.81 points, respectively, and both differences are significant with
. The improvements over HREM and CoRA are also statistically significant. These results provide additional evidence that the proposed grouped Q-Former query organization is useful not only for full-sentence caption retrieval, but also for more realistic fine-grained text-driven image search.
Taken together, the results on standard caption-retrieval benchmarks and Flickr30K-CFQ suggest that Q-GrAM is particularly effective for fine-grained Text→Image retrieval. Unlike prior fine-grained methods that mainly rely on region–word hard alignment, hierarchical relation modeling, or scene-graph-based compositional encoding, Q-GrAM improves retrieval by reorganizing Q-Former visual queries into text-routed semantic groups under a fixed query budget. The consistent gains in the Text→Image direction, especially on compact and fragmented queries, are aligned with the design goal of Q-GrAM: strengthening text-conditioned visual feature extraction and structured matching for text-driven image search. At the same time, the Image→Text results on MS-COCO 5K and Flickr30K show that Q-GrAM is competitive rather than uniformly dominant in the reverse retrieval direction.
5.4. Ablation Studies
We conduct ablation studies to analyze the contribution of the main components in Q-GrAM. All variants are trained on the COCO2014 training split and evaluated on MS-COCO 5K and Flickr30K under the same no-adaptation protocol as the main comparison. The full model contains grouped query routing, Query Conditional Initialization, group-aware late interaction, routing balance regularization, and inter-group diversity regularization. The ablated variants remove one component at a time while keeping the remaining settings unchanged.
We organize the ablation analysis into three parts. First,
Table 4 examines whether the gains of Q-GrAM come from simply increasing the number of Q-Former queries or from structured query utilization. Second,
Table 5 and
Table 6 analyze the contribution of individual Q-GrAM components. Third,
Table 7 analyzes the learned routing behavior and the effect of the balance regularizer on preventing routing collapse. Overall, the results show that different components play different roles. Group-aware late interaction and text-guided routing are the main sources of retrieval improvement, Query Conditional Initialization mainly affects the balance between retrieval directions, and the balance and diversity losses behave primarily as structural regularizers rather than as uniformly performance-improving modules.
Table 4 shows that simply increasing the number of Q-Former queries is ineffective. The pooled Q-Former variants are ablation-specific configurations designed to isolate the effect of query number under pooled scoring. Therefore,
Table 4 should be interpreted as a controlled comparison of query number, matching, grouping, and routing design choices within the ablation setting.
Increasing the query budget from 32 to 64 in the pooled Q-Former setting changes the overall average only from 61.06 to 61.03. This indicates that a larger query set does not automatically produce stronger retrieval representations, and that additional queries may remain redundant without an explicit specialization mechanism.
Introducing token-level late interaction brings a much larger improvement. The Late Interaction Q-Former improves the overall average from 61.06 to 71.00, confirming that token-query-level fine-grained matching is more effective than pooled global matching for text-driven image search. However, increasing the number of queries under the same late interaction setting again brings almost no benefit: the overall average remains nearly unchanged, from 71.00 to 70.99, while the COCO evaluation time increases from 291.2 s to 384.9 s. This result suggests that increasing query quantity is a less effective strategy than improving query utilization.
Uniform grouped late interaction produces no improvement over the ungrouped late interaction configuration. It obtains the same overall average as the Late Interaction Q-Former, indicating that grouping alone is insufficient when all groups are used uniformly. In contrast, text-routed grouped late interaction improves the overall average from 71.00 to 78.23 while still using only 32 queries. This is the key evidence that Q-GrAM benefits from structured, text-conditioned query utilization rather than from a larger query budget. The full Q-GrAM model further improves the overall average to 80.63, mainly through stronger Image→Text retrieval, while preserving the strong Text→Image performance obtained by text-routed grouped matching.
Removing group-aware late interaction leads to the most consistent degradation on both datasets. On MS-COCO 5K, the overall average decreases from 73.88 to 70.77, and on Flickr30K it decreases from 87.39 to 83.87. The degradation is particularly clear in the Text→Image direction, where the average recall drops from 70.47 to 65.81 on MS-COCO 5K and from 85.18 to 80.01 on Flickr30K. These results indicate that token-level and query-level fine-grained matching are critical for text-driven image search. Together with
Table 4, these results indicate that the improvements in Q-GrAM do not come merely from using more Q-Former visual queries, but from using them through fine-grained late interaction and text-guided grouped routing.
The effect of Query Conditional Initialization is directional. Removing QCI improves Text→Image retrieval on both datasets, increasing the Text→Image average from 70.47 to 71.08 on MS-COCO 5K and from 85.18 to 85.47 on Flickr30K. This indicates that QCI is not the main source of the Text→Image gains and should not be interpreted as a component that uniformly improves the primary retrieval direction. However, removing QCI substantially reduces Image→Text performance, where the average drops from 77.29 to 74.03 on MS-COCO 5K and from 89.60 to 86.73 on Flickr30K. As a result, the overall average also decreases from 73.88 to 72.55 on MS-COCO 5K and from 87.39 to 86.10 on Flickr30K. We therefore interpret QCI as a bidirectional alignment stabilizer rather than a unidirectional Text→Image performance booster. In other words, the primary Text→Image improvements in Q-GrAM mainly come from grouped routing and group-aware late interaction, while QCI helps preserve more balanced cross-modal alignment across retrieval directions.
The routing balance loss has a limited effect on retrieval accuracy. Removing it produces nearly identical Text→Image performance on MS-COCO 5K and a slightly higher overall average on Flickr30K. Therefore, we do not interpret the balance loss as a component that consistently improves recall metrics. Its role is instead to regularize the routing distribution and discourage degenerate group usage during training. This is consistent with the design motivation of Q-GrAM, where query groups are expected to remain usable and semantically differentiated rather than collapsing to a small subset of dominant groups.
To verify this interpretation, we further analyze the routing behavior on a COCO validation subset containing 55,439 valid text tokens. As shown in
Table 7, the full Q-GrAM model uses all four groups with a non-degenerate routing distribution. Its mean group mass is 18.4%, 22.5%, 38.6%, and 20.6%, and the effective number of used groups is 3.82 out of 4. Although the router shows a preference for the third group, the remaining groups still receive substantial routing mass, indicating that the learned routing does not collapse to a single group.
In contrast, removing the balance loss leads to severe routing collapse. Without the balance regularizer, 82.2% of the mean routing mass is assigned to one group, and the top-1 routing distribution assigns all valid tokens to the same group. The effective number of used groups drops from 3.82 to 1.83. This behavior explains why the balance loss is structurally important even when its effect on R@K metrics is modest. It prevents grouped routing from degenerating into single-group routing and helps preserve the intended multigroup specialization mechanism.
The diversity loss shows a similar regularization-oriented behavior, although its effect is not directly reflected by the routing-load statistics in
Table 7. Removing it produces results close to the full model on MS-COCO 5K and slightly higher overall performance on Flickr30K. This indicates that inter-group diversity regularization is not the dominant source of retrieval improvement in the current setting. Nevertheless, it provides an explicit constraint for reducing functional redundancy among query groups and encouraging more interpretable group specialization. Therefore, we treat the diversity loss as a structural regularizer rather than as a direct accuracy-enhancing component.
In summary, the ablation results support three conclusions. First, simply increasing the number of Q-Former queries is ineffective: increasing the query budget from 32 to 64 does not improve retrieval performance under either global matching or ungrouped late interaction. Second, the main performance gains come from fine-grained late interaction and text-guided grouped routing, which substantially improve query utilization under a fixed query budget. Third, Query Conditional Initialization, balance loss, and diversity loss should be interpreted as auxiliary structural components rather than uniformly accuracy-improving modules. QCI introduces a trade-off by slightly reducing Text→Image recall while improving Image→Text retrieval and the overall bidirectional average. The balance loss is especially important for preventing routing collapse, as shown by the routing behavior analysis. These findings support the design of Q-GrAM as a structured query specialization method rather than a simple extension of the BLIP-2 Q-Former with more query tokens.
5.5. Efficiency Analysis
We further analyze the computational efficiency of Q-GrAM to examine whether the proposed grouped query routing and group-aware late interaction introduce substantial overhead.
Table 8 reports the number of additional trainable parameters, encoding time, scoring time, total inference time, and peak GPU memory. Following the implementation protocol in our experiments, all measurements are conducted on an NVIDIA A100-PCIE-40 GB GPU.
Compared with the BLIP-2 baseline, Q-GrAM introduces a few additional parameters, with 3.51M trainable parameters. This indicates that the proposed grouped query routing and conditional modulation do not require a large parameter increase. In terms of runtime, Q-GrAM increases the total inference time from 209.96 ms to 242.08 ms, corresponding to an additional 32.12 ms, or approximately 15.3% relative overhead. The encoding time increases moderately from 209.87 ms to 224.87 ms, while the scoring time increases from 0.10 ms to 17.21 ms due to the group-aware late interaction computation.
Although the relative increase in scoring time is large because the baseline scoring operation is nearly negligible, the absolute scoring overhead remains moderate. Moreover, peak GPU memory remains almost unchanged, with 8.40 GB for Q-GrAM compared with 8.41 GB for the BLIP-2 baseline. These results suggest that Q-GrAM improves fine-grained text-to-image retrieval performance with acceptable inference overhead and without increasing peak memory consumption.