Beyond Vague Visual Descriptions
When developers query multimodal vision models about images, standard prompts yield qualitative, un-actionable prose:
“The image shows a website with a blue navigation header, a search bar in the middle, and three product cards below.”
In automated UI testing, robotic process automation (RPA), or digital design inspection, qualitative text is useless. You cannot click on “a search bar in the middle”. You need exact, pixel-precise coordinates.
Spatial Grounding Prompting forces multimodal models to localize visual elements using normalized bounding box coordinates.
1. Normalized Coordinate Space (0 to 1000)
Because images come in different resolutions and aspect ratios, prompting models in raw pixels ($1920 \times 1080$) leads to rounding errors.
The industry standard is Normalized 1000-Point Coordinates:
$$[y_{\min}, x_{\min}, y_{\max}, x_{\max}] \in [0, 1000]$$
[0, 0] ----------------------------- [0, 1000]
| |
| [ymin, xmin, ymax, xmax] |
| ┌───────────┐ |
| │ UI Button │ |
| └───────────┘ |
| |
[1000, 0] ------------------------- [1000, 1000]
To convert normalized coordinates back to actual screen pixels: $$\text{pixel}_x = x \times \frac{\text{image_width}}{1000}, \quad \text{pixel}_y = y \times \frac{\text{image_height}}{1000}$$
2. The Spatial UI Detection Prompt
<spatial_detection_task>
<objective>
Locate all interactive UI elements on the attached mobile app screenshot.
</objective>
<coordinate_system>
Express all bounding boxes as [ymin, xmin, ymax, xmax] on a normalized 0-1000 grid.
</coordinate_system>
<target_classes>
- primary_button
- text_input_field
- toggle_switch
- icon_navigation
</target_classes>
<output_schema>
Return strictly a JSON array of objects conforming to:
{
"element_class": string,
"text_label": string | null,
"bounding_box": [ymin, xmin, ymax, xmax],
"confidence": float
}
</output_schema>
</spatial_detection_task>
3. Visual Debugging: Validating Design System Compliance
Spatial prompts can also verify design system compliance on live web renders:
<design_audit>
Examine the attached webpage render.
Inspect all buttons against the 8px grid system.
For every component where padding or vertical alignment deviates from the design spec:
1. Output its bounding box: [ymin, xmin, ymax, xmax].
2. Identify the visual defect (e.g. "Misaligned baseline icon", "Padding is 6px instead of 8px").
3. Suggest the CSS utility fix.
</design_audit>
4. Key Takeaways
- Use Normalized 0–1000 Grids: Eliminates resolution scaling errors across different client displays.
- Follow Standard Coordinate Order: Use $[y_{\min}, x_{\min}, y_{\max}, x_{\max}]$ for compatibility with vision foundation models.
- Pair Detection with Labeling: Extract the verbatim text label alongside the coordinates in a single forward pass.