Addressing the fine-grained recognition scenario of Mediterranean and European diets, this paper proposes OliveGemma, an open-source vision-language model adapted from PaliGemma-2-3B via LoRA, which under a closed-vocabulary evaluation protocol outperforms general-purpose frontier VLMs with far more parameters while supporting fully local deployment.
Frontier closed-source vision-language models built for general-purpose scenarios, even with larger parameter counts and broader coverage of general tasks, are outperformed under a closed-vocabulary fine-grained diet recognition evaluation protocol by small specialized models that have undergone targeted domain adaptation. The typical capability shortcoming of such general models manifests as follows: they can usually cover the correct food category among their Top-3 or Top-5 predictions, but when required to output a single best prediction, they struggle to distinguish highly visually similar fine-grained food subcategories. This phenomenon shows that simply increasing model parameters cannot directly guarantee better performance in specialized subdomains.
Among the many vision-language architectures, PaliGemma-2 has several properties suited to domain transfer: it combines the SigLIP vision encoder with the Gemma-2 language decoder through lightweight linear projection layers, and is released as an open-weights model at a practical 3B parameter scale. Unlike assistant-style models oriented toward conversational interaction, PaliGemma-2 is positioned as a transferable vision-language foundation model, which after task-specific fine-tuning achieves strong performance on a wide range of downstream vision-language tasks. These properties make it a suitable backbone candidate for developing reproducible, locally deployable food recognition systems.
This study proposes OliveGemma, an open-weights vision-language model based on the PaliGemma-2-3B architecture and domain-adapted via LoRA, designed specifically for fine-grained compositional diet recognition. The model's training data come from a unified dataset integrated from three datasets—MedGR, ODIN, and VIPPSTAR—containing a total of 17,340 images, with all annotations mapped to a standard vocabulary covering 216 food categories. The study also established a fair cross-architecture comparative evaluation system: all compared models, including fine-tuned CNN architectures, OliveGemma, and zero-shot frontier VLMs from Google, OpenAI, and Anthropic, were evaluated using the same dataset splits and label space, thereby excluding interference from other variables and precisely isolating the performance gains attributable to domain adaptation. Combined with the figure below, you can fully trace the study's end-to-end design logic from dataset statistics, validation schemes, and training settings to evaluation rules.
The dataset used in this study was formed by merging three heterogeneous datasets—MedGR, ODIN, and VIPPSTAR—from different European research projects, yielding a unified collection of 17,340 images, each with a source identifier and a dish label. The raw data contained 250 distinct dish folders, and many entries referred to the same food due to language differences or differing annotation granularity; for example, the Italian-labeled pollo and the English-labeled chicken refer to exactly the same dish yet were placed in different folders. By aligning and merging the source folders, the study derived a unified standard recognition vocabulary, eliminating such annotation redundancy.
OliveGemma completed domain adaptation with a standard LoRA parameter configuration: rank r set to 16, scaling factor α set to 32, corresponding to an effective scaling ratio α/r of 2, and a dropout rate of 0.05 for the low-rank branches. Matrix A was initialized with a Gaussian distribution of mean 0, and matrix B was initialized to all zeros, ensuring that the incremental weight ΔW was 0 at the start of fine-tuning, with training starting entirely from the pre-trained PaliGemma-2 model. During the entire fine-tuning stage, only the LoRA A and B parameters were updated; the vision encoder, projection layers, and original language model weights all remained frozen, with LoRA modules inserted into the 7 projection layers of each layer of the Gemma-2 decoder. Combined with the image that follows, you can intuitively understand the distribution of frozen components and trainable modules across the model architecture.
All comparative experiments adopted a unified three-fold cross-validation scheme with an identical 216-class closed-vocabulary evaluation protocol, covering three groups: CNN baselines, closed-source frontier vision-language models, and OliveGemma, thereby excluding interference from evaluation setting differences on result fairness. All closed-source frontier VLMs ran in a zero-shot setting, without any task-targeted fine-tuning on this food dataset.
In the CNN baseline group comparisons, DenseNet-121 was the strongest CNN model, with the remaining baselines ranked by Top-1 performance as MobileNet-V3-Large, ResNet-50, and EfficientNet-B3. This ranking does not match the conventional ordering by the models' original parameter counts or ImageNet pre-training performance; since all CNN backbones were frozen and only the top linear classification head was trained, this performance difference stems entirely from each network's pre-trained features' ability to discriminate fine-grained foods. All CNN baselines' Top-3 and Top-5 accuracies improved by more than 10 percentage points over their Top-1, indicating that the frozen pre-trained features can already narrow candidate samples down to a very small set, but a linear head alone cannot complete the final fine-grained judgment among visually highly similar classes.
Under the unified three-fold cross-validation evaluation, OliveGemma achieved a Top-1 accuracy of 92.96±0.91%, 7.31% higher than the strongest CNN baseline DenseNet-121, and also showed significant advantages over zero-shot closed-source frontier VLMs: about 18% higher than Gemini Flash 3.5, about 46% higher than GPT-5.4 Mini, and about 64% higher than Claude Haiku 4.6. On Top-3 and Top-5 accuracy, OliveGemma was also competitive, ranking second among all compared CNN and frontier closed-source models, only slightly below DenseNet-121.
The generally lower performance of closed-source frontier VLMs in the zero-shot setting stems mainly from the fact that such general-purpose models have not undergone targeted adaptation to the fine-grained diet recognition domain; they can often include the correct food category in a high-confidence candidate set but cannot reliably rank it first among predictions. OliveGemma, through LoRA parameter-efficient fine-tuning, completed domain-targeted adaptation and can more reliably distinguish visually highly similar Mediterranean and European food categories, which is the core reason for its substantial lead over general-purpose closed-source VLMs on the Top-1 metric.
Existing high-performing commercial general-purpose vision-language models are accessible only through proprietary cloud APIs and commonly suffer from insufficient reproducibility, high deployment costs, and difficulty guaranteeing data privacy—especially in clinical dietary assessment scenarios requiring that user images remain on institutional internal infrastructure, where closed-source solutions face clear practical limitations.
In terms of output stability after deployment, OliveGemma's ingredient set predictions show highly balanced precision and recall, neither systematically over-generating nor missing ingredients, achieving an F1 of 95.5±0.6% under the sample-average set overlap metric, with 90.8±1.3% of image samples achieving exact matches between predicted and reference ingredient sets.
The current work still has clear known boundaries: its unified training dataset covers only 216 Mediterranean and European diet categories, and many regional cuisines have not yet been included; subsequent work requires supplementing dietary datasets from more regions to further expand the diversity and complexity of the label space, especially for distinguishing visually highly similar carbohydrate staples such as different varieties of rice and noodles. Future extensions of this research also include expanding OliveGemma from closed-set recognition to open-vocabulary food understanding, nutritional estimation, and integration with clinical dietary assessment systems.