Test-Time Prompt-Agnostic Decomposition
Organizations: University of Science and Technology Beijing · University of New South Wales · Sympflux Co., Ltd. · Macquarie University
Abstract
Test-Time Prompt Tuning (TPT) adapts large pretrained models to unseen target distribution shifts by updating only lightweight prompt tokens. Existing TPT methods are effective, but they mainly optimize each prompt update locally. Across test-time steps, prompts updated at the current step are reused for the corresponding predictions and updates, so noisy or biased unlabeled objectives can accumulate and destabilize the prompt-update trajectory. We identify two failure modes: magnitude expansion, where updates move the prompt too far, and directional drift, where consecutive updates point in inconsistent directions. To analyze and control these failures, we propose Test-Time Prompt-Agnostic Decomposition (), which characterizes observed prompt-update trajectories from a dynamical-systems view and decomposes base prompt updates into magnitude and direction. computes a spectral radius to measure update expansion and decomposes update directions into persistent, oscillatory, and residual components. Building on this decomposition, Adaptive Koopman Control () regulates update magnitude by shrinking updates under expansive recent dynamics, while Hankel Update Router () refines update direction by preserving persistent components and suppressing oscillatory and residual components. Together, and produce a stabilized prompt update. As a prompt-agnostic framework, can be plugged into visual and text TPT methods without modifying the backbone, prompt architecture, or adaptation loss. Experiments on 15 datasets show that consistently improves 10 baselines, with accuracy gains of -- for visual prompts and over for text prompts.
Figures & tables
| Method | ImageNet | ImageNet-V2 | ImageNet-S | ImageNet-A | ImageNet-R | OOD Mean | Mean |
|---|---|---|---|---|---|---|---|
| ViT-based visual prompt tuning | |||||||
| ViT-B/16 | 81.44 | 70.85 | 35.44 | 30.92 | 47.48 | 46.17 | 53.23 |
| VPT + | 78.16 +3.15 | 64.55 +5.32 | 32.77 +3.25 | 19.17 +19.81 | 42.14 +4.33 | 39.66 +8.18 | 47.36 +7.17 |
| E2VPT + | 78.35 +2.69 | 64.09 +4.93 | 32.89 +2.70 | 18.17 +20.79 | 42.07 +3.94 | 39.31 +8.09 | 47.11 +7.01 |
| VFPT + | 78.71 +2.62 | 65.34 +4.75 | 33.16 +2.81 | 22.05 +18.68 | 42.81 +3.55 | 40.84 +7.45 | 48.41 +6.48 |
| BPT + | 81.30 +2.87 | 70.48 +2.45 | 28.62 +9.93 | 38.97 +4.23 | 43.68 +5.39 | 45.44 +5.51 | 52.61 +4.97 |
| Method | Caltech101 | OxfordPets | StanfordCars | Flowers102 | Food101 | Aircraft | SUN397 | DTD | EuroSAT | UCF101 | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| ViT-based visual prompt tuning | |||||||||||
| ViT-B/16 | 86.71 | 92.20 | 57.84 | 66.23 | 82.78 | 22.06 | 56.07 | 48.19 | 49.91 | 65.08 | 62.71 |
| VPT + | 92.65 +2.72 | 86.89 +2.49 | 60.68 +2.13 | 64.86 +3.23 | 85.14 +1.31 | 21.21 +3.25 | 59.92 +3.87 | 38.19 +4.06 | 20.91 +11.26 | 59.28 +2.73 | 58.97 +3.71 |
| E2VPT + | 92.29 +2.01 | 86.89 +2.75 | 60.03 +2.08 | 63.85 +3.96 | 84.55 +1.26 | 20.79 +3.51 | 59.07 +3.48 | 37.93 +5.33 | 17.29 +11.67 | 58.75 +2.81 | 58.14 +3.89 |
| VFPT + | 92.76 +2.36 | 87.33 +2.71 | 62.01 +2.41 | 67.77 +1.98 | 85.18 +1.43 | 21.69 +3.33 | 59.31 +2.64 | 40.53 +3.43 | 23.54 +12.66 | 60.26 +1.43 | 60.04 +3.44 |
| BPT + | 79.51 +13.89 | 68.26 +14.45 | 49.88 +11.15 | 64.82 +2.33 | 67.45 +15.21 | 21.47 +4.15 | 48.50 +7.84 | 41.46 +1.96 | 57.42 +1.71 | 50.52 +9.59 | 54.93 +8.23 |
| VPT | TPT | |||||
|---|---|---|---|---|---|---|
| Variant | DG | CSD | DG | CSD | ||
| Baseline | 39.66 | 58.97 | 1.00 | 60.81 | 65.10 | 1.00 |
| Simple stabilization rules | ||||||
| + Update clipping | 41.92 | 59.54 | 1.11 | 61.36 | 65.47 | 1.06 |
| + EMA update | 42.74 | 59.86 | 0.99 | 61.65 | 65.82 | 1.01 |
| + Norm control | 43.65 | 61.03 | 1.07 | 61.72 | 65.74 | 1.03 |
| VPT | TPT | |||
|---|---|---|---|---|
| Variant | DG | CSD | DG | CSD |
| Baseline | 39.66 | 58.97 | 60.81 | 65.10 |
| Ablation study of Koopman operator modes | ||||
| Full | 43.58 | 60.86 | 61.80 | 66.38 |
| Diagonal (+ ) | 45.92 | 61.74 | 62.56 | 67.21 |
| Ablation study of projection matrix modes | ||||
Appendix figures & tables27 assets
Supplementary material from the paper’s appendix.
Appendix
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OoD Mean 4 |
|---|---|---|---|---|---|---|
| Baseline | 78.16 | 64.55 | 32.77 | 19.17 | 42.14 | 39.66 |
| + Update clipping | 78.84 | 65.52 | 34.09 | 22.95 | 45.11 | 41.92 |
| + EMA update | 79.35 | 65.98 | 36.82 | 24.44 | 43.71 | 42.74 |
| + Norm control | 79.76 | 66.66 | 34.26 | 25.60 | 48.09 | 43.65 |
| + Low-pass filtering | 80.14 | 68.29 | 34.76 | 28.43 | 45.65 | 44.28 |
| VPT+ | 81.31 | 69.87 | 36.02 | 38.98 | 46.47 | 47.84 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 92.65 | 86.89 | 60.68 | 64.86 | 85.14 | 21.21 | 59.92 | 38.19 | 20.91 | 59.28 | 58.97 |
| + Update clipping | 92.94 | 87.35 | 61.27 | 65.16 | 85.85 | 21.93 | 60.57 | 38.48 | 21.78 | 60.03 | 59.54 |
| + EMA update | 93.27 | 87.46 | 61.07 | 65.33 | 85.67 | 22.47 | 61.00 | 38.77 | 22.79 | 60.80 | 59.86 |
| + Norm control | 93.10 | 87.71 | 63.33 | 66.75 | 86.59 | 26.40 | 60.40 | 40.54 | 24.25 | 61.19 | 61.03 |
| + Low-pass filtering | 93.39 | 89.29 | 62.23 | 67.32 | 86.20 | 21.99 | 62.55 | 39.07 | 25.15 | 61.93 | 60.91 |
| VPT+ | 95.37 | 89.38 | 62.81 | 68.09 | 86.45 | 24.46 | 63.79 | 42.25 | 32.17 | 62.01 | 62.68 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OOD Mean |
|---|---|---|---|---|---|---|
| Baseline | 68.98 | 63.45 | 47.94 | 54.77 | 77.06 | 60.81 |
| + Update clipping | 69.90 | 64.12 | 48.40 | 55.09 | 77.84 | 61.36 |
| + EMA update | 69.86 | 63.80 | 49.82 | 55.25 | 77.74 | 61.65 |
| + Norm control | 70.11 | 63.64 | 50.05 | 55.80 | 77.39 | 61.72 |
| + Low-pass filtering | 70.62 | 64.49 | 49.02 | 56.03 | 79.38 | 62.23 |
| TPT+ | 71.19 | 65.98 | 49.62 | 56.73 | 79.98 | 63.08 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 94.16 | 87.79 | 66.87 | 68.98 | 84.67 | 24.78 | 65.50 | 47.75 | 42.44 | 68.04 | 65.10 |
| + Update clipping | 94.48 | 88.06 | 67.12 | 69.63 | 84.88 | 25.17 | 65.59 | 48.52 | 42.78 | 68.49 | 65.47 |
| + EMA update | 94.24 | 88.53 | 67.47 | 69.75 | 85.13 | 26.04 | 65.91 | 48.58 | 43.85 | 68.73 | 65.82 |
| + Norm control | 94.60 | 88.77 | 67.84 | 68.98 | 85.26 | 25.80 | 65.77 | 49.00 | 42.93 | 68.49 | 65.74 |
| + Low-pass filtering | 94.56 | 88.66 | 68.09 | 69.83 | 85.58 | 26.34 | 66.37 | 51.18 | 43.11 | 68.57 | 66.23 |
| TPT+ | 96.32 | 90.31 | 68.55 | 71.06 | 88.32 | 27.19 | 68.51 | 51.98 | 46.03 | 72.00 | 68.03 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OoD 4 |
|---|---|---|---|---|---|---|
| Baseline | 78.16 | 64.55 | 32.77 | 19.17 | 42.14 | 39.66 |
| Full Koopman | 79.74 | 69.39 | 35.83 | 23.73 | 45.36 | 43.58 |
| VPT+ (diag.) | 80.94 | 69.70 | 38.33 | 28.47 | 47.17 | 45.92 |
| VPT+ | 81.31 | 69.87 | 36.02 | 38.98 | 46.47 | 47.84 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 92.65 | 86.89 | 60.68 | 64.86 | 85.14 | 21.21 | 59.92 | 38.19 | 20.91 | 59.28 | 58.97 |
| Full Koopman | 93.67 | 88.14 | 61.30 | 66.34 | 85.88 | 24.63 | 62.44 | 39.78 | 24.84 | 61.56 | 60.86 |
| VPT+ (diag.) | 94.24 | 89.78 | 62.33 | 66.83 | 86.03 | 25.23 | 62.15 | 40.96 | 26.95 | 62.94 | 61.74 |
| VPT+ | 95.37 | 89.38 | 62.81 | 68.09 | 86.45 | 24.46 | 63.79 | 42.25 | 32.17 | 62.01 | 62.68 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OOD Mean |
|---|---|---|---|---|---|---|
| Baseline | 68.98 | 63.45 | 47.94 | 54.77 | 77.06 | 60.81 |
| Full Koopman | 69.86 | 63.73 | 49.87 | 55.83 | 77.76 | 61.80 |
| TPT+ (diag.) | 71.28 | 64.36 | 50.52 | 56.28 | 79.09 | 62.56 |
| TPT+ | 71.19 | 65.98 | 49.62 | 56.73 | 79.98 | 63.08 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 94.16 | 87.79 | 66.87 | 68.98 | 84.67 | 24.78 | 65.50 | 47.75 | 42.44 | 68.04 | 65.10 |
| Full Koopman | 95.29 | 88.91 | 68.05 | 70.44 | 85.86 | 26.52 | 66.46 | 48.17 | 44.65 | 69.47 | 66.38 |
| TPT+ (diag.) | 95.42 | 89.18 | 68.77 | 70.60 | 88.29 | 26.43 | 68.19 | 50.30 | 44.95 | 69.97 | 67.21 |
| TPT+ | 96.32 | 90.31 | 68.55 | 71.06 | 88.32 | 27.19 | 68.51 | 51.98 | 46.03 | 72.00 | 68.03 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OoD 4 |
|---|---|---|---|---|---|---|
| Baseline | 78.16 | 64.55 | 32.77 | 19.17 | 42.14 | 39.66 |
| Plain projection | 79.17 | 67.46 | 34.53 | 23.41 | 43.83 | 42.31 |
| VPT+ (Hankel) | 81.10 | 69.84 | 38.60 | 26.25 | 49.21 | 45.98 |
| VPT+ | 81.31 | 69.87 | 36.02 | 38.98 | 46.47 | 47.84 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 92.65 | 86.89 | 60.68 | 64.86 | 85.14 | 21.21 | 59.92 | 38.19 | 20.91 | 59.28 | 58.97 |
| Plain projection | 93.87 | 86.92 | 61.57 | 65.41 | 85.84 | 23.01 | 61.29 | 39.95 | 24.33 | 60.03 | 60.22 |
| VPT+ (Hankel) | 95.21 | 89.26 | 64.99 | 67.07 | 86.85 | 25.26 | 64.69 | 40.37 | 26.81 | 61.30 | 62.18 |
| VPT+ | 95.37 | 89.38 | 62.81 | 68.09 | 86.45 | 24.46 | 63.79 | 42.25 | 32.17 | 62.01 | 62.68 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OOD Mean |
|---|---|---|---|---|---|---|
| Baseline | 68.98 | 63.45 | 47.94 | 54.77 | 77.06 | 60.81 |
| Plain projection | 69.46 | 64.31 | 48.65 | 54.99 | 77.78 | 61.43 |
| TPT+ (Hankel) | 70.77 | 65.31 | 50.24 | 56.77 | 79.05 | 62.84 |
| TPT+ | 71.19 | 65.98 | 49.62 | 56.73 | 79.98 | 63.08 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 94.16 | 87.79 | 66.87 | 68.98 | 84.67 | 24.78 | 65.50 | 47.75 | 42.44 | 68.04 | 65.10 |
| Plain projection | 94.77 | 88.17 | 67.42 | 70.20 | 85.43 | 26.04 | 66.19 | 48.76 | 43.56 | 69.52 | 66.01 |
| TPT+ (Hankel) | 95.25 | 89.07 | 67.98 | 71.74 | 86.68 | 27.18 | 68.60 | 53.01 | 45.59 | 70.34 | 67.54 |
| TPT+ | 96.32 | 90.31 | 68.55 | 71.06 | 88.32 | 27.19 | 68.51 | 51.98 | 46.03 | 72.00 | 68.03 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OoD 4 |
|---|---|---|---|---|---|---|
| Baseline | 78.16 | 64.55 | 32.77 | 19.17 | 42.14 | 39.66 |
| w/o Pres. | 81.33 | 69.32 | 35.99 | 36.51 | 46.41 | 47.06 |
| w/o Osc. | 81.36 | 69.38 | 36.48 | 36.65 | 46.61 | 47.28 |
| w/o Res. | 81.02 | 69.08 | 35.25 | 36.35 | 46.68 | 46.84 |
| VPT+ | 81.31 | 69.87 | 36.02 | 38.98 | 46.47 | 47.84 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 92.65 | 86.89 | 60.68 | 64.86 | 85.14 | 21.21 | 59.92 | 38.19 | 20.91 | 59.28 | 58.97 |
| w/o Pres. | 95.42 | 88.96 | 62.50 | 67.97 | 85.98 | 24.54 | 63.06 | 41.19 | 31.81 | 61.49 | 62.29 |
| w/o Osc. | 95.66 | 88.09 | 62.19 | 68.21 | 86.34 | 24.00 | 61.89 | 41.78 | 33.26 | 62.28 | 62.37 |
| w/o Res. | 94.69 | 88.96 | 62.16 | 67.84 | 86.01 | 23.85 | 63.08 | 43.03 | 30.81 | 61.64 | 62.21 |
| VPT+ | 95.37 | 89.38 | 62.81 | 68.09 | 86.45 | 24.46 | 63.79 | 42.25 | 32.17 | 62.01 | 62.68 |
| Variant | ImageNet | ImageNet-V2 | ImageNet-Sketch | ImageNet-A | ImageNet-R | OOD Mean |
|---|---|---|---|---|---|---|
| Baseline | 68.98 | 63.45 | 47.94 | 54.77 | 77.06 | 60.81 |
| w/o Pres. | 70.54 | 65.86 | 49.05 | 56.71 | 80.17 | 62.95 |
| w/o Osc. | 71.25 | 65.58 | 49.42 | 56.36 | 80.00 | 62.84 |
| w/o Res. | 71.70 | 66.02 | 49.22 | 56.36 | 79.61 | 62.80 |
| TPT+ | 71.19 | 65.98 | 49.62 | 56.73 | 79.98 | 63.08 |
| Variant | Caltech | Pets | Cars | Flowers | Food | Aircraft | SUN | DTD | EuroSAT | UCF | Mean |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Baseline | 94.16 | 87.79 | 66.87 | 68.98 | 84.67 | 24.78 | 65.50 | 47.75 | 42.44 | 68.04 | 65.10 |
| w/o Pres. | 96.27 | 90.35 | 68.00 | 70.65 | 88.08 | 27.06 | 68.88 | 51.65 | 45.48 | 70.90 | 67.73 |
| w/o Osc. | 96.92 | 89.89 | 68.10 | 70.36 | 89.18 | 26.16 | 68.99 | 52.01 | 46.30 | 70.82 | 67.87 |
| w/o Res. | 96.47 | 89.62 | 68.19 | 70.24 | 87.38 | 27.48 | 67.96 | 51.24 | 46.06 | 70.79 | 67.54 |
| TPT+ | 96.32 | 90.31 | 68.55 | 71.06 | 88.32 | 27.19 | 68.51 | 51.98 | 46.03 | 72.00 | 68.03 |
| Stream | Method | Overall | V2 | Sketch | First-10 |
|---|---|---|---|---|---|
| Abrupt | VPT | 64.52 | 29.67 | 47.28 | |
| VPT+TPD | 65.78 | 31.40 | 48.78 | ||
| Mixed | VPT | 65.09 | 27.11 | N/A | |
| VPT+TPD | 66.19 | 29.08 | N/A | ||
| Rapid Alternation | VPT | 63.82 | 26.62 | 45.82 | |
| VPT+TPD | 67.64 | 31.69 | 50.09 |
| Method | Stream | P | O | R | Accuracy |
|---|---|---|---|---|---|
| VPT | Abrupt | 17.54 | 0.71 | 81.75 | |
| VPT | Mixed | 12.83 | 0.48 | 86.69 | |
| VPT | Rapid Alternation | 5.09 | 1.26 | 93.65 | |
| TPT | Abrupt | 3.30 | 0.45 | 96.25 | |
| TPT | Mixed | 3.16 | 0.44 | 96.40 | |
| TPT | Rapid Alternation | 3.19 | 0.46 | 96.35 |
| VPT | TPT | |||
|---|---|---|---|---|
| Method | ImageNet-A | ImageNet-R | ImageNet-A | ImageNet-R |
| Base | ||||
| Base+TPD | ||||
| VPT | TPT | |||
|---|---|---|---|---|
| Controller | ImageNet-A | ImageNet-R | ImageNet-A | ImageNet-R |
| Base | 19.17 | 42.14 | 54.77 | 77.06 |
| Adaptive Clipping | 23.52 | 41.92 | 54.85 | 77.31 |
| Variance-aware Scaling | 22.76 | 43.65 | 55.19 | 77.26 |
| TPD | 38.98 | 46.47 | 56.73 | 79.98 |
Test-Time Adaptation
Test-time adaptation updates or recalibrates pretrained models at inference to handle distribution shifts, often without target labels.
See all 318 papers