Layer-Wise Gate-Controlled Prompt Truncation in a Multimodal Chest X-Ray Classifier
Organizations: Central South University, Changsha 410083, China · Hong Kong Baptist University, Hong Kong, China · University of Minnesota, Minneapolis, MN 55414, USA
Abstract
Mixture of Prompt Experts (MoPE) adapts multimodal transformers through input-dependent prompt composition, while retaining a fixed prompt length. We investigate a layer-wise gating extension in a binary chest X-ray classification pilot study. The controller predicts a retention ratio for each sample, averages these ratios within a mini-batch, and uses the resulting integer length to truncate the static and mixed visual prompts. Retained mixed prompts are also scaled by the individual ratios. In one recorded run per configuration, the gated model reached a best validation accuracy of 0.8996, compared with 0.8969 for the fixed-length baseline; the corresponding final values were 0.8963 and 0.8802. The exported gate statistics imply a retained length of one at all recorded training points, relative to a configured maximum of six. This reduces the complete visual sequence from 210 to 200 tokens, but no direct runtime measurements establish an acceleration benefit. Report-derived labels, report text as input, sequential data partitioning, and the absence of repeated controlled experiments limit interpretation. The findings document prompt shortening under the configured gate penalty; they do not establish sample-specific length allocation, superiority over fixed short prompts, or clinical utility. Code is available at: https://github.com/jingtaolei/mope-dynamic-prompt-truncation.
Figures & tables
| Token component | Reduction (%) | ||
|---|---|---|---|
| Mixed prompt | 6 | 1 | 83.33 |
| Static prompt | 6 | 1 | 83.33 |
| All inserted tokens, including instruction | 13 | 3 | 76.92 |
| Complete visual sequence | 210 | 200 | 4.76 |
| Setting | Value |
|---|---|
| Visual encoder | ViT-B/16; 12 layers; dimension 768 |
| Text encoder | BERT-base-uncased; entire branch frozen |
| Visual / text prompt length | 6 maximum / 4 |
| Prompt experts | 4 |
| Gate hidden dimension | 192 |
| Batch size / random seed | 8 / 42 |
| Measure | Fixed length 6 | Gated, maximum length 6 |
|---|---|---|
| Best validation accuracy | 0.8969 | 0.8996 |
| Step of best validation record | 6959 | 5713 |
| Final validation accuracy | 0.8802 | 0.8963 |
| Final recorded mini-batch accuracy | 0.7500 | 1.0000 |
| Final recorded total training loss | 0.6998 | 0.1553 |
| Final recorded importance loss | 3.1456 | 1.4875 |
Prompt Tuning
Prompt tuning adapts pretrained models by learning compact prompts or prefixes instead of updating all model parameters.
See all 76 papers