Manuscript Offprint

arXiv:2608.30751

Autoregressive Mosaics: Probing 2D Spatial Reasoning in Text-Only Language Models

Ashwin Nedungadi, Stefan Oehmcke, Stefan Lüdtke

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Large language models (LLMs) trained only on text and code can sometimes generate programs that draw recognizable images. However, it is unclear whether this reflects an internal representation of 2D spatial layout or simply the ability to translate spatial descriptions into code. We introduce Autoregressive Mosaics (AM-Bench), a benchmark that separates these factors: First, a translation task gives a model a fully specified geometry of a picture in words as a prompt and asks for the code that produces it. Second, a layout task requires the model to compose an image from an underspecified prompt. Across eight open-weight text-and-code-only models, all models reliably translate specified geometry into code, but their open-ended layout performance differs substantially, indicating that these differences are not explained by code-generation ability alone. An output-medium ablation further shows that the interface or medium of expression that the model uses matters: replacing procedural code with raw SVG improves layout scores across all models. Finally, probing model activations shows that a coarse layout plan is present before generation, but reflects only the layout implied by the prompt. During generation, models track the evolving geometric state instead of executing an initially fixed plan. Overall, these results show that 2D spatial performance in text-only LLMs depends on both the model and the output medium, and is not explained by code-generation ability alone.

1. Introduction

Eşref Armağan, a painter who is born blind, can draw scenes with linear perspective, occlusion, and consistent shading, with his visual cortex active while he draws [1, 24]. These studies show that in humans, a usable internal model of 2D visual structure exists without ever having seen it. Language models trained only on large scale text and code data exhibit similar abilities: they have never seen an image, yet GPT-4 drew a recognizable unicorn in TikZ when asked [4]. This phenomenon has been observed in literature [4, 28] but has not been investigated in depth until now. It raises some fundamental questions:

To what extent can text-only language models compose and reason about 2D spatial layouts, how does the output medium limit this capability, and does the model construct a useful internal spatial representation, or does it primarily learn to express spatial descriptions through code?

An LLM-generated image alone cannot distinguish these possibilities. A model may produce a poor layout because it fails to compose the spatial arrangement, because it cannot express a suitable layout in the required programming language, or because the output medium itself constrains how that layout can be expressed. Existing evaluations typically entangle these factors: recognition benchmarks [33, 42, 45] require visual input, and generative evaluations only assess the final output without separating spatial composition from the ability to translate a spatial description into an executable representation.

We therefore introduce Autoregressive Mosaics (AM-Bench, see Fig. 1), a benchmark designed to separate spatial composition from spatial expression. AM-Bench represents an image as an autoregressive mosaic, a small raster produced by a program and rendered by a deterministic executor. This evaluates two complementary tasks. In the translation task, the prompt specifies the complete geometry of the image, and the model must express that geometry as code. In the layout task, the prompt is underspecified and the model must determine the spatial arrangement itself. Thus, translation provides a control for code-generation ability, while layout measures the additional challenge of composing a spatial arrangement. The translation task is scored by an exact-area geometric metric in continuous coordinates, so the score does not depend on canvas resolution. The layout task has no reference geometry to score against, so it is scored by vision language models (VLM), validated by human scorers which provide supporting evidence for the

†^{\dagger} Main author.

Research Question

Do text-only LLM models hold a usable internal model of 2D layout, and when one fails to draw, is the layout absent, or present but untranslatable into the output medium?

Figure

Figure 1. Overview of AM-Bench. The benchmark consists of a four-stage pipeline (prompt, internal plan, program code, rasterized geometry). The translation task states the layout fully in the prompt; in the layout task, layout is underspecified and needs to be decided by the model. Three experiments test expression (Exp. 1), influence of the output medium (Exp. 2), and whether a plan is decodable before generation at all (Exp. 3).

judge’s ranking signal. Further, we evaluate whether spatial performance is determined by how the model must express its output, by comparing the code interface with raw SVG generation. Finally, we probe model activations before generation to ask whether a coarse spatial layout is represented before any drawing code is produced. We complement this with a causal intervention on the geometric state to test whether models use such a representation during generation.

Across eight open-weight text-and-code-only models, all models reliably solve the translation task, but their performance differs substantially on the open-ended layout tasks, showing that code generation is not the main bottleneck. Second, replacing procedural canvas code with raw SVG improves layout scores across all models, showing that output medium influences results. Third, a coarse spatial representation is present before generation, but it only reflects the layout implied by the prompt. During generation, models instead track the evolving geometric state, consistent with an incremental construction process rather than execution of a fixed layout plan. Overall, these results show that 2D spatial performance in text-only language models depends on both the model and the output medium, and is not explained by code-generation ability alone. We release all code, prompts, and generations on our Project Page 2^{2}.

References (46)