--- license: cc-by-4.0 language: [yo, vi, fr, en] task_categories: [visual-question-answering, image-to-text] tags: [ocr, diacritics, yoruba, nigeria, vlm-evaluation, blind-spot, low-resource] pretty_name: Ìbàdàn Vision Gap --- # Yoruba Vision Gap ### Small VLMs read the letters of Yoruba but not its meaning — and bend Nigerian documents toward Western defaults **Model evaluated:** [`Qwen/Qwen3-VL-4B-Instruct`](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) (≈4.4B parameters, Apache-2.0) · optional second model `Qwen/Qwen2.5-VL-3B-Instruct` **Evaluation set:** 360 synthetic, exactly-labelled probes (352 images) in 6 families, every probe paired with a control **Everything here is reproducible:** `vision_gap_eval.ipynb` runs on a free Colab T4 and writes the Results section below automatically. | Path | What it is | | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | `README.md` | this file — answers to Q1 (the gap) and Q3 (path forward), method, results | | `data/images/` | 352 PNG/JPG probe images | | `data/metadata.jsonl` / `.csv` | one row per probe: id, family, condition, prompt, ground truth, answer type, options, metadata | | `build_dataset.py` | deterministic generator for the whole set (`python build_dataset.py --out data --seed 7`) | | `scoring.py` | diacritic-aware automatic scoring (exact, letters-only, mark recall/precision by mark type, ANLS for comparison) | | `vision_gap_eval.ipynb` | Colab notebook: load model → run → score → tables → figures → README → upload | | `results//predictions.jsonl` | every raw model answer, with latency | | `results/scored.csv`, `results/summary.md`, `results/failure_gallery.md`, `results/figures/` | scored rows, headline table, worst cases, plots | | `model/.json` | pinned model revision (commit SHA), dtype and decoding settings used | --- ## 1. The blind spot (Question 1) ### What it is Yoruba is a tonal language written in the Latin alphabet. Its meaning lives in two kinds of marks that standard English OCR treats as decoration: - **tone marks** — grave (low tone, `à`), acute (high tone, `á`), unmarked (mid tone); - **under-dots** — `ẹ`, `ọ`, `ṣ` are different letters from `e`, `o`, `s`. Take away the marks and words collapse into each other: | written | meaning | written | meaning | | ------- | ------------- | ------- | ------------ | | ọkọ | husband | igbá | calabash | | ọkọ̀ | vehicle, boat | ìgbà | time, period | | ọ̀kọ̀ | spear | igba | two hundred | | ọkọ́ | hoe | ìgbá | garden egg | The gap I am testing is that **vision-language models read the base letters of Yoruba text correctly but drop, flatten or invent the marks**, so they return a different word while looking almost right. Around it sits a broader pattern I see in Nigerian documents generally: **when local visual evidence conflicts with the model's Western prior, the prior wins.** The naira sign `₦` becomes `N` or `$`; `03/04/2026` on an invoice becomes March instead of April; and a model asked "the total on this Bodija receipt is $13,200, correct?" is tempted to say yes. ### Why this comes from my own background - **Signage and names.** Street signs, church and mosque boards, market stalls, palace and council notices, and people's names (Adébáyọ̀, Fọláṣadé, Olúwaṣẹ́un) are written with tone marks. Strip them and an identity or a place name is wrong — the kind of error that breaks a student-records system, a KYC check or a land document search. - **Documents arrive as WhatsApp photos.** Receipts, admission letters, bank tellers and government circulars are photographed on a phone and forwarded several times. Each hop recompresses the JPEG, and tone marks — two or three pixels tall — are the first detail to disappear. - **Money and dates are local.** Prices are in naira; on a keyboard without `₦` people write `N2,500` or `#2,500`. Dates are DD/MM/YYYY. A model that silently converts either into US conventions produces confident, wrong numbers. ### Why standard benchmarks miss it 1. **Coverage.** Text-in-image benchmarks (TextVQA, DocVQA, ChartQA, OCRBench, and multilingual ones such as MTVQA and CC-OCR) are dominated by English and a handful of high-resource languages; to my knowledge none tests Yoruba orthography, the naira sign or Nigerian document conventions. Culturally diverse VQA sets ask about scenes, not about reading tone-marked text. 2. **The metric hides it.** OCR benchmarks score with character error rate or ANLS. A dropped tone mark is a single character edit: reading _Ẹ kú àárọ̀_ ("good morning") as _Ẹ kú àárọ_ gets **ANLS 0.90 — a pass** and reading _ọkọ̀_ (vehicle) as _ọkọ_ (husband) gets 0.75. Some evaluation pipelines also strip accents before comparison, which erases the error entirely. The gap is therefore invisible _by construction_, not just by omission. 3. **Leaderboards reward the prior.** On English-heavy test sets, defaulting to `$` and MM/DD is usually right, so the behaviour that fails Nigerian users is the behaviour that scores well. --- ## 2. Choice of model and how it was evaluated (Question 2) ### Model: `Qwen/Qwen3-VL-4B-Instruct` - **Size:** ≈4.4B parameters — inside the 0.6–6B window and runs in fp16 on a free 16 GB T4. - **Frontier-representative:** it shares the architecture and training recipe of the Qwen3-VL family whose 235B flagship is among the strongest open-weight VLMs, so its failure modes are a fair, cheap proxy for the flagship's (the notebook includes an optional cell that re-asks the hardest slice to the 235B model to check this directly). - **A fair test, not a strawman:** the model card advertises expanded OCR for 32 languages, robustness to "low light, blur, and tilt", native dynamic resolution, and DeepStack multi-level vision features for fine detail. If a model that claims all of this still drops tone marks, the problem is not image resolution or a weak OCR head. - **Second opinion:** `Qwen2.5-VL-3B-Instruct` (previous generation) can be switched on in the notebook to test whether the gap persists across generations; Gemma-3-4B and SmolVLM2-2.2B are also supported by the same harness. Decoding is greedy (`do_sample=False`), one image per prompt, no system prompt, so results are deterministic and reproducible. The exact model revision is pinned in `model/*.json`. ### The evaluation set All 360 probes are rendered synthetically (Pillow + HarfBuzz/raqm, so stacked marks like `ọ̀` are positioned correctly) from five fonts and five sign colour schemes. Synthetic rendering gives **exact ground truth** and lets every probe change **one variable at a time**. | Family | n | Probe | Matched control | Question it answers | | -------------------------------------- | --- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `diacritics` / `yo` | 96 | 24 Yoruba items (12 minimal-pair words, 6 place names, 6 phrases) × 4 conditions | — | Can it transcribe Yoruba exactly? | | `diacritics` / `yo-ascii` | 48 | the same 24 items with all marks removed (2 conditions) | **same letters, same font, same layout** | Is the failure about the marks, or about the words? Does it _invent_ marks? | | `diacritics` / `vi` | 32 | 8 Vietnamese items × 4 conditions | **same mark shapes** (dot-below, grave, acute, stacked) in a high-resource language | Is it the pixels, or the language? | | `diacritics` / `fr` | 32 | 8 French items × 4 conditions | grave/acute in the highest-resource accented language | — | | `minimal_pairs` / `mc_spelling` | 24 | pick the exact spelling from the minimal set (+ stripped form) | chance ≈ 23% | Can it _see_ the mark when it doesn't have to write it? | | `minimal_pairs` / `meaning_from_image` | 8 | "what does this word mean?" for ọkọ/ọkọ̀/ọ̀kọ̀/ọkọ́ and igbá/ìgbà/igba/ìgbá | `meaning_from_text`: same question with the word typed in the prompt (8) | Does the mark it saw change what it _understands_? Does it know the word at all? | | `currency` / `symbol_*` | 32 | price tags `₦500 … ₦15,000`, clean and WhatsApp-compressed | identical tags in `$`, `£`, `€` | Is `₦` read as `₦`? | | `currency` / `name_*` | 12 | name the currency: `₦` glyph; `N2,500` and `#2,500` on a Bodija Market tag | — | Does it know Nigerian price conventions? | | `receipts` | 24 | Bodija provision-store receipt in `₦`: neutral total + false-premise total (wrong currency or wrong amount) | identical Austin, TX receipt in `$` | Is it more sycophantic on local documents? | | `dates` | 16 | invoice dated `03/04/2026`-style (day ≤ 12) | the same strings on US invoices; invoices with day > 12 | Does it read the date in the document's own locale? | | `known_controls` | 28 | counting 3–32 dots, left/right, English menu transcription + false premise | — | How does this gap compare with blind spots already in public benchmarks? | **Conditions** (diacritics family): `L_clean` 72 px text, lossless · `L_wa` same, then _WhatsApp-forwarded_ (±2.5° tilt, 0.6× downscale, slight blur, JPEG q=35) · `S_clean` 28 px text · `S_wa` 28 px + WhatsApp. ### Scoring (`scoring.py`) - **Exact match** after Unicode NFC, case-folding and whitespace cleanup — tone marks and dots are never stripped. - **Letters-only match** (marks removed on both sides) — separates "read the wrong letters" from "read the right letters, wrong marks" (`marks_only_error`). - **Mark recall / precision by type** (`dot_below`, `grave`, `acute`, …) after aligning base letters, plus **spurious marks** on the stripped control (hallucinated diacritics). - **ANLS** on the same answers, to show what a standard OCR benchmark would have scored. - Currency symbol and amount parsed separately (`N2,500` is reported as semantically right but not exact); YES/NO parsing for false premises, plus whether the true total was stated; month parsing for dates; letter parsing for multiple choice. ### How the probes add up to a diagnosis | If the results show… | …the gap is | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | | Yoruba ≪ stripped Yoruba, and Yoruba ≪ Vietnamese on the _same_ mark types | about the **language**, not about seeing small marks (data coverage) | | multiple-choice spelling ≫ free transcription | a **generation prior**: the model sees the mark but writes the ASCII form | | multiple-choice ≈ chance and falls with font size / compression | a **perception** limit on 2–3 px features | | meaning-from-text ≫ meaning-from-image | the model knows the word but the visual mark doesn't reach its reasoning | | `₦` ≪ `$ £ €`, US-reading of Nigerian dates, higher sycophancy on the Bodija receipt | a **locale prior** overriding visual evidence | | known controls fail too, but Yoruba fails at sizes where ASCII succeeds | the gap is specific, not general weakness | --- ## 3. Results _Pending: run `vision_gap_eval.ipynb` (cell 10 writes this section from the run)._ --- ## 4. Path forward (Question 3) The probes above are designed to say _which_ of the fixes below matters most; this is the plan I would follow. ### 4.1 Data curation — the main lever 1. **Synthetic Yoruba text-in-image at scale (cheap, exact labels).** Scale `build_dataset.py` into a renderer driven by real Yoruba text — MENYO-20k, Yoruba Wikipedia, BBC Yorùbá news, public-domain religious text — rendered in 50+ fonts including hand-painted sign styles, onto signs, receipts, posters, bulletins and government forms, with a degradation pipeline that reproduces how Nigerian documents actually travel: repeated WhatsApp JPEG compression, phone-camera blur, perspective, low light. Rendering must go through HarfBuzz (as here) or stacked marks come out wrong and poison the data. Target: ~1M image–text pairs, NFC-normalised. 2. **Real photos with native-speaker labels (small, high value).** Photograph signage, receipts and notices in Nigeria and have two native speakers transcribe each one, with disagreements adjudicated. A few thousand images is enough for evaluation and for a final fine-tuning stage; it also catches things synthesis misses, such as hand lettering and faded paint. 3. **Minimal-pair hard negatives.** For every image, store alternative transcriptions that differ _only_ in marks (ọkọ / ọkọ̀ / ọ̀kọ̀ / ọkọ́). These become the rejected side of preference pairs and the distractors of contrastive training — the model must learn that these differences matter. 4. **Locale-grounded document QA.** Nigerian receipts, invoices, tellers and forms with `₦`, `N` and `#` prices, DD/MM dates and `+234` numbers, paired with question–answer data in which a good share of questions carry a **false premise whose correct answer is "No, it says …"**. 5. **Fix the measurement.** Report a diacritic error rate and mark recall separately from CER/ANLS, never strip accents during evaluation, and add Yoruba and Igbo (ị, ọ, ụ, ṅ) slices to OCR leaderboards. As long as the metric scores _ọkọ̀ → ọkọ_ at 0.75, no one will optimise for it. ### 4.2 Fine-tuning paradigm 1. **Stage 1 — supervised fine-tuning that reaches the vision side.** LoRA on the language model _plus_ unfreezing the vision–language merger and the top vision blocks (for Qwen3-VL, including the DeepStack fusion paths), trained on transcription and document QA from 4.1. If the probes show a perception limit, adapting only the LLM will not fix it. 2. **Mark-weighted loss.** Combining marks are a small share of output tokens, so plain cross-entropy barely notices them. Up-weight the loss on tokens containing tone marks or under-dots (e.g. 3–5×). 3. **Stage 2 — preference optimisation.** DPO (or an image-conditioned variant such as mDPO) with pairs _chosen = correct marks_ vs _rejected = stripped or wrong tone_, and _chosen = "No, the total is ₦13,200"_ vs _rejected = "Yes"_. This targets exactly the two behaviours measured here: flattening and sycophancy. 4. **Keep everything else intact.** Mix in ≥50% general replay data and re-run OCRBench and the known controls after each stage so that fixing Yoruba does not break English. ### 4.3 Architectural adjustments 1. **Resolution where the text is.** A tone mark on 28 px text is 2–3 pixels; after patching and 2×2 token merging one visual token covers roughly a 32×32 px area, so the mark is a small fraction of one token. Detect text regions and re-encode them at higher resolution (a learned "zoom" pass), rather than paying for high resolution everywhere. 2. **Character-level grounding head.** Add an auxiliary CTC OCR head on the vision features, trained on diacritic-exact targets, so the model has pixel-grounded evidence for each mark that the decoder can attend to. 3. **Tokenizer.** Byte-level BPE splits `ọ̀` into several rare tokens, which gives the decoder a strong prior toward the ASCII spelling. Adding tokens for frequent Yoruba vowel-plus-mark clusters (initialised from the mean of their pieces) lowers that prior. 4. **Calibrated abstention.** When the evidence for a mark is weak — a heavily compressed photo — the model should say the tone is unreadable instead of guessing; this is cheap to train with the hard negatives above. **Cheapest test of this plan:** LoRA-tune Qwen3-VL-4B on ~50k synthetic renders from 4.1 (stage 1 + mark-weighted loss), then re-run this notebook. Success = Yoruba exact match reaches the Vietnamese control on held-out fonts and real photos, with no drop on OCRBench and the known controls. --- ## Limitations - Images are synthetic. They control variables cleanly but do not capture hand lettering, faded paint or real camera optics; the real-photo set in 4.1 is the natural next step. - The ambiguous-date probes have no single "correct" answer in isolation; they measure whether the model uses the locale cues present (Addresses, `+234` phone, `₦` amounts), and are reported separately from unambiguous dates. - Yoruba orthography follows standard written Yoruba and the minimal-pair glosses were reviewed by the author; please open an issue if you spot an error. - Greedy decoding on one prompt wording per probe; prompt sensitivity is not measured here. ## Licence and citation Dataset (images + metadata): CC-BY-4.0. Code: MIT. Model weights: see the original model licence (Apache-2.0).