July 21, 2026
Background and Objective: Wound image classification is often treated as a task-specific supervised learning problem, requiring substantial amounts of manually labelled data and retraining when the label space or deployment setting changes. This study evaluated whether small multimodal language models (SMLMs) can provide a training-free alternative for wound classification through retrieval-based in-context learning (ICL).
Methods: Experiments used two public wound-image datasets: the Kaggle wound dataset (1469 images, 10 classes) and the Medetec dataset (560 images, 9 classes). Eleven SMLMs from the Qwen 3.5, Ministral 3, and Gemma 4 families were evaluated under zero-shot prompting and few-shot prompting with random support examples, embedding-based \(k\)-nearest-neighbour (\(k\)NN) retrieval, and \(k\)NN retrieval followed by maximal marginal relevance reranking (MMR). Retrieval-only weighted-\(k\)NN controls, support-set reduction experiments, and support-context size sweeps were used to assess the effects of retrieval, model scale, and prompt length.
Results: Query-conditioned ICL consistently outperformed zero-shot and random few-shot prompting. On the Kaggle dataset, the best result was achieved by Qwen 3.5 27B with \(k\)NN+MMR, reaching 0.872 accuracy and 0.871 F1 score. On Medetec, Qwen 3.5 27B with \(k\)NN+MMR reached 0.678 accuracy and 0.670 F1. Larger models exceeded matched weighted-\(k\)NN controls, indicating use of retrieved examples beyond nearest-neighbour voting. Retrieval-based ICL degraded modestly under support-set reduction, and most gains saturated with 8–10 support images.
Conclusions: Retrieval-based ICL allows SMLMs to perform adaptable wound image classification without task-specific retraining. Compact retrieved contexts may support practical and privacy-conscious deployment, although performance remains dependent on model scale, retrieval strategy, and dataset difficulty.
Computer vision is playing an increasingly important role in medical imaging [1], yet many high-performing systems still follow a task-specific paradigm: a dataset is collected and annotated for a single objective, a dedicated model is trained or fine-tuned, and the process is repeated whenever the task definition, label set, or deployment context changes [2], [3]. Although this approach can yield strong performance, it also requires substantial annotation effort and computational resources, particularly in settings where expert labels are scarce or practical requirements evolve rapidly [4]. Recent advances in large multimodal language models (LMLMs) suggest an alternative to conventional supervised learning [5]–[8]. Modern LMLMs can be applied in a zero-shot setting, in which the model receives only task instructions at inference time and requires neither annotated training data nor task-specific fine-tuning [9], [10]. In practice, however, this approach often yields moderate to good performance, depending on the complexity and specificity of the task [6], [11], [12].
The performance of LMLMs on specific tasks can be improved through adaptation strategies such as fine-tuning and in-context learning (ICL) [10], [13], [14]. In fine-tuning, model parameters are updated using task-specific training data, either across the full model or through lighter-weight adaptation schemes, which can yield strong performance when sufficient annotations and computational resources are available [15], [16]. In contrast, in ICL, a small number of labelled examples are provided directly in the prompt at inference time rather than being learned through training [13], [17]. Such prompting-based approaches are especially appealing in medicine because they allow for rapid adaptation with minimal task-specific data and without requiring a separate training pipeline for each application [18], [19].
A further practical issue is the choice of model scale. In deployment settings, one often distinguishes between smaller models that can run locally on consumer or edge hardware and larger models that typically require server‑side or cloud inference. This distinction is only approximate, since the boundary is continuously shifting with developments in hardware, model architecture, and optimisation methods such as quantisation, pruning, and distillation [20]–[22]. In this work, we use the term small multimodal language models (SMLMs) in a deployment‑oriented sense, referring to models suitable for local or edge‑based inference rather than defining the term by a fixed parameter threshold. This deployment distinction is closely linked to an expected performance tradeoff: scaling-law studies show that, within comparable model families, performance improves predictably with model size, data, and training compute. However, size alone does not determine performance, and smaller models can be competitive when they are better trained or optimised [23], [24]. Thus, even though larger models are attractive when maximum task performance is the main objective, the dependence on server-side inference can be difficult to justify in privacy-sensitive settings, such as internal documentation, governmental workflows, or medical records, where data cannot always be sent to external model providers because of confidentiality, regulatory, or data-governance constraints [25]–[27]. Locally deployable SMLMs are therefore a realistic alternative [28], but their usefulness depends on how much performance is lost relative to larger remote models, and whether that loss is acceptable for the intended application.
These concerns are particularly relevant for wound analysis and classification. Wound images are clinically sensitive, visually heterogeneous, and often collected under variable lighting, distance, body location, and image-quality conditions. Additionally, labels usually require wound-care expertise and may differ across classification tasks such as wound type, tissue composition, infection, or referral urgency [29]–[31]. This makes the combination of SMLMs and ICL especially attractive: local inference can reduce the need to transmit patient images to external servers, while in-context examples can specify the target label set and decision criteria at inference time without retraining a separate model for every wound-related task [18], [28], [32], [33]. In such a setting, the goal is not necessarily to show that SMLMs outperform or match the performance of larger remote models, but to test whether example-guided local models can provide a useful privacy-preserving compromise between task adaptability, computational cost, and classification performance.
In this work, we examine whether small multimodal language models can serve as a practical solution for wound classification when task-specific training data is limited. Using open wound-image datasets, we evaluate zero-shot and few-shot prompting across eleven models from the Qwen 3.5 [34], Ministral 3 [35], and Gemma 4 [36] families, covering a range of SMLM scales under a common prompting protocol. We compare three strategies for constructing the few-shot context: random support sampling, embedding-based \(k\)-nearest-neighbour (\(k\)NN) retrieval, and \(k\)NN retrieval followed by maximal marginal relevance reranking (MMR). To separate the contribution of in-context learning from that of retrieval itself, we also compare each retrieval-augmented prompting condition against a matched retrieval-only weighted-\(k\)NN baseline. Finally, we examine how progressively reducing the support/training set degrades the accuracy of retrieval-augmented prompting methods and conventional supervised classifiers, and evaluate how the size of the support context (number of support images) affects the performance of SMLMs.
Prior research on wound image analysis has predominantly framed the task as a supervised computer vision problem, focusing on wound classification, detection, segmentation, tissue analysis, and measurement, usually with models trained for a specific wound-related endpoint and evaluated on a fixed label space [29], [31], [37], [38]. Earlier studies typically employed handcrafted colour, texture, or deep-feature representations with conventional classifiers [38], [39], while later work has moved toward CNN-based and deep ensemble methods for tasks such as infection, ischaemia, or wound-type classification [40]–[42]. A parallel line of work focuses on wound localisation, segmentation, and measurement, including tissue segmentation [37], [43]–[45]. Multimodal wound classification models have also been proposed, for instance by combining wound images with anatomical location information; however, these approaches still operate within a supervised learning framework and require training for predefined tasks [46], [47]. Similarly, work on surgical wound infection assessment and postoperative monitoring has mostly focused on models designed for a specific clinical endpoint, such as identifying infection risk from wound images, patient-reported symptoms, or other structured inputs [30], [48], [49]. Overall, the existing literature demonstrates that image-based wound assessment is an active research area, but it remains dominated by task-specific supervised systems.
Large language models and foundation models provide a possible way to move beyond fully task-specific wound-analysis pipelines. In medical imaging, recent surveys discuss pretrained models as reusable backbones for transfer learning, domain adaptation, and annotation-efficient learning [50], [51]. Some studies have tested whether general-purpose visual representations transfer to medical images: for example, DINOv2 [52] has been evaluated on radiology benchmarks using settings such as \(k\)NN classification, few-shot learning, linear probing, and fine-tuning, showing that natural-image pretraining can provide useful features for some medical tasks [53]. Vision–language models represent a significant development in this area, as exemplified by CLIP, which introduced shared image–text embeddings that support zero-shot classification and image retrieval [54]. Biomedical variants of CLIP, such as PubMedCLIP, MedCLIP, and BiomedCLIP adapt this idea to medical image-text data [55]–[57]. For wound classification, this suggests that both general and medical-pretrained image or image-text representations may be useful when wound-specific annotations are limited.
A related line of work investigates whether pretrained multimodal models can be adapted through examples at inference time (in-context learning). Med‑Flamingo was one of the earliest multimodal models developed specifically for medical applications, showing that few-shot multimodal prompting can be used for medical visual question answering [18]. Later work tested the same idea in more diagnostic classification settings. Ferber et al. showed that in-context examples improve GPT-4V performance on cancer histopathology tasks and can reach the level of specialist classifiers in some settings [33]. Similar evidence has been reported in ophthalmology: Ayhan et al. reported that Gemini 1.5 Pro with ICL achieved diabetic retinopathy detection accuracy and F1 scores close to a supervised algorithm [32], and Choi and Yoo demonstrated that example-based prompting improved GPT-4o performance across several ophthalmic image-interpretation tasks [58]. In recent oncology work, Shrestha et al. compared several large multimodal language models under ICL across datasets such as MHIST, PatchCamelyon, and HAM10000, showing consistent gains from few-shot prompting while also indicating that fully fine-tuned systems still represent a strong ceiling [59]. These studies suggest that ICL can be useful in medical contexts when only a small number of labelled examples are available. However, the evidence is drawn primarily from pathology, oncology, and ophthalmology, and many studies rely on large externally hosted models.
Smaller model scales are particularly advantageous for wound classification. Wound images may be collected in hospitals, outpatient clinics, or home-care settings, and they often contain sensitive clinical information. In such cases, sending images to an external model provider may be challenging because of privacy constraints [27]. Smaller models are therefore relevant not only because they are cheaper or faster, but because they can be run locally. Surveys of small and on-device language models describe these models as useful for lower-cost, lower-latency, and resource-constrained deployment [20]–[22], and similar arguments have been made for small language models in healthcare [28]. At the same time, local deployment is useful only if the performance loss is acceptable.
Few-shot prompting (or in-context learning) may benefit smaller models by providing task-specific information without fine-tuning or remote inference, but it raises another practical question: which examples should be shown to the model? In visual and multimodal ICL, performance can depend strongly on the selected examples, their order, and the retrieval strategy used to construct the prompt [60]–[63]. If the support examples are poorly matched to the query, the model may receive little useful task information, and if they are too similar to each other, the prompt may contain repeated evidence rather than a useful coverage of the class variation. A common solution is retrieval-based selection, where the support examples are chosen by nearest-neighbour search in an embedding space, often using a visual or vision-language encoder such as CLIP [54]. Such retrieval-based strategies have been shown to improve over random example selection in visual ICL and are also used in multimodal ICL systems such as RICES [13], [62], [63]. However, nearest-neighbour retrieval remains a limited criterion: it can select examples that are redundant, overly prototypical, or similar to the query for reasons irrelevant to the target class. This is especially important in fine-grained image tasks, where small visual differences may define the label. Recent work, therefore, explores support-selection strategies that go beyond simple similarity, including diversity-aware context search, learned retrievers, and counterfactual or contrastive example selection [64]–[67].
This study does not include confidential information. All research procedures were conducted exclusively on publicly accessible, anonymised patient data, in compliance with all relevant ethical standards.
Let \(\mathcal{D} = \{(I_j, y_j)\}_{j=1}^{N}\) denote an image corpus, where \(I_j\) is an image and \(y_j\) is its class label, belonging to a set of dataset labels \(\mathcal{Y}\). To evaluate classification performance, \(\mathcal{D}\) is divided into a support set \(\mathcal{D}_{\mathrm{sup}}\) and an evaluation set \(\mathcal{D}_{\mathrm{eval}}\). Given a query image \(I_q \in \mathcal{D}_{\mathrm{eval}}\), we construct a prompt \(\mathcal{P}_q\) containing the query image and task text. Optionally, the prompt also includes a retrieved support context \(\mathcal{R} \subseteq \mathcal{D}_{\mathrm{sup}}\). The multimodal model \(\Phi\) then predicts a class label \(\hat{y}_q\) from this input. Inference can therefore be written as \[\hat{y}_q = \Phi(\mathcal{P}_q, \mathcal{R}).\] In the zero-shot setting, \(\mathcal{R} = \varnothing\), whereas in the ICL setting, \(\mathcal{R}\) contains a set of retrieved, labelled support examples. Following prior work on multimodal in-context learning [33], [67], we used embedding-based retrieval to construct this support context before passing it to the downstream classifier. Figure 1 provides an overview of the full ICL pipeline.
Experiments were performed on two wound‑image datasets. The first was the Kaggle dataset “Collected and Categorized Wound Images Dataset”1, which comprised 10 classes: Abrasions, Bruises, Burns, Cut, Diabetic Wounds, Laceration, Normal, Pressure Wounds, Surgical Wounds, and Venous Wounds. Before defining the final splits, half of the images were removed as they were mirrored duplicates of existing samples. The resulting Kaggle wound image corpus comprised 1469 images and was divided into a support split and an evaluation split. The evaluation split was balanced, containing 25 randomly selected images per class and 250 images in total, while the support split contained the remaining 1219 images.
The second dataset was constructed from the Medetec Wound Database2. After excluding low-count categories (less than 15 images), the Medetec corpus contained 560 images across 9 classes: Burns or Scalds, Diabetic Foot Ulcers, Extravasation Injuries, Infected or Necrotic Toes, Meningitis Skin Lesions, Miscellaneous, Orthopaedic Cases, Pressure Ulcers, and Venous or Arterial Ulcers. As with the Kaggle dataset, the Medetec dataset was randomly divided into a support split and a balanced evaluation split. The evaluation set contained 10 images per class, for a total of 90 images; the remaining 470 images were used in the support set.
For both datasets, the support splits served as the retrieval pools for few-shot context construction, and the evaluation splits were kept fixed for model assessment. Figure 2 shows the class distributions for the Kaggle dataset (left) and the Medetec dataset (right).
For query-conditioned retrieval, the frozen OpenAI CLIP ViT-B/32 image encoder [54] was used to map each image to a 512-dimensional embedding vector. For each support image \(I_j \in \mathcal{D}_{\mathrm{sup}}\), an embedding was precomputed as \[z_{j} = f_I(I_j),\] and for each query image \(I_q \in \mathcal{D}_{\mathrm{eval}}\), an analogous embedding was computed as \[z_{q} = f_I(I_q).\] To place all representations on a common scale, each embedding was L2-normalised, \[\hat{z}_i = \frac{z_i}{\lVert z_i \rVert_2},\] so that angular proximity directly reflected semantic similarity in the shared feature space. Each candidate’s support image was then scored using cosine similarity, \[s(q,i) = \hat{z}_q^{\top} \hat{z}_i.\] This shared embedding space, therefore, served as the basis for all query-conditioned support selection. Three strategies were considered for constructing the few-shot support context: random retrieval, \(k\)-nearest-neighbour (\(k\)NN) retrieval (or Retrieval-based In-Context Example Selection, RICES [13]), and \(k\)NN retrieval augmented with maximal marginal relevance (MMR) [68].
Random retrieval. Under random retrieval, support examples were sampled uniformly from \(\mathcal{D}_{\mathrm{sup}}\) without conditioning on the query image, with a unique random seed used for each request.
kNN retrieval. Given a query image \(I_q\) and a target context size \(K\), \(k\)NN retrieval constructs the support context by selecting the \(K\) support images with the highest cosine-similarity scores \(s(q,i)\).
kNN+MMR retrieval. To encourage diversity among relevant support examples, maximal marginal relevance was also used. In the \(k\)NN+MMR strategy, a candidate pool \(\mathcal{C}_q\) of the top \(M\) nearest neighbours of the query was retrieved according to \(s(q, i)\), where \(M > K\) and \(K\) denotes the final context size. From \(\mathcal{C}_q\), the highest-similarity item was chosen. Each subsequent example, \(i_t\), was selected from the remaining candidates in \(\mathcal{C}_q\) as \[i_t = \arg\max_{i \in \mathcal{C}_q \setminus \mathcal{R}_{t-1}} \left[ \lambda s(q,i) - (1-\lambda) \max_{j \in \mathcal{R}_{t-1}} \hat{z}_i^{\top} \hat{z}_j \right],\] where \(\lambda \in [0,1]\) controls the trade-off between relevance and diversity. In the current study, \(\lambda\) was set to 0.7.
We evaluated eleven multimodal language models from three families: Qwen 3.5 (0.8B, 2B, 4B, 9B, and 27B) [34], Ministral 3 (3B, 8B, and 14B) [35], and Gemma 4 (E2B, E4B, and 26B A4B) [36]. For consistency across experiments, all models were run with an 8192-token context window, thinking disabled, and temperature set to zero to make the outputs deterministic.
Experiments were run on a MacBook Pro with an Apple M4 Pro chip and 24 GB unified memory. The Qwen 3.5 checkpoints used Q3_K_XL quantisation. For Ministral 3, the 3B and 8B variants used Q8_0, whereas the 14B variant used
Q4_K_XL. For Gemma 4, the E2B and E4B variants used Q8_0, whereas the 26B A4B variant used UD-IQ3_S. Because all evaluated systems were multimodal, each model was paired with a vision projector; Gemma 4 and Ministral
3 used BF16 projectors, whereas Qwen 3.5 used an F32 projector.
All models were queried using a classification prompt so that differences in performance could be attributed primarily to model capacity and support-selection strategy rather than to prompt wording. In every condition, the query image was paired with a short instruction that asked the model to assign exactly one dataset label and return only that label string. For the Kaggle dataset class labels were: Abrasions, Bruises, Burns, Cut, Diabetic Wounds, Laceration, Normal, Pressure Wounds, Surgical Wounds, and Venous Wounds; for the Medetec dataset: Burns or Scalds, Diabetic Foot Ulcers, Extravasation Injuries, Infected or Necrotic Toes, Meningitis Skin Lesions, Miscellaneous, Orthopaedic Cases, Pressure Ulcers, and Venous or Arterial Ulcers.
In the zero-shot setting, the prompt consisted only of the task instruction and the query image, as illustrated in Figure 3. This setup measured each model’s ability to classify wound images without any in-context visual references from the support set.
In the few-shot setting, the prompt began with a brief instruction informing the model that labelled example images would be shown before the final query. The prompt then included \(K\) retrieved support examples, each presented as an image–label pair in the form “Example image for class \(y_i\)”, followed by the support image and its class label. After these support examples, the same query-classification block used in the zero-shot condition was appended, as shown in Figure 4. For random retrieval and standard \(k\)NN retrieval, \(K\) support examples were taken directly from the selected support set. For \(k\)NN+MMR retrieval, the final prompt still contained \(K\) examples, but these were reranked from an initial pool of \(M\) nearest neighbours before insertion into the prompt.
To assess how closely retrieval-augmented SMLM predictions aligned with the retrieved embedding-space neighbourhood during ICL [69], [70], paired comparisons were conducted between each model and a retrieval-only control. The same diagnostics were applied to both \(k\)NN and \(k\)NN+MMR retrieval. For standard \(k\)NN, the global weighted-\(k\)NN baseline was used as the control. For \(k\)NN+MMR, the retrieval-only control was recomputed on the final reranked support set, so that the control reflected the exact diversity-filtered context shown to the model.
The weighted-\(k\)NN baseline was treated as a standard non-parametric classifier operating directly in the CLIP embedding space. For a query \(q\), let \(\mathcal{N}_K(q)\) denote the \(K\) labelled support images in \(\mathcal{D}_{\mathrm{sup}}\) with the largest cosine similarities to the query. The class score was the weighted sum of neighbour labels, and the predicted class was \[\hat{y}_{q}^{\mathrm{kNN}} = \arg\max_{c \in \mathcal{Y}} \sum_{i \in \mathcal{N}_K(q)} w(q,i)\mathbf{1}[y_i=c], \qquad w(q,i)=\frac{\max\{s(q,i),0\}}{\sum_{j \in \mathcal{N}_K(q)}\max\{s(q,j),0\}},\] Here, \(c\) is a candidate class from the dataset-specific label set \(\mathcal{Y}\), \(y_i\) is neighbour \(i\)’s label, \(\mathbf{1}[y_i=c]\) is the class-membership indicator, and \(w(q,i)\) is the normalised non-negative cosine-similarity weight. For the matched \(k\)NN+MMR control, the same weighted-voting rule was applied to the final MMR-reranked neighbourhood shown in the prompt.
Statistical significance was assessed using accuracy, accuracy deltas, and a McNemar test, applied to correctness pairs to determine whether the SMLM significantly outperformed the baseline [71]. To further characterise behavioural alignment, raw prediction agreement and Cohen’s \(\kappa\) were computed, with the latter adjusting for agreement expected by chance [72]. Prediction alignment with the retrieved support labels was quantified using three match-rate diagnostics: the top-1 match rate, the majority-label match rate, and the any-support match rate. To distinguish cases in which the SMLM succeeded on the same items as the retrieval-only control from those in which it added value beyond retrieval, a paired \(2\times2\) correctness table was also analysed for each model–control comparison. From this table, two conditional correctness statistics were computed: \(P(\mathrm{SMLM\;correct}\mid\mathrm{control\;correct})\), which quantifies how often the SMLM preserves retrieval-only successes, and \(P(\mathrm{SMLM\;correct}\mid\mathrm{control\;wrong})\), which quantifies how often the SMLM “rescues” retrieval-only failures. Fisher’s exact test and the associated odds ratio were used to assess whether SMLM correctness was positively associated with control correctness beyond chance [73].
In these experiments, we used \(K=10\) support images for \(k\)NN retrieval and \(K=10\) with \(M=30\) for \(k\)NN+MMR retrieval.
To assess how the size of the support set \(\mathcal{D}_{\mathrm{sup}}\) affects retrieval performance, we followed the procedure described by Xiong et al. [67]. In this procedure, the few-shot classification experiments are repeated for all retrieval methods using reduced support pools containing approximately 75% (914 for Kaggle, 353 for Medetec), 50% (610 for Kaggle, 235 for Medetec), and 25% (305 for Kaggle, 118 for Medetec) of the full support set. The full support set served as the benchmark. For each fraction, five subsets were sampled with different random seeds, while the evaluation set was kept fixed. To ensure fair comparisons, the same seed-specific subsets were used across all model and retrieval-method combinations within each fraction on both datasets. Performance on \(\mathcal{D}_{\mathrm{eval}}\) was then summarised as mean \(\pm\) standard deviation over the five runs.
Two descriptive statistics were computed for each sampled support subset to help assess whether changes in accuracy were more plausibly attributable to class imbalance or to reduced embedding-space diversity. Let \(\{(I_i, y_i)\}_{i=1}^{n} \subseteq \mathcal{D}_{\mathrm{sup}}\) denote a sampled support subset of size \(n\), and let \(\mathcal{S} = \{(\hat{z}_i, y_i)\}_{i=1}^{n}\) be the corresponding set of embedding-label pairs, where \(\hat{z}_i\) is the L2-normalized CLIP embedding of image \(I_i\).
First, class-balance evenness was measured using the normalised Shannon entropy of the empirical class distribution, with larger values indicating a more even spread of support examples across \(C\) classes. If \(n_c\) is the number of support examples from class \(c\) and \(p_c = n_c / n\), then \[E_{\mathrm{class}} = - \frac{1}{\log C} \sum_{c=1}^{C} p_c \log p_c.\]
Second, the geometric diversity of the subset was measured through the effective rank of its embedding covariance spectrum. Let \[\Sigma_{\mathcal{S}} = \frac{1}{n} \sum_{i=1}^{n} (\hat{z}_i - \bar{z})(\hat{z}_i - \bar{z})^{\top}\] be the covariance matrix of the subset embeddings, where \(\bar{z} = \frac{1}{n}\sum_{i=1}^{n} \hat{z}_i\) is the sample mean. If \(\{\sigma_m\}_{m=1}^{d}\) are the eigenvalues of \(\Sigma_{\mathcal{S}}\), we normalize them as \[\tilde{\sigma}_m = \frac{\sigma_m}{\sum_{r=1}^{d} \sigma_r},\] and define the effective rank as \[r_{\mathrm{eff}} = \exp\left(-\sum_{m=1}^{d} \tilde{\sigma}_m \log \tilde{\sigma}_m \right).\] A larger effective rank indicates that variance is distributed across more dimensions, suggesting broader representational coverage of the support pool. For each support fraction, both \(E_{\mathrm{class}}\) and \(r_{\mathrm{eff}}\) were computed across the five seeds as mean \(\pm\) standard deviation.
To evaluate how data scarcity affects ICL in comparison with conventional supervised methods, we additionally trained deep learning image classifiers on the same support sets used for ICL and repeated the experiment on subsets of both datasets. Each support pool was split internally into an 80/20 train/validation subset, and final performance was measured on the corresponding \(\mathcal{D}_{\mathrm{eval}}\) sets. We evaluated four popular ImageNet-pretrained backbones: ViT-B/16 [74], ConvNeXt-Tiny [75], EfficientNetV2-S [76], and ResNet50 [77]. For each backbone, we compared full fine-tuning with a head-only transfer-learning setting in which the pretrained feature extractor was frozen and only the classification head was updated. For ViT-B/16, we additionally evaluated a LoRA variant (\(r=8\), \(\alpha=16\), dropout \(0.05\)) in which the pretrained ViT weights were frozen and only lightweight LoRA adapters plus the classification head were trained [16]. All models were trained with AdamW optimiser, weight decay \(10^{-4}\), batch size of 16 for 30 epochs with early stopping. Learning rates ranged from \(1\times10^{-5}\) to \(1\times10^{-3}\) depending on backbone and tuning mode. Training images were resized to the model input size and augmented with random horizontal flips (\(p=0.5\)), random rotations within \(\pm8^\circ\), and colour jitter (brightness \(0.12\), contrast \(0.12\), saturation \(0.08\)), followed by ImageNet normalisation; validation and test images were only resized and normalised.
To measure how context size affects both classification performance and inference cost, we conducted a support-count sweep in which the number of support images shown to the SMLM during ICL was varied while the support pool, evaluation set, prompt template, and model settings were kept fixed. We evaluated context sizes from \(K=2\) to \(K=20\) in steps of two images. For each condition, we report accuracy, the mean model-reported input token count, and the average response time per processed request.
Table ¿tbl:tab:benchmark95results? shows the results on the Kaggle wound dataset. Notably, few-shot prompting with query-conditioned retrieval consistently improved performance over zero-shot prompting by a substantial margin, whereas random few-shot context provided only modest gains. This indicates that the benefits from ICL depend largely on the retrieval strategy of support examples. The strongest overall results were obtained by Gemma 4 26B A4B and the larger Qwen 3.5 models: Gemma 4 26B A4B reached 0.868 accuracy under \(k\)NN (95% CI [0.824, 0.908]), while Qwen 3.5 27B and 9B reached 0.872 and 0.868 under \(k\)NN+MMR (95% CIs [0.828, 0.912] and [0.824, 0.908], respectively). By contrast, zero-shot performance was much lower and more variable, ranging from 0.128 for Qwen 3.5 0.8B (95% CI [0.088, 0.172]) to 0.648 for Gemma 4 26B A4B (95% CI [0.588, 0.704]).
The effect of query-specific retrieval relative to zero-shot and random few-shot prompting was especially pronounced for several smaller and mid-sized models. For example, Qwen 3.5 2B improved from 0.280 (95% CI [0.228, 0.336]) in the zero-shot setting to 0.748 (95% CI [0.696, 0.796]) with \(k\)NN+MMR, and Qwen 3.5 4B improved from 0.316 (95% CI [0.260, 0.376]) to 0.788 (95% CI [0.732, 0.836]). Similar gains were also observed for Ministral 3 14B, which increased from 0.364 (95% CI [0.304, 0.424]) to 0.752 (95% CI [0.692, 0.804]) under \(k\)NN, and for Gemma 4 E4B, which rose from 0.400 (95% CI [0.336, 0.464]) to 0.736 (95% CI [0.680, 0.788]). Relative to the retrieval-only weighted-\(k\)NN baseline, which achieved 0.708 accuracy (95% CI [0.648, 0.764]), the strongest query-conditioned ICL configurations achieved clear gains, whereas all zero-shot settings and several smaller retrieval-augmented models remained below this benchmark.
4pt
l|cc|cc|cc|cc Model & & & &
& Acc. & F1 & Acc. & F1 & Acc. & F1 & Acc. & F1
Qwen 3.5 & & & & & & & &
27B & 0.580 & 0.536 & 0.636 & 0.624 & 0.860 & 0.862 & 0.872 & 0.871
9B & 0.544 & 0.510 & 0.640 & 0.615 & 0.836 & 0.833 & 0.868 & 0.865
4B & 0.316 & 0.241 & 0.456 & 0.422 & 0.780 & 0.780 & 0.788 & 0.789
2B & 0.280 & 0.173 & 0.324 & 0.266 & 0.704 & 0.680 & 0.748 & 0.726
0.8B & 0.128 & 0.078 & 0.196 & 0.155 & 0.328 & 0.327 & 0.300 & 0.293
Ministral 3 & & & & & & & &
14B & 0.364 & 0.348 & 0.448 & 0.447 & 0.752 & 0.758 & 0.708 & 0.712
8B & 0.308 & 0.296 & 0.440 & 0.424 & 0.656 & 0.650 & 0.656 & 0.653
3B & 0.308 & 0.251 & 0.392 & 0.334 & 0.548 & 0.525 & 0.580 & 0.558
Gemma 4 & & & & & & & &
26B A4B & 0.648 & 0.643 & 0.652 & 0.647 & 0.868 & 0.868 & 0.864 & 0.864
E4B & 0.400 & 0.342 & 0.424 & 0.405 & 0.736 & 0.732 & 0.716 & 0.706
E2B & 0.304 & 0.262 & 0.332 & 0.296 & 0.456 & 0.434 & 0.444 & 0.426
Weighted-\(k\)NN & & & &
Table ¿tbl:tab:medetec95benchmark95results? shows the corresponding results on the Medetec dataset. The same broad pattern was observed, although absolute performance was lower than on the Kaggle dataset. The strongest overall result was obtained by Qwen 3.5 27B under \(k\)NN+MMR, reaching 0.678 accuracy. Other strong results were obtained by Qwen 3.5 4B, with 0.622 accuracy under \(k\)NN+MMR, Qwen 3.5 9B, with 0.611 accuracy under \(k\)NN+MMR, and Gemma 4 26B A4B, with 0.611 accuracy under \(k\)NN+MMR. By contrast, zero-shot performance was considerably lower, ranging from 0.089 for Qwen 3.5 0.8B (95% CI [0.033, 0.156]) to 0.400 for Gemma 4 26B A4B (95% CI [0.300, 0.500]). Random few-shot prompting produced only modest and inconsistent gains, and query-conditioned retrieval produced large gains across most models. Qwen 3.5 2B improved from chance-level 0.144 accuracy (95% CI [0.078, 0.222]) in the zero-shot setting to 0.567 (95% CI [0.467, 0.667]) with \(k\)NN+MMR, while Qwen 3.5 4B improved from 0.244 (95% CI [0.156, 0.344]) to 0.622 (95% CI [0.522, 0.722]). Similar improvements were observed for other model families: Ministral 3 14B increased from 0.244 accuracy (95% CI [0.156, 0.333]) to 0.500 (95% CI [0.400, 0.600]) under both \(k\)NN and \(k\)NN+MMR, and Gemma 4 E4B increased from 0.256 (95% CI [0.167, 0.344]) to 0.533 (95% CI [0.433, 0.644]) under \(k\)NN. As in the Kaggle dataset, the best retrieval-augmented multimodal configurations outperformed the retrieval-only weighted-\(k\)NN baseline, which reached 0.467 accuracy (95% CI [0.367, 0.567]).
4pt
l|cc|cc|cc|cc Model & & & &
& Acc. & F1 & Acc. & F1 & Acc. & F1 & Acc. & F1
Qwen 3.5 & & & & & & & &
27B & 0.367 & 0.321 & 0.389 & 0.342 & 0.633 & 0.629 & 0.678 & 0.670
9B & 0.333 & 0.303 & 0.278 & 0.251 & 0.600 & 0.589 & 0.611 & 0.614
4B & 0.244 & 0.142 & 0.333 & 0.320 & 0.578 & 0.562 & 0.622 & 0.601
2B & 0.144 & 0.104 & 0.222 & 0.196 & 0.533 & 0.528 & 0.567 & 0.573
0.8B & 0.089 & 0.031 & 0.167 & 0.112 & 0.244 & 0.220 & 0.200 & 0.176
Ministral 3 & & & & & & & &
14B & 0.244 & 0.158 & 0.356 & 0.286 & 0.500 & 0.480 & 0.500 & 0.477
8B & 0.244 & 0.163 & 0.344 & 0.306 & 0.444 & 0.403 & 0.456 & 0.427
3B & 0.200 & 0.129 & 0.189 & 0.165 & 0.322 & 0.293 & 0.389 & 0.387
Gemma 4 & & & & & & & &
26B A4B & 0.400 & 0.378 & 0.422 & 0.428 & 0.567 & 0.561 & 0.611 & 0.606
E4B & 0.256 & 0.217 & 0.300 & 0.244 & 0.533 & 0.508 & 0.511 & 0.489
E2B & 0.156 & 0.128 & 0.133 & 0.119 & 0.367 & 0.324 & 0.289 & 0.272
Weighted-\(k\)NN & & & &
Taken together, the Kaggle and Medetec results show a consistent hierarchy of prompting strategies. Zero-shot prompting was weakest, random few-shot prompting provided only limited and unreliable gains, and query-conditioned retrieval produced the largest improvements. Across model families, standard \(k\)NN was generally a strong and consistent retrieval strategy, whereas \(k\)NN+MMR usually provided only modest additional gains, primarily within the Qwen family. The Kaggle dataset yielded higher absolute performance, with top accuracy above 0.87, whereas the best Medetec result reached 0.678 accuracy. Nevertheless, the main trend was stable across both datasets: retrieval-based ICL accounted for most of the performance lift, while the stronger multimodal SMLMs surpassed the retrieval-only baseline by a clear margin.
For the Kaggle dataset, Table 1 summarises the primary paired comparison against the retrieval-only control for \(k\)NN ICL: Qwen 3.5 27B, Qwen 3.5 9B, and Gemma 4 26B A4B exceeded the weighted-\(k\)NN baseline (0.708 accuracy) by +0.152, +0.128, and +0.160, respectively, with exact McNemar tests indicating significant paired improvements. At the same time, their support-overlap rates remained high: top-1 support matches ranged from 0.708 to 0.732, support-majority matches from 0.720 to 0.744, and any-support matches from 0.952 to 0.980. Conditional correctness analysis showed the same pattern: for these three models, the probability of being correct when the weighted-\(k\)NN control was correct remained very high (0.938–0.966), while the probability of being correct when the weighted-\(k\)NN control was wrong was still substantial (0.589–0.630), with Fisher exact tests indicating strong positive association between SMLM and control correctness (odds ratios \(=10.53\)–\(16.73\), all \(p<10^{-9}\); see Appendix 6). This pattern indicates that their predictions were strongly constrained by the retrieved support, yet were not reducible to a simple nearest-neighbour vote, because agreement and \(\kappa\) remained substantial rather than near-perfect, and the models still achieved significant gains over the weighted-\(k\)NN control. Qwen 3.5 4B also remained above the weighted-\(k\)NN control (+0.072; McNemar \(p=0.011\)), but by a smaller margin; correspondingly, it preserved most weighted-\(k\)NN-correct cases (0.921) but rescued a more modest fraction of weighted-\(k\)NN errors (0.438).
| Model | Acc. | \(\Delta\) | McNemar \(p\) | Top-1 | Maj. | Any | Ret. | Resc. | Agreement | \(\kappa\) |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 27B | 0.860 | +0.152 | \(<0.001\) | 0.732 | 0.744 | 0.980 | 0.960 | 0.616 | 0.752 | 0.723 |
| Qwen 3.5 9B | 0.836 | +0.128 | \(<0.001\) | 0.716 | 0.740 | 0.964 | 0.938 | 0.589 | 0.740 | 0.710 |
| Gemma 4 26B A4B | 0.868 | +0.160 | \(<0.001\) | 0.708 | 0.720 | 0.952 | 0.966 | 0.630 | 0.728 | 0.697 |
| Qwen 3.5 4B | 0.780 | +0.072 | 0.011 | 0.704 | 0.752 | 0.984 | 0.921 | 0.438 | 0.744 | 0.713 |
| Ministral 3 14B | 0.752 | +0.044 | 0.169 | 0.684 | 0.680 | 0.944 | 0.881 | 0.438 | 0.692 | 0.656 |
| Gemma 4 E4B | 0.736 | +0.028 | 0.401 | 0.720 | 0.716 | 0.948 | 0.876 | 0.397 | 0.712 | 0.676 |
| Qwen 3.5 2B | 0.704 | -0.004 | 1.000 | 0.676 | 0.716 | 0.928 | 0.853 | 0.342 | 0.720 | 0.687 |
| Ministral 3 8B | 0.656 | -0.052 | 0.130 | 0.640 | 0.632 | 0.884 | 0.785 | 0.342 | 0.640 | 0.595 |
| Ministral 3 3B | 0.548 | -0.160 | \(<0.001\) | 0.528 | 0.508 | 0.768 | 0.633 | 0.342 | 0.504 | 0.449 |
| Gemma 4 E2B | 0.456 | -0.252 | \(<0.001\) | 0.436 | 0.432 | 0.668 | 0.520 | 0.301 | 0.424 | 0.358 |
| Qwen 3.5 0.8B | 0.328 | -0.380 | \(<0.001\) | 0.296 | 0.292 | 0.608 | 0.362 | 0.247 | 0.296 | 0.207 |
3pt
By contrast, the weaker models showed lower agreement with the weighted-\(k\)NN control and weaker support overlap. Qwen 3.5 2B was already at parity with the control (\(\Delta=-0.004\)), although still demonstrating strong conditional dependence on the weighted-\(k\)NN baseline (retention 0.853, rescue 0.342; Fisher \(p<10^{-14}\)), the cases it rescued were nearly offset by cases in which the control had been correct, and the SMLM was not. Smaller models such as Gemma 4 E2B, Ministral 3 3B, and Qwen 3.5 0.8B had substantially lower agreement values (0.424, 0.504, and 0.296, respectively) and \(\kappa\) values (0.358, 0.449, and 0.207), with lower any-support overlap (0.668, 0.768, and 0.608). Together with their lower conditional retention and rescue rates, this suggests that the smaller models were less consistently anchored to the retrieved neighbourhood and made less effective use of ICL.
For the Medetec dataset, Table 2 summarises the analogous paired retrieval-control comparisons for the \(k\)NN retrieval. The global weighted-\(k\)NN control reached 0.467 accuracy, and Qwen 3.5 27B and 9B exceeded it by +0.167 and +0.133, with an exact McNemar test indicating a significant paired improvement. By contrast, Gemma 4 26B A4B and Qwen 3.5 4B achieved positive deltas of +0.100 and +0.111, respectively, but these differences were not significant. The strongest models remained closely tied to the retrieved support: Qwen 3.5 27B had a support-majority match rate of 0.744 and an any-support match rate of 0.978, while Qwen 3.5 9B had an any-support match rate of 1.000. Conditional correctness analysis showed that these models preserved most control-correct cases, with retention rates of 0.952 and 0.857, while rescuing a smaller fraction of control errors, with rescue rates of 0.354 and 0.375. Fisher’s exact tests indicated a strong positive association between SMLM and control correctness for both models (odds ratios \(=36.47\) and \(10.00\); see Appendix 6).
Several models showed a different pattern on Medetec: they were strongly coupled to the retrieval-only control but did not rescue enough control errors to obtain a significant net improvement. Gemma 4 E4B, for example, had high retention (0.905) and a strong association with the control (odds ratio \(=36.10\)), but its rescue rate was only 0.208, and its accuracy gain over the control was not significant. Similarly, Qwen 3.5 2B had a positive but non-significant delta of +0.067. At the lower end, Ministral 3 3B and Qwen 3.5 0.8B fell significantly below the retrieval-only control. Qwen 3.5 0.8B was particularly weakly anchored to the retrieved neighbourhood, with low support-overlap values, very low agreement with the control, and no significant association between SMLM and control correctness.
| Model | Acc. | \(\Delta\) | McNemar \(p\) | Top-1 | Maj. | Any | Ret. | Resc. | Agreement | \(\kappa\) |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 27B | 0.633 | +0.167 | \(<0.001\) | 0.611 | 0.744 | 0.978 | 0.952 | 0.354 | 0.733 | 0.660 |
| Qwen 3.5 9B | 0.600 | +0.133 | 0.023 | 0.522 | 0.589 | 1.000 | 0.857 | 0.375 | 0.578 | 0.498 |
| Gemma 4 26B A4B | 0.567 | +0.100 | 0.108 | 0.522 | 0.544 | 0.911 | 0.810 | 0.354 | 0.533 | 0.446 |
| Qwen 3.5 4B | 0.578 | +0.111 | 0.076 | 0.433 | 0.567 | 0.844 | 0.810 | 0.375 | 0.556 | 0.483 |
| Ministral 3 14B | 0.500 | +0.033 | 0.701 | 0.533 | 0.544 | 0.933 | 0.714 | 0.312 | 0.533 | 0.441 |
| Gemma 4 E4B | 0.533 | +0.067 | 0.180 | 0.600 | 0.700 | 0.978 | 0.905 | 0.208 | 0.689 | 0.608 |
| Qwen 3.5 2B | 0.533 | +0.067 | 0.362 | 0.444 | 0.444 | 0.922 | 0.714 | 0.375 | 0.433 | 0.364 |
| Ministral 3 8B | 0.444 | -0.022 | 0.839 | 0.500 | 0.511 | 0.811 | 0.690 | 0.229 | 0.511 | 0.411 |
| Gemma 4 E2B | 0.367 | -0.100 | 0.150 | 0.422 | 0.289 | 0.744 | 0.524 | 0.229 | 0.289 | 0.216 |
| Ministral 3 3B | 0.322 | -0.144 | 0.029 | 0.289 | 0.322 | 0.767 | 0.476 | 0.188 | 0.311 | 0.240 |
| Qwen 3.5 0.8B | 0.244 | -0.222 | 0.005 | 0.156 | 0.100 | 0.467 | 0.214 | 0.271 | 0.100 | 0.041 |
3pt
Because the \(k\)NN+MMR retrieval changed only the final support-set selection step, its retrieval-control diagnostics are not repeated in full here. Across both datasets, the \(k\)NN+MMR results followed the same qualitative pattern as standard \(k\)NN: larger models retained most retrieval-control successes while rescuing a subset of retrieval-control failures, whereas smaller models showed weaker evidence of reasoning beyond the retrieved neighbourhood. Detailed \(k\)NN+MMR paired results are reported in Appendix 7.
Overall, the results show that larger models make more effective use of ICL without merely “parroting” the support context. Conditional correctness analysis makes the size distinction clearer: the larger models preserve most cases that the retrieval-only control gets right while also “rescuing” a subset of the control’s errors. In other words, they remain guided by the retrieved neighbourhood while still outperforming retrieval-only controls on the same examples, and their agreement with those controls is substantial but far from perfect. The smaller models also benefit from relevant retrieved examples compared with zero-shot and random few-shot prompting, but they either use ICL without achieving any improvement or fail to exploit it reliably, consistently falling below what retrieval alone achieves on the same context.
Table 3 shows that the reduced support subsets remained broadly class-balanced across fractions. For Kaggle, class-balance evenness changed only slightly, from 0.889 for the full support set to 0.879 at the 25% fraction. Medetec showed a similarly small mean change, from 0.808 to 0.799, although variability increased at the smallest support size. By contrast, the effective rank of the CLIP embedding space decreased more clearly as support size was reduced, from 52.9 to 45.5 for Kaggle and from 56.0 to 38.3 for Medetec. This suggests that the support-size ablation primarily reduced embedding-space coverage rather than causing large class-balance shifts, particularly for Medetec where the smaller support pool lost representational diversity more quickly.
| Dataset | Metric | 100% | 75% | 50% | 25% |
|---|---|---|---|---|---|
| Kaggle | \(n\) | 1219 | 914 | 610 | 305 |
| \(E_{\mathrm{class}}\) | 0.889 | 0.889 \(\pm\) 0.002 | 0.888 \(\pm\) 0.006 | 0.879 \(\pm\) 0.005 | |
| \(r_{\mathrm{eff}}\) | 52.9 | 51.7 \(\pm\) 0.1 | 49.3 \(\pm\) 0.6 | 45.5 \(\pm\) 1.2 | |
| Medetec | \(n\) | 470 | 353 | 235 | 118 |
| \(E_{\mathrm{class}}\) | 0.808 | 0.809 \(\pm\) 0.009 | 0.804 \(\pm\) 0.012 | 0.799 \(\pm\) 0.048 | |
| \(r_{\mathrm{eff}}\) | 56.0 | 53.2 \(\pm\) 0.5 | 48.1 \(\pm\) 0.4 | 38.3 \(\pm\) 0.8 |
6pt
Table 4 reports the accuracy trends across support fractions on the Kaggle dataset. The strongest retrieval-based SMLMs degraded only moderately as the support pool was reduced. Qwen 3.5 27B with \(k\)NN+MMR changed from 0.872 at full support to 0.830 at the 50% fraction (\(-4.8\%\)) and 0.781 at the 25% fraction (\(-10.4\%\)). Gemma 4 26B A4B was also robust, reaching 0.829 at the 50% fraction (\(-4.5\%\)) and 0.794 at the 25% fraction (\(-8.5\%\)) with \(k\)NN+MMR, and 0.848 at the 50% fraction (\(-1.9\%\)) and 0.798 at the 25% fraction (\(-7.6\%\)) with standard \(k\)NN. Qwen 3.5 27B with standard \(k\)NN and Qwen 3.5 9B with \(k\)NN+MMR showed similar reductions at the 25% fraction, reaching 0.769 (\(-10.6\%\)) and 0.763 (\(-12.1\%\)), respectively. The supervised baselines lost more performance at the smallest training size: the best supervised result at 25% was 0.666 for ConvNeXt-Tiny with full fine-tuning, down from 0.804 at full support (\(-17.2\%\)).
The lower-capacity and random-context conditions showed a different pattern. Random few-shot prompting remained substantially below query-conditioned retrieval throughout the sweep, and its accuracy changed only weakly with support-pool size, suggesting that the main advantage came from retrieving relevant examples rather than from simply having a larger pool of support images. Smaller retrieval-augmented models also benefited from \(k\)NN or \(k\)NN+MMR selection, but their absolute performance was lower, and their trends were less monotonic. This is consistent with the earlier retrieval-control results: retrieved context remained useful, but the strongest gains under support reduction were concentrated in the larger SMLMs.
Table 5 shows the same support-fraction analysis for the Medetec dataset. Absolute accuracies were lower than on Kaggle, and the reduction from full support was larger for several methods. Qwen 3.5 27B with \(k\)NN+MMR decreased from 0.678 to 0.527 at the 25% fraction (\(-22.3\%\)), while the \(k\)NN version decreased from 0.633 to 0.518 (\(-18.2\%\)). Gemma 4 26B A4B with \(k\)NN+MMR was more stable, decreasing from 0.611 to 0.529 (\(-13.4\%\)). These retrieval-based SMLM results still exceeded the supervised baselines at the smallest training size. At the 25% fraction, the best SMLM results were around 0.52–0.53 accuracy, whereas the best supervised result was 0.413 for ConvNeXt-Tiny with head fine-tuning, down from 0.644 at full support (\(-35.9\%\)).
The stronger degradation on Medetec is consistent with the subset statistics in Table 3. The effective rank decreased from 56.0 to 38.3 on Medetec (\(-31.6\%\)), compared with 52.9 to 45.5 on Kaggle (\(-14.0\%\)). Thus, the smaller Medetec support pool lost embedding-space coverage more quickly. Nevertheless, the strongest retrieval-based SMLM conditions retained a clear advantage over both random prompting and supervised training at the smallest fractions. Overall, Tables 4 and 5 indicate that retrieval-based ICL is fairly robust to moderate support reduction, but that performance starts to decline when the support pool becomes too small or too narrow.
| Model | 1.0 | 0.75 | 0.50 | 0.25 |
|---|---|---|---|---|
| Supervised models | ||||
| ViT-B/16 full | 0.808 | 0.766 \(\pm\) 0.027 | 0.706 \(\pm\) 0.023 | 0.642 \(\pm\) 0.019 |
| ConvNeXt-Tiny full | 0.804 | 0.779 \(\pm\) 0.022 | 0.765 \(\pm\) 0.025 | 0.666 \(\pm\) 0.028 |
| ViT-B/16 LoRA r=8 | 0.788 | 0.778 \(\pm\) 0.025 | 0.733 \(\pm\) 0.023 | 0.648 \(\pm\) 0.037 |
| EfficientNet V2-S full | 0.772 | 0.786 \(\pm\) 0.014 | 0.716 \(\pm\) 0.024 | 0.626 \(\pm\) 0.061 |
| ResNet50 full | 0.760 | 0.734 \(\pm\) 0.028 | 0.685 \(\pm\) 0.013 | 0.626 \(\pm\) 0.044 |
| ViT-B/16 head | 0.716 | 0.718 \(\pm\) 0.036 | 0.683 \(\pm\) 0.030 | 0.639 \(\pm\) 0.026 |
| ConvNeXt-Tiny head | 0.700 | 0.730 \(\pm\) 0.025 | 0.698 \(\pm\) 0.010 | 0.643 \(\pm\) 0.027 |
| ResNet50 head | 0.676 | 0.656 \(\pm\) 0.041 | 0.603 \(\pm\) 0.031 | 0.560 \(\pm\) 0.022 |
| EfficientNet V2-S head | 0.644 | 0.562 \(\pm\) 0.024 | 0.519 \(\pm\) 0.026 | 0.482 \(\pm\) 0.015 |
| SMLMs | ||||
| Qwen 3.5 27B kNN+MMR | 0.872 | 0.873 \(\pm\) 0.011 | 0.830 \(\pm\) 0.040 | 0.781 \(\pm\) 0.025 |
| Gemma 4 26B A4B kNN+MMR | 0.868 | 0.852 \(\pm\) 0.016 | 0.829 \(\pm\) 0.019 | 0.794 \(\pm\) 0.019 |
| Qwen 3.5 9B kNN+MMR | 0.868 | 0.849 \(\pm\) 0.010 | 0.823 \(\pm\) 0.017 | 0.763 \(\pm\) 0.010 |
| Gemma 4 26B A4B kNN | 0.864 | 0.845 \(\pm\) 0.006 | 0.848 \(\pm\) 0.025 | 0.798 \(\pm\) 0.022 |
| Qwen 3.5 27B kNN | 0.860 | 0.851 \(\pm\) 0.013 | 0.829 \(\pm\) 0.012 | 0.769 \(\pm\) 0.013 |
| Qwen 3.5 9B kNN | 0.836 | 0.825 \(\pm\) 0.017 | 0.816 \(\pm\) 0.019 | 0.743 \(\pm\) 0.022 |
| Ministral 3 14B kNN | 0.752 | 0.694 \(\pm\) 0.016 | 0.671 \(\pm\) 0.010 | 0.628 \(\pm\) 0.026 |
| Qwen 3.5 2B kNN+MMR | 0.748 | 0.719 \(\pm\) 0.018 | 0.705 \(\pm\) 0.013 | 0.646 \(\pm\) 0.020 |
| Gemma 4 E4B kNN | 0.736 | 0.706 \(\pm\) 0.011 | 0.680 \(\pm\) 0.014 | 0.623 \(\pm\) 0.007 |
| Gemma 4 E4B kNN+MMR | 0.716 | 0.692 \(\pm\) 0.012 | 0.696 \(\pm\) 0.006 | 0.647 \(\pm\) 0.017 |
| Ministral 3 14B kNN+MMR | 0.708 | 0.710 \(\pm\) 0.020 | 0.674 \(\pm\) 0.029 | 0.633 \(\pm\) 0.016 |
| Qwen 3.5 2B kNN | 0.704 | 0.713 \(\pm\) 0.009 | 0.694 \(\pm\) 0.025 | 0.637 \(\pm\) 0.018 |
| Ministral 3 8B kNN+MMR | 0.656 | 0.639 \(\pm\) 0.008 | 0.611 \(\pm\) 0.016 | 0.573 \(\pm\) 0.013 |
| Ministral 3 8B kNN | 0.656 | 0.630 \(\pm\) 0.017 | 0.602 \(\pm\) 0.026 | 0.573 \(\pm\) 0.026 |
| Gemma 4 26B A4B Random | 0.652 | 0.640 \(\pm\) 0.016 | 0.644 \(\pm\) 0.005 | 0.642 \(\pm\) 0.023 |
| Qwen 3.5 9B Random | 0.640 | 0.619 \(\pm\) 0.020 | 0.616 \(\pm\) 0.014 | 0.624 \(\pm\) 0.017 |
| Qwen 3.5 27B Random | 0.636 | 0.623 \(\pm\) 0.009 | 0.609 \(\pm\) 0.014 | 0.607 \(\pm\) 0.025 |
| Ministral 3 3B kNN+MMR | 0.580 | 0.563 \(\pm\) 0.017 | 0.553 \(\pm\) 0.023 | 0.506 \(\pm\) 0.029 |
| Ministral 3 3B kNN | 0.548 | 0.534 \(\pm\) 0.016 | 0.529 \(\pm\) 0.026 | 0.496 \(\pm\) 0.019 |
| Gemma 4 E2B kNN | 0.456 | 0.494 \(\pm\) 0.012 | 0.508 \(\pm\) 0.020 | 0.476 \(\pm\) 0.007 |
| Ministral 3 14B Random | 0.448 | 0.449 \(\pm\) 0.014 | 0.459 \(\pm\) 0.027 | 0.457 \(\pm\) 0.030 |
| Gemma 4 E2B kNN+MMR | 0.444 | 0.469 \(\pm\) 0.013 | 0.483 \(\pm\) 0.010 | 0.461 \(\pm\) 0.014 |
| Gemma 4 E4B Random | 0.424 | 0.452 \(\pm\) 0.006 | 0.444 \(\pm\) 0.008 | 0.445 \(\pm\) 0.007 |
| Ministral 3 3B Random | 0.392 | 0.400 \(\pm\) 0.013 | 0.410 \(\pm\) 0.011 | 0.419 \(\pm\) 0.013 |
| Ministral 3 8B Random | 0.440 | 0.383 \(\pm\) 0.013 | 0.403 \(\pm\) 0.023 | 0.417 \(\pm\) 0.028 |
| Gemma 4 E2B Random | 0.332 | 0.309 \(\pm\) 0.027 | 0.339 \(\pm\) 0.024 | 0.331 \(\pm\) 0.017 |
| Qwen 3.5 2B Random | 0.324 | 0.351 \(\pm\) 0.014 | 0.356 \(\pm\) 0.013 | 0.341 \(\pm\) 0.018 |
6pt
| Model | 1.0 | 0.75 | 0.50 | 0.25 |
|---|---|---|---|---|
| Supervised image models | ||||
| ConvNeXt-Tiny head | 0.644 | 0.578 \(\pm\) 0.008 | 0.522 \(\pm\) 0.055 | 0.413 \(\pm\) 0.096 |
| ConvNeXt-Tiny full | 0.567 | 0.551 \(\pm\) 0.033 | 0.491 \(\pm\) 0.053 | 0.384 \(\pm\) 0.061 |
| ViT-B/16 head | 0.567 | 0.511 \(\pm\) 0.054 | 0.471 \(\pm\) 0.068 | 0.398 \(\pm\) 0.085 |
| ViT-B/16 LoRA r=8 | 0.556 | 0.511 \(\pm\) 0.053 | 0.480 \(\pm\) 0.064 | 0.389 \(\pm\) 0.067 |
| EfficientNet V2-S full | 0.556 | 0.487 \(\pm\) 0.055 | 0.467 \(\pm\) 0.072 | 0.327 \(\pm\) 0.081 |
| ResNet50 head | 0.556 | 0.507 \(\pm\) 0.026 | 0.442 \(\pm\) 0.043 | 0.287 \(\pm\) 0.100 |
| ViT-B/16 full | 0.533 | 0.529 \(\pm\) 0.006 | 0.462 \(\pm\) 0.069 | 0.376 \(\pm\) 0.062 |
| ResNet50 full | 0.522 | 0.489 \(\pm\) 0.050 | 0.427 \(\pm\) 0.052 | 0.353 \(\pm\) 0.084 |
| EfficientNet V2-S head | 0.433 | 0.422 \(\pm\) 0.021 | 0.396 \(\pm\) 0.051 | 0.293 \(\pm\) 0.045 |
| SMLMs | ||||
| Qwen 3.5 27B kNN+MMR | 0.678 | 0.633 \(\pm\) 0.023 | 0.577 \(\pm\) 0.022 | 0.527 \(\pm\) 0.074 |
| Qwen 3.5 27B kNN | 0.633 | 0.611 \(\pm\) 0.021 | 0.555 \(\pm\) 0.013 | 0.518 \(\pm\) 0.076 |
| Gemma 4 26B A4B kNN+MMR | 0.611 | 0.604 \(\pm\) 0.006 | 0.582 \(\pm\) 0.056 | 0.529 \(\pm\) 0.077 |
| Qwen 3.5 9B kNN+MMR | 0.611 | 0.562 \(\pm\) 0.036 | 0.531 \(\pm\) 0.021 | 0.458 \(\pm\) 0.068 |
| Qwen 3.5 9B kNN | 0.600 | 0.578 \(\pm\) 0.021 | 0.513 \(\pm\) 0.034 | 0.467 \(\pm\) 0.053 |
| Gemma 4 26B A4B kNN | 0.567 | 0.569 \(\pm\) 0.018 | 0.540 \(\pm\) 0.027 | 0.522 \(\pm\) 0.060 |
| Qwen 3.5 2B kNN+MMR | 0.567 | 0.529 \(\pm\) 0.023 | 0.467 \(\pm\) 0.057 | 0.404 \(\pm\) 0.076 |
| Gemma 4 E4B kNN | 0.533 | 0.524 \(\pm\) 0.033 | 0.449 \(\pm\) 0.034 | 0.427 \(\pm\) 0.059 |
| Qwen 3.5 2B kNN | 0.533 | 0.513 \(\pm\) 0.009 | 0.433 \(\pm\) 0.050 | 0.382 \(\pm\) 0.048 |
| Gemma 4 E4B kNN+MMR | 0.511 | 0.493 \(\pm\) 0.029 | 0.469 \(\pm\) 0.043 | 0.431 \(\pm\) 0.033 |
| Ministral 3 14B kNN+MMR | 0.500 | 0.482 \(\pm\) 0.025 | 0.440 \(\pm\) 0.006 | 0.422 \(\pm\) 0.048 |
| Ministral 3 14B kNN | 0.500 | 0.449 \(\pm\) 0.025 | 0.443 \(\pm\) 0.008 | 0.409 \(\pm\) 0.043 |
| Ministral 3 8B kNN+MMR | 0.456 | 0.436 \(\pm\) 0.024 | 0.407 \(\pm\) 0.023 | 0.389 \(\pm\) 0.038 |
| Ministral 3 8B kNN | 0.444 | 0.442 \(\pm\) 0.016 | 0.424 \(\pm\) 0.042 | 0.389 \(\pm\) 0.046 |
| Gemma 4 26B A4B Random | 0.422 | 0.415 \(\pm\) 0.050 | 0.427 \(\pm\) 0.033 | 0.416 \(\pm\) 0.042 |
| Ministral 3 3B kNN+MMR | 0.389 | 0.327 \(\pm\) 0.017 | 0.353 \(\pm\) 0.041 | 0.309 \(\pm\) 0.032 |
| Qwen 3.5 27B Random | 0.388 | 0.402 \(\pm\) 0.015 | 0.406 \(\pm\) 0.020 | 0.424 \(\pm\) 0.033 |
| Gemma 4 E2B kNN | 0.367 | 0.296 \(\pm\) 0.030 | 0.264 \(\pm\) 0.061 | 0.222 \(\pm\) 0.028 |
| Ministral 3 14B Random | 0.356 | 0.329 \(\pm\) 0.025 | 0.348 \(\pm\) 0.024 | 0.338 \(\pm\) 0.037 |
| Ministral 3 8B Random | 0.344 | 0.327 \(\pm\) 0.043 | 0.358 \(\pm\) 0.016 | 0.347 \(\pm\) 0.048 |
| Ministral 3 3B kNN | 0.322 | 0.333 \(\pm\) 0.022 | 0.344 \(\pm\) 0.042 | 0.293 \(\pm\) 0.030 |
| Gemma 4 E2B Random | 0.300 | 0.291 \(\pm\) 0.021 | 0.329 \(\pm\) 0.062 | 0.324 \(\pm\) 0.016 |
| Gemma 4 E2B kNN+MMR | 0.289 | 0.271 \(\pm\) 0.048 | 0.264 \(\pm\) 0.033 | 0.216 \(\pm\) 0.023 |
| Qwen 3.5 9B Random | 0.278 | 0.338 \(\pm\) 0.032 | 0.362 \(\pm\) 0.033 | 0.342 \(\pm\) 0.029 |
| Qwen 3.5 2B Random | 0.222 | 0.242 \(\pm\) 0.035 | 0.231 \(\pm\) 0.039 | 0.233 \(\pm\) 0.030 |
| Ministral 3 3B Random | 0.189 | 0.271 \(\pm\) 0.047 | 0.296 \(\pm\) 0.040 | 0.300 \(\pm\) 0.014 |
| Gemma 4 E4B Random | 0.133 | 0.144 \(\pm\) 0.029 | 0.147 \(\pm\) 0.023 | 0.111 \(\pm\) 0.014 |
6pt
Figure 5 summarises the sweep over support-context sizes from 2 to 20 images. Accuracy generally increased with increasing context size, with the clearest gains in the lower part of the sweep (2-10 images). Beyond this range, performance typically flattened or fluctuated, and the largest contexts did not yield consistent additional gains: from 2 to 10 support images, mean accuracy increased by 0.012 per two-image step for \(k\)NN and by 0.009 per two-image step for \(k\)NN+MMR. From 10 to 20 support images, the corresponding gains were only 0.001 and 0.002 per step, indicating that larger contexts produced limited additional improvement.
Across the full sweep, retrieval-based context construction remained substantially stronger than random support sampling. Both \(k\)NN and \(k\)NN+MMR were consistently above the corresponding random-context results, while the difference between \(k\)NN and \(k\)NN+MMR was comparatively smaller, ranging from -0.004 to 0.020 accuracy points. The larger and mid-sized models showed clearer improvements as retrieved context was added, whereas the smallest models exhibited flatter and more variable trends.
The computational measures increased with context size. Mean response time rose with the number of support images for every model (see Table 6) and mean input-token counts also increased approximately linearly with context size within each model family, from 702 to 3958 tokens for Qwen 3.5, from 843 to 4652 for Ministral 3, and from 937 to 6042 for Gemma 4 (see Table 7).
| Model | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 27B | 8.36 | 12.55 | 16.49 | 21.07 | 24.68 | 28.37 | 32.27 | 36.17 | 40.38 | 44.49 |
| Qwen 3.5 9B | 3.00 | 4.94 | 6.92 | 8.68 | 10.56 | 12.23 | 13.73 | 14.10 | 15.91 | 18.17 |
| Qwen 3.5 4B | 2.06 | 3.21 | 4.33 | 5.60 | 5.53 | 5.96 | 7.21 | 8.55 | 9.57 | 10.41 |
| Qwen 3.5 2B | 0.88 | 1.43 | 1.93 | 2.51 | 2.99 | 3.44 | 3.86 | 4.30 | 4.83 | 5.28 |
| Qwen 3.5 0.8B | 0.41 | 0.65 | 0.86 | 1.14 | 1.40 | 1.64 | 1.85 | 2.11 | 2.34 | 2.49 |
| Ministral 3 14B | 4.35 | 6.78 | 9.11 | 11.71 | 14.68 | 17.57 | 20.04 | 21.97 | 24.84 | 26.95 |
| Ministral 3 8B | 2.92 | 4.62 | 6.27 | 8.16 | 9.54 | 11.11 | 12.87 | 14.57 | 16.09 | 18.40 |
| Ministral 3 3B | 1.53 | 2.46 | 3.32 | 4.24 | 5.21 | 6.13 | 7.09 | 8.00 | 9.02 | 10.13 |
| Gemma 4 26B A4B | 3.98 | 6.59 | 9.36 | 12.30 | 14.79 | 18.96 | 20.52 | 22.89 | 25.38 | 28.89 |
| Gemma 4 E4B | 2.21 | 3.61 | 5.02 | 6.33 | 7.60 | 8.93 | 10.32 | 11.73 | 13.24 | 14.67 |
| Gemma 4 E2B | 1.48 | 2.48 | 3.43 | 4.36 | 5.37 | 6.58 | 7.91 | 8.59 | 9.60 | 10.60 |
3.5pt
| Model family | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 | 702 | 1099 | 1458 | 1853 | 2226 | 2560 | 2913 | 3262 | 3626 | 3958 |
| Ministral 3 | 843 | 1305 | 1736 | 2173 | 2614 | 3020 | 3443 | 3851 | 4260 | 4652 |
| Gemma 4 | 937 | 1503 | 2070 | 2637 | 3203 | 3772 | 4339 | 4907 | 5474 | 6042 |
4pt
This study demonstrates that retrieval-augmented in-context learning (ICL) improves the capabilities of small multimodal language models, making them a viable and flexible approach for wound image classification, particularly under limited labelled data. Across both tested datasets, zero-shot and random few-shot prompting were consistently weaker than query-conditioned prompting, indicating that the choice of support examples is central to effective ICL. The strongest gains came from CLIP-based \(k\)NN retrieval and \(k\)NN+MMR retrieval, especially for the larger Qwen and Gemma models, which both benefited from relevant examples and outperformed matched retrieval-only weighted \(k\)NN controls. This suggests that the best-performing SMLMs successfully used retrieved context within the input prompt and merged it with internal knowledge gained during pretraining. At the same time, the experiments revealed practical limits: performance depended on model scale, retrieval strategy, dataset difficulty, and support-set coverage, while increasing the number of support images beyond a moderate context size yielded diminishing accuracy gains but higher latency and longer input lengths.
Tables ¿tbl:tab:benchmark95results? and ¿tbl:tab:medetec95benchmark95results? demonstrate that neither retrieval strategy is optimal across model families. For the Qwen family, the \(k\)NN+MMR retrieval strategy yielded the best performance, whereas for the Gemma family, \(k\)NN was the best strategy, with no clear winner for the Ministral model family. This indicates that, for a given problem and model, different retrieval strategies should be evaluated to identify the optimal solution. Notably, larger Qwen models (9B and 27B), as well as Gemma 4 26B A4B, achieved statistically significant improvements over the baseline weighted \(k\)NN classifier, as indicated by McNemar tests, while having very high retention scores. On the Kaggle dataset, those models retained 93–97% of the correct \(k\)NN predictions, whereas on the Medetec dataset, they retained at least 80% of the correct \(k\)NN predictions. These results indicate that the models were highly capable of identifying when the \(k\)NN prediction is correct, without being too dependent on the retrieved context, as indicated by agreement scores (see Tables 1 and 2). Particularly remarkable is the performance of Qwen 3.5 27B, which achieved a retention score of 0.952 even on the more challenging Medetec dataset. In addition to retention, the best‑performing models exhibited substantial rescue scores: approximately 0.65 on Kaggle and 0.36 on Medetec. These values suggest that the models could filter out incorrect \(k\)NN predictions and select the correct alternative based on their internal knowledge. The statistical significance of these improvements further supports the conclusion that the models contribute meaningful corrective behaviour rather than random variation. Another important pattern is the high agreement with at least one label present in the support set. This further indicates that the models’ corrective suggestions were strongly shaped by the contextual information provided in the support examples. While such context‑dependence may introduce a form of support‑set bias, potentially limiting performance when the support set is suboptimal, it may be advantageous when the support set is constructed through a targeted retrieval strategy rather than random sampling.
Tables 4 and 5 show that several larger retrieval-augmented SMLMs were comparable or even surpassed the classic supervised fine-tuned image classification models. This advantage was most evident with reduced support: with only 50% or 25% of the available support/training data, the best ICL-based SMLMs outperformed the best supervised baselines on both datasets. These results should not be interpreted as showing that ICL removes the need for labelled data: as with supervised learning, retrieval-based ICL still requires representative labelled examples, and Table 3 suggests that performance decreased as embedding-space coverage declined. The practical distinction is that ICL uses these examples at inference time rather than through parameter updates. As a result, the support pool or label set can be modified without retraining a classifier, making the approach more flexible when data distributions, clinical definitions, or deployment requirements change. These results, therefore, suggest that retrieval-augmented ICL is not data-free, but it may be less data-hungry than conventional supervised training and able to remain useful with smaller labelled datasets.
The results from the support-context sweep experiment, shown in Figure 5 and Tables 6 and 7, highlighted a trade-off between accuracy and cost when using ICL with SMLMs. Adding more support images improved performance primarily up to a moderate context size (8-10 images); beyond that, the gains were small, while input length and response time continued to increase. In practice, this favours compact retrieved contexts rather than simply larger prompts: a small set of relevant examples appears to capture most of the ICL benefit with lower latency and computational cost. The gap between retrieved and random contexts again shows that relevance matters more than context size alone: additional examples help only when they provide useful evidence for the query image.
The performance differed between the Kaggle and Medetec datasets, although the overall trends were similar. The Medetec dataset was generally harder than the Kaggle one, potentially because its support set was approximately 2.5 times smaller. However, the support-set reduction experiments show that the best SMLMs on reduced Kaggle support sets (610 and 305 images) still outperformed their counterparts on the full Medetec support set (470 images). This suggests that differences in class definitions, visual heterogeneity, or inter-class separability may also have contributed to the lower Medetec performance.
A key limitation of these datasets for image-based classification is that some clinically distinct etiologies are grouped into a single class, reducing label specificity and increasing visual heterogeneity. For example, in the Medetec dataset, venous and arterial ulcers are merged into one category (“Venous or Arterial Ulcers”), despite having different underlying causes and characteristic appearances, which can include differences in wound shape, depth, exudate, and surrounding tissue condition [78]. This aggregation leads to high intra-class variability, making it harder for models to learn consistent visual patterns. Conversely, other classes across both datasets may exhibit overlapping visual features despite representing different conditions, further increasing inter-class ambiguity, a known challenge in medical image classification where distinctions between categories can be subtle even for experts [79], [80]. Additionally, the presence of broad or weakly defined categories (e.g., “Miscellaneous”) and potential label noise due to subjective clinical annotation can further degrade model performance and generalisation. Future work should therefore evaluate SMLMs on additional wound datasets with broader wound-type coverage, as well as on medical image-classification tasks beyond wound analysis.
During experiments, refusal rates remained low overall (0.08% across all model outputs), despite some images containing potentially sensitive visual content. A plausible explanation is that all evaluated models were instruction-tuned: prior work shows that instruction tuning improves alignment with user intent and instruction-following behaviour in both language-only and multimodal models [10], [81], [82]. In addition, all experiments were performed with the temperature parameter set to zero, i.e., a deterministic setting with reduced sampling variability relative to higher-temperature decoding. We therefore interpret the low refusal rate as consistent with stronger task compliance under instruction-tuned, deterministic inference, although isolating this effect would require a dedicated ablation. Additionally, it is important to note that in this study, we didn’t use cross-validation because of the time and resource constraints. We are aware that such an approach limits generalisation, but we made sure that the evaluation sets for both datasets were randomly selected and balanced.
In this study, we used CLIP as the embedding model for support-set retrieval. However, many other embedding models are available, including general-purpose models such as Gemini Embeddings 2 [83] and DINOv3 [84], as well as models fine-tuned on medical data, such as MedCLIP [56] and BiomedCLIP [57]. These alternatives may be able to provide better representations of wound images, thereby improving both context-set retrieval and ICL performance. Because our focus was on SMLMs and their interaction with ICL, evaluating the impact of different embedding models was beyond the scope of this work and is left for future research. Additionally, we used SMLMs for ICL out of the box, without fine-tuning them on the task-specific datasets. Despite this, the larger models achieved higher accuracy than the fine-tuned supervised models, suggesting that task-specific fine-tuning could further improve SMLM performance [85], [86]. An investigation of the effects of fine-tuning on general performance and ICL is planned for our future work.
The deployment of AI models in clinical environments involves a range of considerations that extend beyond algorithmic performance. In healthcare, patient data are highly sensitive, which often restricts access to comprehensive datasets and imposes stringent privacy and security requirements. Consequently, models may need to operate locally rather than through cloud‑based services, and their development must account for limited data availability, regulatory constraints, and the need for robust privacy‑preserving mechanisms. The small multimodal language models evaluated in this study demonstrate considerable potential to meet the practical constraints of on‑premises deployment in healthcare settings. The smallest variants, Qwen 3.5 0.8B, 2B, 4B, Ministral 3 3B, and Gemma 4 E2B, were the most straightforward to run locally and required modest computational resources. Mid‑sized and larger models, including Qwen 3.5 9B and 27B, Ministral 3 8B and 14B, and Gemma 4 E4B and 26B A4B, also remained feasible on consumer‑grade hardware, albeit with more careful optimisation.
The authors acknowledge the Swedish Knowledge Foundation, Jönköping University, and the industrial partners, including Mölnlycke Health Care, for financially supporting the research through the following project: ETIAI (Grant number 20230036), as part of the research and education environment SPARK at Jönköping University, Sweden.
G.M., O.G., J.P., and E.A. designed the study. G.M. conducted the experiments. G.M., O.G., J.P., and E.A. analysed the results. All authors contributed to the writing and reviewed the manuscript.
During the preparation of this work, the author(s) used OpenAI’s GPT Image 2 in order to generate schematic wound images for Figure 1. These images were used only for visual illustration and were not included in the datasets, model inputs, evaluation sets, or experimental analyses. After using this tool/service, the author(s) reviewed and edited the content as needed and take(s) full responsibility for the content of the published article.
To complement the paired retrieval-control comparisons, we report conditional correctness and association statistics for each model–control comparison for both Kaggle and Medetec datasets. For each paired \(2\times2\) correctness table, we computed the retention rate, \(P(\mathrm{SMLM~correct}\mid\mathrm{control~correct})\), the rescue rate, \(P(\mathrm{SMLM~correct}\mid\mathrm{control~wrong})\), Fisher’s exact test \(p\)-value, and the corresponding odds ratio (OR).
| Model | Ret. | Resc. | Fisher \(p\) | OR |
|---|---|---|---|---|
| Gemma 4 26B A4B | 0.966 | 0.630 | \(1.81 \times 10^{-11}\) | 16.73 |
| Qwen 3.5 27B | 0.960 | 0.616 | \(1.86 \times 10^{-11}\) | 15.11 |
| Qwen 3.5 9B | 0.938 | 0.589 | \(1.56 \times 10^{-10}\) | 10.53 |
| Qwen 3.5 4B | 0.921 | 0.438 | \(1.11 \times 10^{-15}\) | 14.92 |
| Ministral 3 14B | 0.881 | 0.438 | \(1.36 \times 10^{-12}\) | 9.52 |
| Gemma 4 E4B | 0.876 | 0.397 | \(5.10 \times 10^{-14}\) | 10.69 |
| Qwen 3.5 2B | 0.853 | 0.342 | \(5.18 \times 10^{-15}\) | 11.15 |
| Ministral 3 8B | 0.785 | 0.342 | \(6.66 \times 10^{-11}\) | 7.02 |
| Ministral 3 3B | 0.633 | 0.342 | \(4.26 \times 10^{-5}\) | 3.31 |
| Gemma 4 E2B | 0.520 | 0.301 | 0.002 | 2.51 |
| Qwen 3.5 0.8B | 0.362 | 0.247 | 0.103 | 1.73 |
5pt
| Model | Ret. | Resc. | Fisher \(p\) | OR |
|---|---|---|---|---|
| Gemma 4 26B A4B | 0.941 | 0.629 | \(1.17 \times 10^{-8}\) | 9.49 |
| Qwen 3.5 27B | 0.936 | 0.645 | \(1.01 \times 10^{-7}\) | 8.07 |
| Qwen 3.5 9B | 0.926 | 0.694 | \(1.45 \times 10^{-5}\) | 5.49 |
| Qwen 3.5 4B | 0.904 | 0.435 | \(2.33 \times 10^{-13}\) | 12.24 |
| Qwen 3.5 2B | 0.856 | 0.419 | \(6.80 \times 10^{-11}\) | 8.26 |
| Ministral 3 14B | 0.814 | 0.387 | \(1.11 \times 10^{-9}\) | 6.92 |
| Ministral 3 8B | 0.761 | 0.339 | \(3.76 \times 10^{-9}\) | 6.20 |
| Gemma 4 E4B | 0.851 | 0.306 | \(2.55 \times 10^{-15}\) | 12.93 |
| Ministral 3 3B | 0.654 | 0.355 | \(5.12 \times 10^{-5}\) | 3.44 |
| Gemma 4 E2B | 0.484 | 0.323 | 0.028 | 1.97 |
| Qwen 3.5 0.8B | 0.340 | 0.177 | 0.016 | 2.39 |
5pt
| Model | Ret. | Resc. | Fisher \(p\) | OR |
|---|---|---|---|---|
| Qwen 3.5 27B | 0.952 | 0.354 | \(9.35 \times 10^{-10}\) | 36.47 |
| Qwen 3.5 9B | 0.857 | 0.375 | \(3.71 \times 10^{-6}\) | 10.00 |
| Gemma 4 26B A4B | 0.810 | 0.354 | \(1.61 \times 10^{-5}\) | 7.75 |
| Qwen 3.5 4B | 0.810 | 0.375 | \(3.93 \times 10^{-5}\) | 7.08 |
| Ministral 3 14B | 0.714 | 0.312 | \(2.79 \times 10^{-4}\) | 5.50 |
| Gemma 4 E4B | 0.905 | 0.208 | \(9.60 \times 10^{-12}\) | 36.10 |
| Qwen 3.5 2B | 0.714 | 0.375 | 0.002 | 4.17 |
| Ministral 3 8B | 0.690 | 0.229 | \(1.60 \times 10^{-5}\) | 7.50 |
| Gemma 4 E2B | 0.524 | 0.229 | 0.005 | 3.70 |
| Ministral 3 3B | 0.476 | 0.188 | 0.006 | 3.94 |
| Qwen 3.5 0.8B | 0.214 | 0.271 | 0.626 | 0.73 |
5pt
| Model | Ret. | Resc. | Fisher \(p\) | OR |
|---|---|---|---|---|
| Qwen 3.5 27B | 0.976 | 0.429 | \(8.58 \times 10^{-9}\) | 53.33 |
| Qwen 3.5 9B | 0.951 | 0.327 | \(2.70 \times 10^{-10}\) | 40.22 |
| Gemma 4 26B A4B | 0.878 | 0.388 | \(1.50 \times 10^{-6}\) | 11.37 |
| Qwen 3.5 4B | 0.829 | 0.449 | \(2.20 \times 10^{-4}\) | 5.96 |
| Ministral 3 14B | 0.805 | 0.245 | \(1.83 \times 10^{-7}\) | 12.72 |
| Gemma 4 E4B | 0.854 | 0.224 | \(1.45 \times 10^{-9}\) | 20.15 |
| Qwen 3.5 2B | 0.780 | 0.388 | \(2.49 \times 10^{-4}\) | 5.61 |
| Ministral 3 8B | 0.756 | 0.204 | \(1.81 \times 10^{-7}\) | 12.09 |
| Ministral 3 3B | 0.610 | 0.204 | \(1.00 \times 10^{-4}\) | 6.09 |
| Gemma 4 E2B | 0.463 | 0.143 | 0.001 | 5.18 |
| Qwen 3.5 0.8B | 0.220 | 0.184 | 0.793 | 1.25 |
5pt
This appendix reports the full paired retrieval-control results for the \(k\)NN+MMR prompting condition. These results are discussed only briefly in Section 4.2 because the diagnostic logic is identical to the primary \(k\)NN analysis in the main text.
| Model | Acc. | \(\Delta\) | McNemar \(p\) | Top-1 | Maj. | Any | Ret. | Resc. | Agreement | \(\kappa\) |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 9B | 0.868 | +0.116 | \(<0.001\) | 0.704 | 0.756 | 0.972 | 0.926 | 0.694 | 0.744 | 0.715 |
| Qwen 3.5 27B | 0.864 | +0.112 | \(<0.001\) | 0.700 | 0.768 | 0.984 | 0.936 | 0.645 | 0.760 | 0.733 |
| Gemma 4 26B A4B | 0.864 | +0.112 | \(<0.001\) | 0.692 | 0.764 | 0.984 | 0.941 | 0.629 | 0.752 | 0.724 |
| Qwen 3.5 4B | 0.788 | +0.036 | 0.233 | 0.680 | 0.768 | 0.984 | 0.904 | 0.435 | 0.768 | 0.741 |
| Qwen 3.5 2B | 0.748 | -0.004 | 1.000 | 0.708 | 0.740 | 0.948 | 0.856 | 0.419 | 0.736 | 0.705 |
| Ministral 3 14B | 0.708 | -0.044 | 0.193 | 0.640 | 0.688 | 0.920 | 0.814 | 0.387 | 0.672 | 0.634 |
| Ministral 3 8B | 0.656 | -0.096 | 0.004 | 0.632 | 0.648 | 0.916 | 0.761 | 0.339 | 0.644 | 0.602 |
| Gemma 4 E4B | 0.716 | -0.036 | 0.243 | 0.684 | 0.736 | 0.972 | 0.851 | 0.306 | 0.724 | 0.691 |
| Ministral 3 3B | 0.580 | -0.172 | \(<0.001\) | 0.540 | 0.548 | 0.820 | 0.654 | 0.355 | 0.536 | 0.484 |
| Gemma 4 E2B | 0.444 | -0.308 | \(<0.001\) | 0.396 | 0.408 | 0.668 | 0.484 | 0.323 | 0.400 | 0.332 |
| Qwen 3.5 0.8B | 0.300 | -0.452 | \(<0.001\) | 0.284 | 0.292 | 0.636 | 0.340 | 0.177 | 0.292 | 0.205 |
3pt
| Model | Acc. | \(\Delta\) | McNemar \(p\) | Top-1 | Maj. | Any | Ret. | Resc. | Agreement | \(\kappa\) |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen 3.5 27B | 0.678 | +0.222 | \(<0.001\) | 0.600 | 0.667 | 0.956 | 0.976 | 0.429 | 0.667 | 0.589 |
| Qwen 3.5 9B | 0.611 | +0.156 | 0.001 | 0.522 | 0.589 | 0.978 | 0.951 | 0.327 | 0.589 | 0.522 |
| Gemma 4 26B A4B | 0.611 | +0.156 | 0.007 | 0.522 | 0.567 | 0.933 | 0.878 | 0.388 | 0.567 | 0.488 |
| Qwen 3.5 4B | 0.622 | +0.167 | 0.008 | 0.411 | 0.500 | 0.844 | 0.829 | 0.449 | 0.500 | 0.419 |
| Ministral 3 14B | 0.500 | +0.044 | 0.503 | 0.533 | 0.578 | 0.967 | 0.805 | 0.245 | 0.578 | 0.492 |
| Gemma 4 E4B | 0.511 | +0.056 | 0.332 | 0.511 | 0.600 | 0.933 | 0.854 | 0.224 | 0.600 | 0.505 |
| Qwen 3.5 2B | 0.567 | +0.111 | 0.087 | 0.456 | 0.433 | 0.911 | 0.780 | 0.388 | 0.433 | 0.379 |
| Ministral 3 8B | 0.456 | +0.000 | 1.000 | 0.522 | 0.511 | 0.856 | 0.756 | 0.204 | 0.511 | 0.411 |
| Ministral 3 3B | 0.389 | -0.067 | 0.327 | 0.300 | 0.356 | 0.767 | 0.610 | 0.204 | 0.356 | 0.290 |
| Gemma 4 E2B | 0.289 | -0.167 | 0.008 | 0.333 | 0.278 | 0.844 | 0.463 | 0.143 | 0.267 | 0.178 |
| Qwen 3.5 0.8B | 0.200 | -0.256 | \(<0.001\) | 0.167 | 0.111 | 0.433 | 0.220 | 0.184 | 0.111 | 0.060 |
3pt
Ibrahim Fateen, Collected and Categorized Wound Images Dataset, Kaggle, https://www.kaggle.com/datasets/ibrahimfateen/wound-classification (accessed on 29 June 2026).↩︎
Medetec, Medetec Wound Database: stock pictures of wounds, https://www.medetec.co.uk/files/medetec-image-databases.html (accessed on 29 June 2026).↩︎