Bridging the gap between AI and cultural understanding
A comprehensive framework for evaluating and fine-tuning Vision-Language Models (VLMs) on cultural heritage datasets, with a special focus on Egyptian cultural artifacts and museum collections.
- Identifying cultural blind spots in existing VLMs through systematic evaluation
- Creating culturally-aware datasets from scratch using innovative data collection methods
- Developing specialized fine-tuning techniques that respect cultural context
- Providing a robust evaluation framework that goes beyond standard metrics
We're not just building another AI model β we're creating a bridge between artificial intelligence and human cultural understanding.
Name
- π Multi-Model Benchmarking: Comprehensive head-to-head evaluation of 6 different Vision-Language Models
- ποΈ Cultural Heritage Expertise: Specially crafted for Egyptian cultural heritage using the National Museum of Egyptian Civilization dataset
- π― Three Fine-tuning Flavors: Choose between Full fine-tuning (maximum power), LoRA (efficient adaptation), or RAG (external knowledge integration)
- π Comprehensive Evaluation: Multiple metrics that actually matter - BLEU, ROUGE, METEOR, BERTScore, and Exact Match
- βοΈ Fair Play Protocol: Matched-size evaluation ensures no model gets an unfair advantage
- π€ Automated Data Pipeline: From concept to dataset in one go - scrape, validate, and structure cultural data automatically
git clone https://github.com/python-arch/CulTex-VLM.git
cd CulTex-VLM
pip install -r requirements.txtBecause one metric is never enough
Our evaluation goes beyond simple accuracy to capture the nuances of cultural understanding:
- BLEU-4: Measures how well generated text matches reference answers (n-gram precision)
- ROUGE-1/2/L: Focuses on recall - does the model capture the key information? (unigrams, bigrams, longest common subsequences)
- METEOR: The sophisticated metric that considers stemming, synonyms, and word order - perfect for cultural nuances
- Cross-Entropy Loss: The training objective - lower is better
- BERTScore-Fβ: Uses RoBERTa-large to measure semantic similarity at the sentence level
- Exact Match (EM): Sometimes you need the answer to be exactly right - strict string matching after normalization
Why multiple metrics? Cultural content is complex. A model might get the gist right (good ROUGE) but miss specific cultural terms (bad Exact Match). Our comprehensive evaluation captures these subtleties.
Choose your adventure based on your resources and needs
"Go big or go home"
- Updates all 384.9M parameters of BLIP
- Maximum adaptation capability for your specific cultural domain
- Perfect when you have the computational resources and want the best results
- Higher computational requirements but potentially superior performance
"Smart efficiency meets effectiveness"
- The sweet spot between performance and efficiency
- Injects tiny low-rank matrices (r=8) into attention projections
- Only trains 0.077% of parameters while keeping the massive backbone frozen
- Applied strategically to query, key, and value projections in both image encoder and language decoder
- Perfect for researchers with limited GPU resources
"Knowledge without training"
- Zero fine-tuning approach - your base model stays untouched
- Integrates external cultural knowledge through intelligent retrieval
- Uses CLIP-based similarity search with ChromaDB FAISS index
- Retrieves top-3 most relevant captions as context for each query
- Ideal when you want to add cultural knowledge without model modification
We created our cultural heritage datasets using two innovative approaches, starting from the ground up since existing VQA datasets lack cultural domain coverage.
Our journey began with building a robust automated data collection system specifically designed for cultural content:
What we collected:
- 270+ Egyptian cultural entities (from "Tutankhamun" to "Koshari" to "Siwa Oasis")
- Over 5,000 high-quality images scraped from DuckDuckGo
- Rich textual descriptions from Wikipedia and Encyclopedia Britannica
- Structured, organized data ready for model training
How we did it:
- Smart Image Scraping: Used Playwright to automate DuckDuckGo image search (avoiding Google's restrictions)
- Rich Context Gathering: Pulled comprehensive background information from Wikipedia API
- Enhanced Coverage: Supplemented with Encyclopedia Britannica's chatbot for deeper cultural insights
- Quality Organization: Each cultural concept gets its own folder with 20 images and detailed background information
From our collected cultural data, we developed two distinct approaches to create question-answer pairs:
"Let the images tell their stories"
Starting with 50 carefully curated image-caption pairs, we used an automated pipeline inspired by Visual Question Generation with Question Answering validation:
- Smart Answer Extraction: Used spaCy to intelligently parse captions and extract potential answers (nouns, verbs, adjectives, spatial relationships)
- Natural Question Generation: Leveraged DeepSeek API to create human-like questions from extracted answers
- Quality Validation: Implemented F2 score filtering to ensure question-answer consistency
- Impressive Scale: Transformed 50 image-caption pairs into 1,706 validated VQA triplets (34Γ expansion!)
"Systematic cultural exploration"
A more structured approach focusing on cultural categories:
- Cultural Classification: Organized images into meaningful categories (food, clothing, architecture, rituals)
- Expert-Crafted Templates: Created category-specific question templates like "What traditional dance is this?" or "What type of architecture is shown?"
- AI-Enhanced Diversity: Used Gemini API to generate additional natural variations
- Human Review: Manual validation to ensure cultural accuracy and authenticity
| Dataset | Size | Train | Validation | Description |
|---|---|---|---|---|
| VQ2A Original | 2,750 | 2,475 | 275 | Caption-generated questions |
| VQ2A Cleaned | 1,705 | 1,534 | 171 | Quality-filtered version |
| CultureVLM | 1,800 | 1,600 | 200 | Template-based cultural questions |
| IconDomainVQA | 4,364 | 3,928 | 436 | Domain-agnostic baseline |
We implemented a matched-size protocol to ensure fair model comparisons:
- Global cap: 2,750 samples (matching our largest custom dataset)
- Smart sampling: Uniform sampling for larger datasets to maintain representativeness
- Consistent splits: 90:10 train/validation with fixed random seed (42)
- Preserved diversity: Maintains each dataset's intrinsic cultural distribution
git clone https://github.com/python-arch/CulTex-VLM.git
cd CulTex-VLM
pip install -r requirements.txtfrom cultex_vlm import VLMEvaluator
evaluator = VLMEvaluator(model_name="blip", dataset="cultured_vlm")
results = evaluator.evaluate(metrics=["bleu", "rouge", "bertscore"])
print(f"Your model scored: {results['bertscore_f1']:.3f} on cultural understanding!")from cultex_vlm import BLIPFineTuner
# The sweet spot between performance and efficiency
tuner = BLIPFineTuner(
method="lora", # Efficient training
rank=8, # Low-rank adaptation
learning_rate=2e-5, # Gentle learning
cultural_focus=True # Our secret sauce
)
# Transform your model in minutes, not hours
model = tuner.train(dataset_path="data/egyptian_heritage", epochs=10)from cultex_vlm import RAGPipeline
# No training needed - just add knowledge!
rag = RAGPipeline(
clip_model="ViT-B/32",
k_neighbors=3,
knowledge_base="egyptian_cultural_database"
)
# Ask anything about cultural artifacts
answer = rag.generate(
image_path="mysterious_artifact.jpg",
question="What historical period is this artifact from?"
)
print(f"Cultural insight: {answer}")results/
βββ evaluation/
β βββ bleu_scores.json
β βββ rouge_scores.json
β βββ meteor_scores.json
βββ models/
β βββ full_finetune/
β βββ lora/
β βββ rag/
βββ logs/
βββ training_logs.txt
``