DEFTS: Data-Efficient, Training-Free Few-Shot Learning for CLIP in the Text Subspace
Organizations: Independent researcher, London, United Kingdom
Abstract
Contrastive Language-Image Pre-training (CLIP) achieves impressive zero-shot image classification performance by comparing image embeddings against class-specific text embeddings. While recent few-shot methods leverage labeled training samples to improve upon this zero-shot baseline, they often predominantly rely on image embeddings and underutilize the semantic structure of the text embeddings. In this paper, we introduce DEFTS, a data-efficient, training-free few-shot classification method strictly in the text subspace. We first demonstrate empirically that while raw text embeddings can be suboptimal as direct classifiers, the linear subspace they span remains highly discriminative. DEFTS therefore proposes to reduce the image-text modality gap by projecting estimated image prototypes directly into this subspace. Importantly, by expressing these prototypes as linear combinations of text embeddings, DEFTS reduces a high-dimensional estimation problem to the derivation of just a few coefficients. These coefficients are then computed via a Bayesian posterior mean, using a prior naturally centered on the original text embedding coordinates. Extensive experiments across 12 image classification benchmarks demonstrate that DEFTS significantly improves upon existing training-free methods.
Figures & tables
| Dataset | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS |
| C10 | 94.89 (+0.38 0.18) | 79.44 (+15.84 3.08) | 81.42 (+13.90 2.77) | 94.85 (+0.24 0.24) | 94.34 (+0.45 0.61) | 94.48 (+0.54 0.19) | 94.80 (+0.39 0.16) | 94.80 (+0.41 0.12) | 95.29 |
| C100 | 77.27 (+0.29 0.30) | 48.35 (+28.50 0.67) | 53.39 (+23.38 2.10) | 77.53 (+0.00 0.00) | 77.65 (+0.00 0.00) | 68.43 (+2.32 1.02) | 77.38 (+0.16 0.18) | 77.27 (+0.29 0.30) | 76.85 |
| Cal101 | 94.62 (+0.53 0.31) | 91.13 (+4.47 0.48) | 91.62 (+3.70 0.72) | 94.64 (+0.00 0.00) | 94.83 (+0.00 0.00) | 94.59 (+0.53 0.12) | 94.95 (+0.41 0.28) | 94.62 (+0.53 0.31) | 95.58 |
| DTD | 53.03 (+4.98 1.87) | 48.05 (+14.29 1.38) | 48.95 (+14.47 2.48) | 57.09 (+1.70 1.64) | 56.33 (+0.31 0.57) | 56.20 (+2.18 0.91) | 56.82 (+1.28 1.23) | 53.03 (+4.98 1.87) | 62.37 |
| Euro | 61.17 (+5.66 2.26) | 67.60 (+5.18 2.74) | 64.66 (+8.25 4.37) | 66.87 (+1.39 0.94) | 68.90 (+2.06 2.67) | 66.81 (+1.77 0.54) | 61.07 (+6.26 2.24) | 67.54 (+4.27 3.14) | 68.67 |
| Air. | 32.18 (+0.25 0.47) | 34.62 (+8.55 1.71) | 33.55 (+10.36 1.46) | 34.76 (+0.00 0.00) | 37.49 (+0.74 1.35) | 43.29 (+1.90 0.37) | 35.56 (+0.15 0.32) | 32.18 (+0.25 0.47) | 44.57 |
| -shot | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS alone |
| 74.65 (+3.03 0.46) | 50.88 (+18.37 1.25) | 55.27 (+16.43 1.15) | 75.05 (+2.69 0.43) | 75.79 (+2.07 0.38) | 75.29 (+2.48 0.41) | 76.21 (+1.02 0.21) | 74.69 (+3.00 0.45) | 77.12 | |
| 74.65 (+2.36 0.69) | 64.46 (+15.30 1.30) | 65.74 (+14.07 1.07) | 76.57 (+0.76 0.31) | 77.34 (+0.41 0.25) | 75.19 (+1.27 0.18) | 76.65 (+0.94 0.32) | 76.37 (+1.12 0.37) | 79.50 | |
| 74.65 (+6.33 0.91) | 73.83 (+8.48 0.73) | 75.84 (+6.35 0.66) | 79.05 (+2.16 0.45) | 79.78 (+1.64 0.36) | 76.93 (+0.52 0.13) | 78.80 (+2.20 0.46) | 82.12 (+0.68 0.26) | 81.66 | |
| 74.65 (+8.90 1.10) | 78.80 (+5.54 0.47) | 81.44 (+2.61 0.36) | 81.37 (+2.79 0.35) | 82.06 (+2.29 0.38) | 78.84 (+0.03 0.06) | 80.00 (+3.30 0.54) | 85.24 (+0.49 0.13) | 83.51 | |
| 74.65 (+10.04 1.20) | 81.56 (+4.00 0.37) | 85.12 (+0.37 0.27) | 82.85 (+2.69 0.33) | 83.84 (+2.11 0.35) | 80.58 (+0.43 0.20) | 80.89 (+3.78 0.59) | 86.70 (+0.70 0.16) | 84.59 |
| Method | 1 shot | 2 shots | 4 shots | 8 shots | 16 shots |
| DEFTS (fixed weight 0.5) | 77.16 | 78.82 | 79.56 | 80.02 | 80.32 |
| DEFTS | 77.12 | 79.50 | 81.66 | 83.51 | 84.59 |
| Method | |||||
| TAMP alone | 74.47 ( 2.65) | 76.52 ( 2.72) | 78.81 ( 2.44) | 79.96 ( 2.33) | 80.89 ( 2.21) |
| DEFTS alone | 77.12 ( 2.49) | 79.50 ( 2.34) | 81.66 ( 2.16) | 83.51 ( 1.95) | 84.59 ( 1.83) |
| DEFTS TAMP | +2.66 ( 0.35) | +2.97 ( 0.56) | +2.85 ( 0.51) | +3.55 ( 0.61) | +3.70 ( 0.61) |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Component | TAMP | DEFTS |
| Image representation | Projected image mean | Projected image mean |
| Text representation | Text prototype | Text prototype as prior mean |
| Subspace | Uncentered text span | Centered varaince reduced PCA subspace |
| Fusion | Scalar interpolation | Precision-weighted fusion |
| Image weighting | Global | Direction-dependent |
| Uncertainty | Not modeled explicitly | Estimated covariance |
| Dataset | Total Images | # Classes | Min/Class | Max/Class |
| CIFAR10 | 10,000 | 10 | 1,000 | 1,000 |
| CIFAR100 | 10,000 | 100 | 100 | 100 |
| EuroSAT | 27,000 | 10 | 2,000 | 3,000 |
| Food101 | 25,250 | 101 | 250 | 250 |
| OxfordIIITPet | 3,669 | 37 | 88 | 100 |
| FGVCAircraft | 3,333 | 100 | 33 | 34 |
| Dataset | Prompt Template |
| CIFAR10 | a photo of a {c}. |
| CIFAR100 | a photo of a {c}. |
| EuroSAT | a centered satellite photo of {c}. |
| Food101 | a photo of {c}, a type of food. |
| OxfordIIITPet | a photo of a {c}, a type of pet. |
| FGVCAircraft | a photo of a {c}, a type of aircraft. |
| Dataset | (ViT-L/14) | (ViT-B/32) | (ViT-H/14) | |
| CIFAR10 | 10 | 9 | 8 | 9 |
| CIFAR100 | 100 | 75 | 73 | 74 |
| Caltech101 | 100 | 75 | 73 | 74 |
| DTD | 47 | 37 | 35 | 38 |
| EuroSAT | 10 | 8 | 8 | 8 |
| FGVCAircraft | 100 | 46 | 42 | 46 |
| Dataset | |||||||
| CIFAR10 | 10 | 0.013 | 30.4 | 14.9 | 5.2 | 2.6 | 0.8 |
| EuroSAT | 10 | 0.013 | 5.0 | 0.2 | 4.4 | 6.6 | 6.5 |
| Pets | 37 | 0.048 | 36.3 | 22.3 | 12.9 | 6.6 | 4.0 |
| DTD | 47 | 0.061 | 12.1 | 9.4 | 7.6 | 5.9 | 4.9 |
| CIFAR100 | 100 | 0.130 | 23.2 | 20.5 | 13.9 | 8.9 | 6.3 |
| Caltech101 | 100 | 0.130 | 11.6 | 4.1 | 1.8 | 1.1 | 1.0 |
| 95% Variance | 99.9% Variance | |||
| Centered | Uncentered | Centered | Uncentered | |
| 1 | 76.97 | 73.54 | 76.63 | 76.73 |
| 2 | 79.60 | 76.65 | 79.72 | 79.56 |
| 4 | 81.77 | 79.25 | 81.68 | 81.64 |
| 8 | 83.59 | 81.37 | 83.48 | 83.27 |
| 16 | 84.68 | 82.51 | 84.70 | 84.41 |
| Dataset | Number of shots ( ) | ||||
| Average | |||||
| CIFAR10 | 5.09 | 4.94 | 3.81 | 5.21 | 4.76 |
| CIFAR100 | 5.97 | 6.00 | 6.12 | 6.14 | 6.06 |
| Caltech101 | 6.81 | 6.61 | 6.43 | 6.52 | 6.59 |
| DTD | 11.16 | 11.47 | 11.04 | 10.95 | 11.16 |
| EuroSAT | 2.03 | 2.82 | 3.23 | 3.22 | 2.83 |
| raw (no projection) | 50.86 | 64.99 | 74.14 | 79.17 | 81.82 |
| text span (full) | 65.26 | 74.13 | 79.36 | 82.21 | 83.82 |
| PCA 95% variance | 67.87 | 75.95 | 80.40 | 82.85 | 84.23 |
| PCA 90% variance | 67.71 | 75.74 | 80.17 | 82.60 | 83.93 |
| PCA 85% variance | 67.03 | 75.20 | 79.62 | 82.09 | 83.48 |
| PCA 80% variance | 66.23 | 74.38 | 78.91 | 81.45 | 82.85 |
| Change relative to the fixed setting (points, average over 12 datasets) | 1 shot | 2 shots | 4 shots | 8 shots | 16 shots |
| Tuned for each dataset alone (oracle) | 1.82 | 0.84 | 0.61 | 0.33 | 0.31 |
| Tuned on the other 11 datasets | 0.60 | 0.14 | 0.01 | 0.02 | 0.06 |
| Dataset | |||||
| CIFAR10 | 0.00 | 0.14 | 0.05 | 0.03 | 0.04 |
| CIFAR100 | 1.60 | 1.65 | 0.86 | 0.64 | 0.53 |
| Caltech101 | 1.24 | 0.64 | 0.44 | 0.29 | 0.31 |
| DTD | 0.77 | 1.01 | 1.60 | 0.21 | 0.05 |
| EuroSAT | 3.45 | 1.60 | 1.17 | 1.22 | 1.10 |
| Aircraft | 1.25 | 1.34 | 1.57 | 0.55 | 0.76 |
| Dataset | |||||
| CIFAR10 | 0.05 | 0.09 | 0.03 | 0.03 | 0.02 |
| CIFAR100 | 1.59 | 0.22 | 0.55 | 0.55 | 0.49 |
| Caltech101 | 0.55 | 0.44 | 0.28 | 0.25 | 0.22 |
| DTD | 0.80 | 0.08 | 0.13 | 0.16 | 0.10 |
| EuroSAT | 1.19 | 0.79 | 0.77 | 1.09 | 1.10 |
| Aircraft | 0.91 | 0.43 | 0.44 | 0.27 | 0.05 |
| Dataset | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS |
| C10 | 94.89 (+0.21 0.17) | 60.57 (+30.13 2.99) | 70.54 (+23.49 4.18) | 95.01 (+0.12 0.14) | 95.05 (+0.10 0.14) | 95.03 (+0.11 0.13) | 94.81 (+0.26 0.14) | 94.90 (+0.21 0.15) | 95.14 |
| C100 | 77.27 (+1.27 0.18) | 33.04 (+29.25 1.04) | 38.88 (+26.85 1.05) | 77.41 (+1.17 0.16) | 77.85 (+0.79 0.11) | 77.58 (+0.99 0.15) | 77.67 (+0.60 0.12) | 77.29 (+1.27 0.19) | 77.28 |
| Cal101 | 94.62 (+0.86 0.27) | 79.69 (+11.04 1.14) | 85.78 (+7.03 0.84) | 94.88 (+0.62 0.24) | 95.30 (+0.24 0.27) | 94.99 (+0.51 0.23) | 95.37 (-0.01 0.19) | 94.65 (+0.83 0.27) | 94.73 |
| DTD | 53.03 (+6.50 0.63) | 34.44 (+16.09 0.92) | 38.20 (+14.78 1.06) | 53.45 (+6.17 0.52) | 54.08 (+5.73 0.58) | 53.99 (+5.60 0.58) | 56.69 (+2.73 0.49) | 53.04 (+6.48 0.62) | 60.31 |
| Euro | 61.17 (+2.13 0.47) | 60.79 (+11.39 1.77) | 60.83 (+11.91 2.01) | 62.40 (+1.35 0.43) | 64.31 (+0.19 0.44) | 63.03 (+0.94 0.43) | 60.53 (+2.25 0.43) | 61.31 (+2.06 0.48) | 64.62 |
| Air. | 32.18 (+7.16 0.60) | 25.63 (+9.27 0.68) | 26.85 (+8.92 0.62) | 33.28 (+6.17 0.60) | 34.85 (+4.79 0.83) | 33.71 (+5.80 0.63) | 37.09 (+2.36 0.37) | 32.18 (+7.16 0.59) | 40.45 |
| Dataset | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS |
| C10 | 94.89 (+0.66 0.12) | 87.68 (+7.94 1.13) | 89.68 (+5.85 0.63) | 95.05 (+0.32 0.26) | 94.22 (+0.36 0.61) | 94.34 (+0.45 0.15) | 94.82 (+0.64 0.24) | 94.81 (+0.24 0.25) | 95.56 |
| C100 | 77.27 (+1.83 0.51) | 63.50 (+15.21 0.49) | 69.05 (+9.51 0.67) | 77.96 (+0.77 0.49) | 78.27 (+1.11 0.55) | 69.32 (+0.96 0.92) | 78.08 (+1.12 0.46) | 79.66 (+0.55 0.76) | 78.60 |
| Cal101 | 94.62 (+1.64 0.52) | 94.16 (+2.52 0.27) | 94.78 (+1.67 0.25) | 94.99 (+1.35 0.47) | 95.00 (+1.33 0.47) | 95.12 (+0.15 0.19) | 95.42 (+0.80 0.51) | 97.08 (+0.27 0.45) | 96.55 |
| DTD | 53.03 (+12.93 1.02) | 57.94 (+9.92 0.96) | 60.61 (+7.38 0.96) | 60.56 (+5.81 2.12) | 64.12 (+2.50 1.53) | 61.36 (+0.00 0.00) | 60.88 (+4.91 1.07) | 66.33 (+1.80 1.68) | 66.86 |
| Euro | 61.17 (+9.87 0.67) | 76.66 (+2.16 2.37) | 78.53 (-0.57 3.00) | 75.48 (-0.55 1.83) | 77.20 (+0.29 2.53) | 67.21 (+0.25 0.28) | 60.57 (+10.41 1.11) | 82.42 (-0.43 1.37) | 71.49 |
| Air. | 32.18 (+14.15 1.34) | 41.84 (+7.15 0.88) | 40.61 (+8.51 1.78) | 39.60 (+6.85 2.16) | 40.57 (+3.95 1.65) | 45.59 (+1.86 0.66) | 43.20 (+1.74 1.12) | 46.20 (+1.33 1.56) | 49.00 |
| Dataset | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS |
| C10 | 94.89 (+0.59 0.18) | 92.41 (+2.75 0.68) | 93.42 (+2.13 1.41) | 95.17 (+0.23 0.11) | 95.39 (+0.20 0.11) | 94.64 (+0.07 0.05) | 94.97 (+0.53 0.16) | 95.81 (+0.12 0.09) | 95.60 |
| C100 | 77.27 (+3.21 0.19) | 70.57 (+9.78 0.60) | 75.39 (+4.52 0.53) | 78.19 (+2.51 0.22) | 79.60 (+1.16 0.46) | 70.81 (+0.00 0.00) | 78.54 (+1.91 0.41) | 81.87 (+0.10 0.27) | 80.25 |
| Cal101 | 94.62 (+2.86 0.16) | 95.53 (+1.56 0.29) | 96.26 (+0.45 0.29) | 95.90 (+1.51 0.42) | 96.20 (+1.23 0.41) | 95.83 (+0.00 0.00) | 96.45 (+0.92 0.22) | 97.61 (+0.03 0.09) | 97.08 |
| DTD | 53.03 (+17.40 0.44) | 64.58 (+6.73 0.87) | 67.48 (+2.91 1.09) | 66.25 (+4.47 0.96) | 68.69 (+2.96 1.06) | 63.94 (+0.00 0.00) | 62.90 (+7.17 0.49) | 71.49 (+1.39 0.65) | 70.56 |
| Euro | 61.17 (+12.86 0.82) | 80.45 (+3.30 0.34) | 85.12 (-1.21 1.49) | 80.26 (+1.54 1.11) | 83.52 (+0.56 0.50) | 69.18 (+0.19 0.36) | 60.61 (+12.58 1.00) | 87.30 (+0.43 0.56) | 74.35 |
| Air. | 32.18 (+21.41 0.55) | 47.96 (+6.46 0.47) | 49.27 (+4.46 0.66) | 46.50 (+6.65 1.25) | 43.00 (+8.34 1.33) | 47.93 (+0.00 0.00) | 47.65 (+5.36 0.94) | 55.29 (+2.25 0.64) | 53.98 |
| Dataset | ZS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS |
| C10 | 94.89 (+0.70 0.11) | 94.75 (+1.20 0.42) | 95.35 (+0.66 0.47) | 95.52 (+0.16 0.11) | 95.76 (+0.08 0.16) | 95.26 (+0.00 0.00) | 95.07 (+0.53 0.12) | 96.04 (+0.23 0.18) | 95.67 |
| C100 | 77.27 (+4.28 0.13) | 74.89 (+6.73 0.43) | 79.65 (+1.60 0.42) | 79.13 (+2.46 0.15) | 80.40 (+1.45 0.28) | 73.08 (+0.00 0.00) | 78.95 (+2.60 0.20) | 82.93 (+0.09 0.19) | 81.41 |
| Cal101 | 94.62 (+2.89 0.10) | 95.99 (+1.48 0.24) | 97.09 (+0.27 0.08) | 96.41 (+1.21 0.28) | 96.87 (+0.75 0.21) | 96.08 (+0.20 0.19) | 96.64 (+0.90 0.16) | 97.95 (-0.01 0.12) | 97.36 |
| DTD | 53.03 (+19.93 0.44) | 69.00 (+5.25 0.45) | 74.12 (-0.75 0.84) | 69.44 (+5.04 0.60) | 72.93 (+2.23 0.62) | 67.14 (-0.05 0.28) | 65.07 (+7.76 0.74) | 75.43 (+1.08 0.81) | 72.95 |
| Euro | 61.17 (+13.93 0.60) | 81.39 (+2.49 0.33) | 89.47 (-3.98 1.44) | 82.39 (+0.74 0.86) | 86.81 (+0.65 0.30) | 72.78 (+0.58 1.66) | 60.73 (+14.40 0.83) | 91.19 (-0.19 0.27) | 75.44 |
| Air. | 32.18 (+24.43 0.53) | 52.40 (+5.47 0.57) | 56.20 (+0.97 0.34) | 51.25 (+6.05 0.54) | 47.66 (+8.30 0.82) | 49.58 (+0.00 0.00) | 51.19 (+5.59 0.81) | 60.15 (+2.87 0.53) | 56.62 |
| -shot | ZS+DEFTS | SimpleShot | Linear Probe | Tip-Adapter | APE | TIP-X | TAMP+ZS | LDA+ZS | DEFTS alone |
| Model Backbone: ViT-B/32 Backbone | |||||||||
| 64.56 (+2.10 0.48) | 40.45 (+16.26 1.23) | 42.21 (+15.60 1.25) | 65.01 (+1.72 0.46) | 65.78 (+1.07 0.42) | 65.27 (+1.47 0.45) | 64.92 (+0.95 0.36) | 64.66 (+2.01 0.47) | 65.08 | |
| 64.56 (+2.12 0.58) | 52.33 (+16.12 1.68) | 52.56 (+15.96 1.50) | 66.74 (+0.44 0.24) | 67.66 (+0.22 0.17) | 63.02 (+1.77 0.27) | 65.73 (+1.09 0.43) | 67.31 (+0.39 0.40) | 67.90 | |
| 64.56 (+5.36 0.92) | 61.45 (+10.25 1.08) | 63.77 (+7.37 1.10) | 68.87 (+1.59 0.38) | 69.67 (+1.34 0.39) | 64.72 (+0.54 0.15) | 68.00 (+2.12 0.51) | 72.13 (+0.76 0.34) | 70.37 | |
| 64.56 (+8.47 1.09) | 67.41 (+6.88 0.76) | 71.21 (+2.30 0.82) | 71.87 (+2.27 0.32) | 73.06 (+1.76 0.29) | 66.51 (+0.05 0.07) | 69.32 (+3.57 0.70) | 76.24 (+0.47 0.13) | 72.70 | |
| 64.56 (+10.09 1.20) | 70.89 (+5.02 0.59) | 76.04 (-0.24 0.54) | 74.02 (+2.03 0.27) | 75.34 (+1.35 0.23) | 68.96 (+0.12 0.09) | 70.41 (+4.22 0.73) | 77.27 (+1.42 0.26) | 74.38 | |
| Base method | |||||
| ZS | 3.03 / 12% | 2.36 / 9% | 6.33 / 25% | 8.90 / 35% | 10.04 / 40% |
| SimpleShot | 18.37 / 37% | 15.30 / 43% | 8.48 / 32% | 5.54 / 26% | 4.00 / 22% |
| Linear probe | 16.43 / 37% | 14.07 / 41% | 6.35 / 26% | 2.61 / 14% | 0.37 / 2% |
| Tip-Adapter | 2.69 / 11% | 0.76 / 3% | 2.16 / 10% | 2.79 / 15% | 2.69 / 16% |
| APE | 2.07 / 9% | 0.41 / 2% | 1.64 / 8% | 2.29 / 13% | 2.11 / 13% |
| TIP-X | 2.48 / 10% | 1.27 / 5% | 0.52 / 2% | 0.03 / 0% | 0.43 / 2% |
| Base X | X | DEFTS | TAMP | DEFTS TAMP |
| ZS | 74.65 | 3.03 ( 0.46) | 1.56 ( 0.34) | 1.47 ( 0.18) |
| SimpleShot | 50.88 | 18.37 ( 1.25) | 11.96 ( 0.84) | 6.41 ( 0.56) |
| Linear Probe | 55.27 | 16.43 ( 1.15) | 10.98 ( 0.80) | 5.45 ( 0.48) |
| Tip-Adapter | 75.05 | 2.69 ( 0.43) | 1.25 ( 0.32) | 1.44 ( 0.17) |
| TIP-X | 75.29 | 2.48 ( 0.41) | 1.09 ( 0.30) | 1.39 ( 0.17) |
| Method | Parameter(s) | Fixed value |
| Tip-Adapter | ||
| TIP-X | ||
| APE | ||
| LDA + ZS | ||
| TAMP | ||
| TAMP + ZS |
| Method | Parameter(s) | Grid(s) | combos |
| Tip-Adapter | 72 | ||
| TIP-X | 504 | ||
| APE | 432 | ||
| LDA + ZS | 9 | ||
| TAMP | 21 | ||
| TAMP+ZS | 441 |
Few-Shot Image Classification
Few-shot image classification learns to recognize visual categories from only a small number of labeled examples.
See all 78 papers