Geometry-Aligned Resampling for Spatial Questions in Vision-Language Models

Object detectors hit a specific failure years ago. The branch that adjusts a box to fit an object moves the box, but the branch that decides what the object is keeps reading features from the old, unadjusted location. Detection researchers called this spatial feature misalignment. They fixed it by turning the adjusted box into sampling offsets for a deformable convolution, a convolution whose sampling points can move off the regular grid to wherever the network points them. We argue that today's vision-language models (VLMs, systems that answer questions about images in text) have the same failure in a new form, and that it contributes to their well-documented weakness on questions like "is the cup on or under the box?". When a grounded VLM reasons about two objects, it often names or even predicts their locations. The evidence it then uses to answer still comes from a fixed grid of square image patches that ignores the geometry it just inferred.

The proposal is to close that loop. The VLM first predicts coarse geometry for the objects mentioned in the question: a box plus a few keypoints. That geometry is converted into sampling offsets over the vision encoder's feature map. The resulting object-aligned features, together with features sampled along the path between the two objects, are fed back to the language model before it answers. Two sentences capture it. Spatial answers should be computed from features sampled where the model thinks the objects are, not from a fixed patch grid. Detection showed that tying the sampling offsets to predicted geometry, instead of learning them freely, is what makes deformable sampling work.

Core Claim

Our central claim is that part of the spatial reasoning deficit in VLMs is a feature-alignment problem rather than only a data or language problem. We further claim that geometry-driven deformable resampling recovers accuracy on relation types where rigid patches mix the two objects or the background. The two targets are support and occlusion relations of the What'sUp kind and orientation relations such as facing. The claim becomes testable because it predicts a specific ordering. Geometry-driven deformable resampling should beat rigid box pooling from the same predicted boxes. Rigid box pooling should beat writing the coordinates as text. Resampling driven by ground-truth geometry should set an upper bound, and the gap to that bound measures how much is lost to bad geometry versus bad reasoning.

Three strands of evidence motivate this. On the detection side, Hierarchical Shot Detector showed that features sampled at original anchor locations capture mostly background or neighbouring objects. Its Reg-Offset-Cls module regresses the box first, derives deformable offsets from it, and only then classifies, reaching 33.5 AP on COCO with VGG16. Cascade RPN and EFGRNet make the same move, computing kernel sampling positions from the evolving box, and Cascade RPN gained 13.4 points of average recall. On the VLM side, Visual Spatial Reasoning found that models with explicit coordinate inputs outperformed those without, which suggests location information is useful but underused. SpatialRGPT showed that a dedicated region feature extractor plus depth input lifts qualitative spatial accuracy far above GPT-4V.

Two findings constrain the design. First, the research file notes that deformable offsets trained only on task loss tend to drift into uninformative regions. We therefore do not learn offsets freely; they are a deterministic function of predicted geometry plus a small bounded residual. Second, What's "up" with vision-language models? found that fine-tuning on existing spatial data produced shortcuts and lower What'sUp accuracy. Any gain we report must therefore survive controls that hold the training data fixed.

Research Program

The build starts from an open VLM of the LLaVA-1.5 family, which the file lists as a commonly evaluated model with a plain Vision Transformer encoder over rigid square patches. We add three things.

The first is a short geometry-prediction step. For each object named in the question, the model emits a box and three keypoints (a centre and two points indicating the principal axis or front direction). The format resembles the structured scene step of SpatialThinker, but it is supervised directly with boxes from existing grounding data.

The second is a resampler. It places a $k \times k$ grid of sampling points inside each predicted box, rotated and stretched along the predicted axis, and reads the encoder's pre-projection feature map at those continuous positions by bilinear interpolation. This follows the offset construction of Deformable Convolutional Networks and the sparse reference-point sampling of Deformable DETR. Concretely, the sampling location for grid point $n$ is

$$q_n = c + A\,r_n + \epsilon\,\tanh(\delta_n),$$

where $c$ is the predicted centre, $A$ is the $2\times2$ matrix built from the predicted box size and axis, $r_n$ is the fixed grid point in a unit square, $\delta_n$ is a learned residual, and $\epsilon$ caps that residual at a small fraction of box size. The bound on $\epsilon$ is what prevents the drift problem. A second set of points is sampled along the segment between the two object centres to capture the gap, contact, or overlap region that decides relations like on, under, and in front of.

The third addition is a re-injection step. The resampled features are projected into a few extra tokens per object and per pair, and the model answers conditioned on them.

The analysis half of the program measures misalignment directly. For each question we record where the model's predicted boxes fall and how much of the original patch attention mass lies inside them. We then ask whether errors concentrate where the two diverge. This is the VLM analogue of the classification-localization disconnect documented by IoU-aware Single-stage Object Detector. That paper's oracle experiment with ground-truth quality suggested a 14 AP headroom. We run the matching oracle, driving the resampler with ground-truth boxes, to size the headroom in the spatial setting.

Baselines

The naive reference point is the unmodified base VLM fine-tuned on exactly the same spatial question-answer data we use, with no geometry step and no resampling. This isolates the effect of our training data from our architecture. The What'sUp shortcut finding makes that control mandatory.

The strongest existing method on this question is SpatialRGPT, which feeds region features and a depth plugin into the language model. It reports 92.69% accuracy on qualitative relations in SpatialRGPT-Bench and 87.9% on BLINK Relative Depth. Because it uses region inputs and depth that our method does not, we compare in two ways. First, we compare against its published numbers on its own benchmark. Second, we re-implement its region-feature pathway on our base model and training data, without depth, so the only difference is how region features are sampled. Beating it means exceeding the re-implemented version at equal data, parameter count, and tuning budget, and approaching or matching 92.69 when our method is also given depth. On What'sUp, the strongest number in the file is 56% for BLIP fine-tuned on VQAv2, against 99% for humans. On VSR, the strongest models sit around 70% against 95.4% for humans. Meaningful gains above those figures under the same data control would count as a clear result. For SpatialThinker we found no reported result on Lacuna for any of these benchmarks in the file excerpt, so we will run it as a reasoning-based comparator on the same base model and data rather than quote a number.

The ablation that isolates the key ingredient keeps the geometry step and the extra tokens identical but replaces deformable resampling with rigid axis-aligned box pooling from the same predicted boxes. A second ablation lets the offsets be freely learned instead of geometry-driven. A third removes the between-object segment samples. All variants share one training recipe, one hyperparameter sweep of equal size, and one compute budget.

Why not just…?

Why not just fine-tune on large synthetic spatial data? SpatialVLM did this with 2 billion synthetic question-answer pairs and reached 75.2% on qualitative predicates. It still hit only 8.4% on metric estimates within a tight margin. What'sUp found fine-tuning can reduce generalization. This is a real threat to our claim. Our data-matched baseline settles it: if the plain fine-tuned model matches us on What'sUp and VSR's concept zero-shot split, the architectural claim fails.

Why not just crop or pool the region the model predicts, as region-based VLMs do? This is the most serious alternative, and it is why rigid box pooling is our main ablation rather than an afterthought. The detection evidence from R3Det is suggestive, not decisive for VLMs. Its feature refinement for rotated boxes added 2.8 mAP over axis-aligned sampling on DOTA. We expect deformable sampling to matter mainly for orientation and contact relations. If rigid pooling ties it everywhere, we will report that alignment rather than deformability is the operative ingredient and narrow the claim accordingly.

Why not just have the model write coordinates as text and reason over them? This works partly, as the coordinate-input results in VSR suggest. But text coordinates discard appearance, such as which side of a chair is its front or whether a cup touches a box. A text-coordinates variant with the same geometry step and no resampling will show whether the extra visual evidence contributes beyond the numbers.

Why not just use higher-resolution patches? More tokens reduce the mixing of objects within a patch, but they do not make evidence follow predicted geometry. We will include a variant with doubled token count at matched compute to check this.

Proposed Experiments

We train all variants on the same mixture of grounding boxes and spatial question-answer pairs. Evaluation covers What'sUp accuracy, VSR accuracy broken down by relation and by the concept zero-shot split, SpatialRGPT-Bench qualitative accuracy, BLINK Relative Depth, and ViewSpatial-Bench, where GPT-4o scored 34.98% against a random baseline of about 26%. We expect little gain on ViewSpatial-Bench, since perspective-taking needs a viewpoint transformation that resampling does not supply. That makes it a useful negative control.

Three checks are decisive. The first is the predicted ordering: ground-truth-driven resampling above geometry-driven deformable resampling, which is above rigid pooling, which is above text coordinates. The gains should concentrate on facing and on/under relations, not spread uniformly. The second is a counterfactual swap on What'sUp pairs. We exchange the resampled tokens between the two photos of a pair while keeping the patch tokens fixed. If the model answers from the aligned evidence, its answer should flip. If it answers from priors like the "on-table" bias, it should not. The third is a geometry-noise sweep. We perturb predicted boxes by controlled amounts and plot accuracy. If the method's advantage vanishes as geometry degrades, alignment is the mechanism rather than extra parameters. The same curve tells us how much of the remaining gap to humans belongs to localization and how much to reasoning.