| name | spatial-ssrl-spatial-understanding-rl |
| title | Spatial-SSRL: Enhancing Spatial Understanding via Self-Supervised RL |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2510.27606 |
| keywords | ["Spatial Reasoning","Self-Supervised Learning","Vision-Language Models","Reinforcement Learning","3D Understanding"] |
| description | Improve spatial reasoning in vision-language models through five automatically-formulated pretext tasks (patch shuffling, flipping, inpainting, depth ordering, 3D position) that require zero human annotation, using only RGB/RGB-D images and RL optimization for 4% accuracy gains. |
Title: Train Spatial Reasoning Through Vision-Only Pretext Tasks and RL
Vision-language models struggle with spatial relationships despite being trained on billions of image-text pairs. Spatial-SSRL fixes this by creating five pretext tasks that derive supervisory signals directly from image structure—no human annotation needed. Tasks range from simple (reorder shuffled patches) to geometric (predict 3D positions). The model learns through Group Relative Policy Optimization on automatically-generated question-answer pairs from existing datasets.
The key insight is that images contain all necessary geometry; you just need the right pretext tasks to make it explicit.
Core Concept
Self-Supervised Spatial Learning:
- Five Pretext Tasks: Shuffled patch reordering, flipped patch recognition, patch inpainting, regional depth ordering, relative position prediction
- Zero-Human-Annotation: All ground truth derived from image structure or depth maps
- GRPO Optimization: Group Relative Policy Optimization on structured reasoning
- Dual-Modality Support: RGB-only tasks and RGB-D (depth-dependent) tasks
- Automatic Dataset Generation: 81K QA pairs from existing datasets (COCO, DIODE, MegaDepth)
Architecture Overview
- Pretext Task Set: Two categories (RGB-free, depth-based) with automatic question generation
- Training Data: Spatial-SSRL-81k dataset with no manual annotation
- GRPO Framework: Reward combination (accuracy 90% + format 10%) using reasoning-style outputs
- Cold-Start Phase: Brief supervised fine-tuning before RL optimization
- Target Models: Applied to Qwen2.5-VL (3B, 7B variants)
Implementation Steps
1. Define Five Pretext Tasks with Automatic Question Generation
Create task-specific question-answer generation from images.
class SpatialPretext:
@staticmethod
def shuffled_patch_reordering(image, patch_size=32, num_patches=16):
patches = image.unfold(2, patch_size, patch_size).unfold(, patch_size, patch_size)
perm = torch.randperm(num_patches)
shuffled = patches[perm]
question =
answer =
question, answer
():
patches = image.unfold(, patch_size, patch_size).unfold(, patch_size, patch_size)
flip_idx = torch.randint((patches), (,)).item()
patches[flip_idx] = torch.flip(patches[flip_idx], dims=[-])
question =
answer =
question, answer
():
patches = image.unfold(, patch_size, patch_size).unfold(, patch_size, patch_size)
mask_idx :
mask_idx = torch.randint((patches), (,)).item()
masked_patches = patches.clone()
masked_patches[mask_idx] = torch.zeros_like(masked_patches[mask_idx])
candidates = [patches[mask_idx]] + [patches[torch.randint((patches), (,))] _ ()]
correct_idx =
question =
answer =
question, answer, candidates
():
h, w = image.shape[-:]
region_h, region_w = h // num_regions, w // num_regions
regions = []
i (num_regions):
region_depth = depth_map[i*region_h:(i+)*region_h, :].mean()
regions.append((i, region_depth.item()))
sorted_regions = (regions, key= x: x[])
question =
answer =
question, answer
():
pt1 = torch.tensor([image.shape[-]//, image.shape[-]//])
pt2 = torch.tensor([image.shape[-]*//, image.shape[-]*//])
depth1 = depth_map[pt1[], pt1[]]
depth2 = depth_map[pt2[], pt2[]]
question =
answer = depth1 < depth2
question, answer