Evaluation
Base vs. fine-tuned, both in fp16 with greedy decoding and identical prompts.
Table with columns: Benchmark, Prompt, N, Base acc, Fine-tuned acc, Δ acc, Base relaxed, Fine-tuned relaxed| Benchmark | Prompt | N | Base acc | Fine-tuned acc | Δ acc | Base relaxed | Fine-tuned relaxed |
|---|
| VQAv2 (held-out) | standard | 300 | 64.3 | 62.7 | -1.7 | 64.7 | 63.0 |
| VQAv2 (held-out) | train-style | 300 | 0.3 | 66.0 | 65.7 | 50.0 | 67.0 |
| TextVQA (val) | standard | 200 | 52.3 | 59.2 | 6.8 | 54.3 | 60.3 |
| TextVQA (val) | train-style | 200 | 12.7 | 58.0 | 45.3 | 56.2 | 61.7 |
- VQAv2 (held-out): 300 samples from merve/vqav2-small that were not used for training (in-domain).
- TextVQA (val): first 200 samples of lmms-lab/textvqa validation (out-of-domain).
- acc: VQA accuracy after answer normalisation (exact match; min(1, matches/3) when 10 human answers exist).
- relaxed: a ground-truth answer appears anywhere in the output (less sensitive to answer length).
- Prompts: standard = image, question, then "Answer the question using a single word or phrase." (lmms-eval VQA format);
train-style = "Answer briefly.", image, question (the fine-tuning format).
These are small-sample evaluations, so differences of a few points are within noise.
Official benchmark suite
Base and fine-tuned models evaluated side by side (fp16, greedy decoding) with lmms-eval prompts and each
benchmark's official metric: VQA accuracy (VQAv2, TextVQA), exact match (GQA), ANLS (DocVQA), relaxed accuracy
(ChartQA), multiple-choice accuracy (AI2D, MMBench, MMStar, ScienceQA) and the OCRBench rule (shown as %).
"Lite" = the official 500-question lmms-eval Lite subsets; the rest are the full official splits.
"Published base" = SmolVLM-500M scores reported by Hugging Face (full splits, their setup), for reference.
Δ = fine-tuned − base with a paired 95% confidence interval.
Table with columns: Benchmark, Split, Metric, Published base, Base (ours), Fine-tuned, Δ, 95% CI| Benchmark | Split | Metric | Published base | Base (ours) | Fine-tuned | Δ | 95% CI |
|---|
| VQAv2 | val, lmms-eval Lite (500) | VQA acc | - | 64.2 | 61.3 | -2.9 | ±2.8 |
| GQA | testdev-balanced, Lite (500) | exact match | - | 53.6 | 51.2 | -2.4 | ±3.6 |
| TextVQA | val, Lite (500) | VQA acc | 60.5 | 56.0 | 59.2 | 3.2 | ±3.4 |
| DocVQA | val, Lite (500) | ANLS | 70.5 | 60.4 | 66.2 | 5.8 | ±2.8 |
| ChartQA | test, Lite (500) | relaxed acc | 63.2 | 51.0 | 51.4 | 0.4 | ±3.1 |
| AI2D | test, Lite (500) | MC acc | 79.7 | 48.4 | 49.8 | 1.4 | ±3.5 |
| MMBench-EN | dev, Lite (500) | MC acc | - | 65.0 | 64.6 | -0.4 | ±2.9 |
| OCRBench | full (1000) | OCRBench | 61.0 | 57.7 | 58.5 | 0.8 | ±2.1 |
| MMStar | val, full (1500) | MC acc | 38.3 | 34.2 | 32.5 | -1.7 | ±2.1 |
| ScienceQA-IMG | test, full (2017) | MC acc | 79.7 | 66.9 | 66.2 | -0.6 | ±1.5 |
Average: base 55.7 → fine-tuned 56.1 (+0.3)
- Absolute scores here run below Hugging Face's published numbers (different evaluation setup), so compare base vs. fine-tuned within this table.
- DocVQA: the gain is answer formatting. The base model ends answers with a period, which ANLS penalises; with trailing periods stripped, base 68.3 vs. fine-tuned 66.0.
- The published AI2D and ScienceQA values are both listed as 79.7 in the source chart.
Usage
import torchfrom transformers import AutoProcessor, AutoModelForImageTextToTextfrom transformers.image_utils import load_image model_id = "Masa84/SmolVLM-500M-VQAv2-FT"processor = AutoProcessor.from_pretrained(model_id)model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.float16, device_map="auto") image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg")messages = [{"role": "user", "content": [ {"type": "text", "text": "Answer briefly."}, {"type": "image"}, {"type": "text", "text": "What insect is on the flower?"}]}]prompt = processor.apply_chat_template(messages, add_generation_prompt=True)inputs = processor(text=prompt, images=[[image]], return_tensors="pt").to(model.device, dtype=torch.float16)out = model.generate(**inputs, max_new_tokens=32, do_sample=False)print(processor.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
Training details
- Method: QLoRA (4-bit NF4 base, double quant, fp16 compute), LoRA r=8, alpha=16, dropout=0.05
- Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Data: 1000 samples of merve/vqav2-small (VQAv2), prompt "Answer briefly.", target = multiple_choice_answer
- 1 epoch, effective batch size 8, lr 2e-4 (cosine), 10 warmup steps, fp16, single T4 GPU
Limitations
Trained on a small VQAv2 subset, so it favours very short answers and inherits the base model's
limitations and biases. Evaluate it on your own data before relying on it.
License & attribution
Apache 2.0, inherited from the base model HuggingFaceTB/SmolVLM-500M-Instruct by Hugging Face.