How uddipan77/analysis-of-lightweight-vision-language-models-for-document-ocr-and-structured-output-generation works
This repository is a research benchmarking framework for structured OCR on three collections of historical German documents. Its workflow runs model experiments on labeled image/JSONL data, generates structured predictions, and compares them with ground truth. The README documents zero/few-shot inference, fine-tuning, HPO, preprocessing and training variants; the tree shows implementations across eight model families, OCR baselines, labeling tools, metrics, and interactive UIs. Relationships among these mostly standalone scripts are shown only where documented or visible in excerpts; many implementations were not sampled.
Main entry points: finetune Fine-tuning · zero_few_shots Zero/few-shot runs · map_f1_and_anls OCR metrics · data_labels_creation Label creation
Components 22
Data preparation
- Label creation
data_labels_creation - Document collections
VLM experiments
- Donut experiments
DONUT - Florence-2 experiments
florence2 - PaddleOCR-VL experiments
paddleocr - Gemma experiments
gemma3 - Nanonets experiments
nanonets - Phi experiments
phivision - Qwen experiments
qwen - Zero/few-shot runs
gemma3/zero_few_shots - OCR baselines
non_vlm
Training studies
- Fine-tuning
gemma3/finetune - Hyperparameter search
gemma3/hpo - Image preprocessing
gemma3/image_preprocess - Multi-stage training
gemma3/multistage_and_multidataset - Multi-dataset training
gemma3/multistage_and_multidataset/multidataset_finetune.py
Evaluation
- OCR metrics
map_f1_and_anls
User interfaces
- Phi OCR interface
UI_codes/phi_ui.py - Gemma OCR interface
UI_main/gemma_ui_docker.py - Model inference
UI_codes/phi_ui.py
Other components
- Researcher
- Document user
Connections 27
- Researcher → Label creation: creates labels
- Label creation → Document collections: produces labels
- Document collections → Zero/few-shot runs: supplies examples
- Document collections → Fine-tuning: supplies splits
- Researcher → Zero/few-shot runs: runs experiments
- Zero/few-shot runs → OCR metrics: evaluates predictions
- Researcher → Fine-tuning: trains baseline
- Fine-tuning → Hyperparameter search: tunes baseline
- Hyperparameter search → Fine-tuning: exports best parameters
- Fine-tuning → Image preprocessing: branches to study
- Fine-tuning → Multi-stage training: branches to study
- Fine-tuning → Multi-dataset training: branches to study
- Document collections → Multi-dataset training: combines datasets
- Researcher → OCR baselines: runs comparisons
- Researcher → Donut experiments: runs model scripts
- Researcher → Florence-2 experiments: runs model scripts
- Researcher → PaddleOCR-VL experiments: runs model scripts
- Researcher → Gemma experiments: runs model scripts
- Researcher → Nanonets experiments: runs model scripts
- Researcher → Phi experiments: runs model scripts
- Researcher → Qwen experiments: runs model scripts
- PaddleOCR-VL experiments → OCR metrics: computes CER
paddleocr/zero_shot_code/stair_inference.py - OCR metrics → Researcher: reports scores
- Document user → Phi OCR interface: submits document
UI_codes/phi_ui.py - Phi OCR interface → Model inference: routes prediction
UI_codes/phi_ui.py - Document user → Gemma OCR interface: submits document
UI_main/gemma_ui_docker.py - Gemma OCR interface → Gemma experiments: runs inference