A Comparative Analysis of Few-Shot Learning Models for Text-Based Diagnosis of Crop Pests and Diseases in Ghana
Abstract
The scarcity of agricultural extension officers and la belled data in Ghana necessitates innovative solutions for crop disease management. This paper presents the de sign, implementation, and evaluation of a text-based AI advisory system for diagnosing crop pests and diseases in maize, tomato, and cassava, three staple crops central to Ghanaian food security. The system is grounded in Few-Shot Learning (FSL) using the SetFit framework, which fine-tunes a pre-trained Sentence Transformer through contrastive Siamese network training, enabling generalisation from as few as eight labelled examples per class. A structured dataset of 17,045 plant clinic consul tation records was curated from 17,087 raw records and used to construct a 66-class few-shot classification task. Three model paradigms were benchmarked: TF-IDF with Logistic Regression (baseline), SetFit with all MiniLM-L12-v2, and DistilBERT fine-tuned end-to end. Under strict few-shot conditions (8 samples per class), TF-IDF achieved the highest raw accuracy (65.78%) while SetFit (46.28%) demonstrated substan tially superior semantic embedding quality (cosine sepa ration Δ=0.519; Pearson ρ=0.707) and more reliable con fidence calibration (ECE=0.303 vs 0.613). DistilBERT failed entirely in the few-shot regime (2.08% accuracy), confirming that full fine-tuning is inappropriate for low resource settings. We explicitly report this finding, as a substantive empirical contribution and analyse its causes, including the constrained, template-derived vo cabulary of the plant clinic records. SetFit was selected and deployed due to its semantic reasoning capabilities and superior confidence calibration, demonstrating the viability of transformer-based FSL for data-scarce agri cultural AI in developing regions.