Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Improve multimodal LLMs on fine-grained visual reasoning tasks (e.g., reading transit maps) by decomposing training into stages: basic perception (VQA) -> simple reasoning -> complex spatial reasoning. Incorporates 'detail rewards' for intermediate visual understanding, bootstrapping models from simple to complex tasks while addressing sparse reward challenges.
RewardMap: Bootstrapping Visual Reasoning via Staged Reward Design
Fine-grained visual reasoning tasks—reading complex diagrams, reasoning about spatial relationships, extracting details from images—are notoriously hard for multimodal LLMs. The challenge is that end-to-end RL on these tasks produces sparse rewards: the model either completely solves a transit map puzzle or gets zero reward. This forces the model to learn everything simultaneously, which is inefficient.
RewardMap decomposes this into stages: start with simple perception tasks (answering basic questions about images), advance to spatial reasoning, and finish with complex multi-step tasks. Each stage includes intermediate "detail rewards" that provide richer supervision, turning sparse binary rewards into dense signals that guide learning.
Core Concept
RewardMap's multi-stage curriculum uses three reward types:
Perception rewards: VQA-style questions about visual details (e.g., "What color is this box?") Score: 1 if correct.
Intermediate rewards: Partial reasoning steps (e.g., "Did you correctly identify the starting point?") Score: 0-1 based on intermediate correctness.
Task rewards: Full problem completion (e.g., "Did you find the correct transit route?") Score: 1 if task solved.
By training stage-by-stage with appropriate reward signals, the model learns perception first, then spatial reasoning, then complex multi-step logic—building capabilities progressively rather than learning all at once.
Architecture Overview
Stage 1 (Perception): Simple VQA on image details, binary rewards
Stage 2 (Basic Reasoning): Spatial understanding (which object is left of X?), detail rewards
Stage 3 (Complex Reasoning): Full task completion (find route from A to B), combined rewards
Reward module: Computes detail, intermediate, and task-level rewards
Data curator: ReasonMap-Plus dataset with annotated intermediate steps
Implementation Steps
Start by building the perception stage with VQA rewards:
import torch
import torch.nn.functional as F
classVQARewardComputer:
"""
Compute perception-level rewards from visual question answering.
"""def__init__():
.vqa_model = vqa_model
():
ground_truth = .vqa_model.get_answer(image, question)
is_correct = predicted_answer.strip().lower() == ground_truth.lower()
(is_correct)
():
rewards = []
img, ans, q (images, answers, questions):
reward = .compute_perception_reward(img, ans, q)
rewards.append(reward)
torch.tensor(rewards)
self, vqa_model
self
# Pretrained VQA answerer
def
compute_perception_reward
self, image, predicted_answer, question
"""
Score predicted answer against ground truth using VQA.
Args:
image: Visual input (PIL or tensor)
predicted_answer: Model's predicted answer (text)
question: VQA question (e.g., "What color is the top box?")
Returns:
reward: 1.0 if correct, 0.0 otherwise
"""
# Get ground truth answer from VQA model
self
# Simple string match for now (could use embeddings)
Multimodal LLM training where perception is a bottleneck
Tasks where you can specify intermediate milestones
Compute budgets support multi-stage training
When NOT to use:
Simple visual tasks (classification, detection) — standard supervised learning is simpler
Tasks without clear intermediate steps
Single-stage end-to-end optimization is acceptable
Extreme time constraints (curriculum overhead may not pay off early)
Training efficiency improvements:
Approach
Accuracy
Total Compute
Convergence
End-to-end RL
65%
100%
Slow (200 epochs)
RewardMap Stage 1-3
72%
110%
Fast (6 epochs)
Improvement
+7%
+10%
33x faster convergence
Reward configuration by stage:
Stage
Primary Reward
Secondary Reward
Typical Accuracy Gain
1 (Perception)
Binary VQA
None
40-50% → 60%
2 (Reasoning)
Detail rewards
None
60% → 70%
3 (Complex)
Task + detail
None
70% → 75%+
Common pitfalls:
Weak intermediate annotations: If step labels are incorrect, detail rewards train the model wrong. Validate annotations on 50 examples before full training.
Stage too long: If stage 1 takes 50 epochs, students get bored and diverge. Use 2-3 epochs per stage; let learning rate decay handle convergence.
Reward discount mismatch: All stages should have similar reward scales (0-1 range). If stage 3 has rewards in 0-100 range, adjust scaling.
Curriculum too rigid: Some examples are inherently hard. Allow examples to skip stages if needed (e.g., hard tasks go straight to stage 3).
Integration checklist:
Prepare full task dataset with annotated intermediate steps (50+ examples minimum)
Extract or generate VQA questions for perception stage
Train verifier model to score intermediate steps (validate on 30 examples)
Run stage 1 for 2 epochs; validate perception accuracy improves
Run stage 2 for 2 epochs; validate spatial reasoning improves
Run stage 3 for 3 epochs; validate full task accuracy improves