How Do Language Models Understand Tables? A Mechanistic Analysis of Cell Location

Xuanliang Zhang, Dingzirui Wang, Keyan Xu, Qingfu Zhu, Wanxiang CheNeurIPS 2026

TL;DR

When you feed a 2D spreadsheet into a 1D language model, it doesn't just guess cell values using fuzzy word associations—it builds an internal GPS. By dissecting how LLMs look up single cells, researchers discovered a clean three-stage assembly line: matching headers, literally counting pipe delimiters (|) and newlines to calculate (row, column) coordinates, and copying the result to the output. Best of all, this internal coordinate grid is linear, meaning you can shift the model's gaze left or right across columns using simple vector math.

What Problem Does This Paper Address?

Transformers live in Flatland: they process text strictly as one-dimensional sequences of tokens. Yet we routinely flatten two-dimensional tables into Markdown or HTML strings and expect LLMs to reason over rows and columns.

While plenty of engineering tricks improve tabular performance, how a sequential model reconstructs 2D spatial logic under the hood has remained a black box. Previous mechanistic interpretability work focused on natural language tasks like factual recall, leaving open a fundamental question: how does an LLM navigate rigid spatial coordinates when all it sees is a single line of text?

Methods

To isolate structural reasoning from memorized facts, the authors zoom in on the atomic task of cell location (given a row header and column header, output the intersecting cell). They inspect four open-weights model families (Qwen, Llama, Mistral, and Gemma, from 0.6B to 32B parameters), focusing primarily on Qwen3-4B.

They combine standard interpretability tools with clever table-specific diagnostics:

  • Activation Patching & Zero Ablation: Swapping internal states between "clean" and "corrupted" queries (where the target row or column is changed) or zeroing out specific attention heads to prove causal necessity.
  • Linear Probing: Training simple linear regressors on hidden states to see when and where row and column numbers become readable.
  • Virtual-RoPE Coordinate Diagnostic (Novel): Models use Rotary Positional Embeddings (RoPE) to track sequence positions. The authors test attention heads counterfactually by feeding logical column indices (e.g., Column 3) into RoPE instead of raw token positions to spot "coordinate-encoding heads."
  • Activation Steering: Extracting a "unit shift vector" between adjacent columns and adding multiples of it to hidden states to shift which column the model reads.

Datasets

  • Synthetic Cell-Location Benchmark (New): 500 Markdown tables serialized with pipes (|) and newlines. Cell values are randomly sampled from an entity pool so models cannot cheat using pre-trained world knowledge.
  • HiTab: An existing real-world dataset of complex, hierarchical tables featuring nested/merged headers and aggregation tasks, used to verify that findings generalize beyond toy setups.

Key Insights and Ideas

  • A Three-Stage Pipeline: Table lookup happens in distinct layer bands. Early layers (1–16) handle Semantic Binding, matching your question's text to the right headers. Middle layers (17–23) handle Coordinate Localization, abstracting away from words to find the geometric intersection. Late layers (24+) execute Information Propagation, where "mover heads" copy the located cell's value to the final token for decoding.
Figure 1: Average column patching ef- fect score across layers and token posi- tions by corrupting the queried column. The heatmap shows a three-stage causal flow: early-layer dependence on query constraints (Iq), mid-layer dependence on the target cell (It(vr,c)), and near- zero late-layer sensitivity.
  • Delimiters Are Clock Signals: How does the model know what column a cell is in? It counts punctuation. Linear probes reveal that coordinate indices appear first on pipe (|) and newline (\n) delimiters in early layers before propagating to actual cell text after Layer 15. Column predictions form a clean sawtooth wave (counting up across pipes, resetting at newlines), while row predictions form a staircase.
Figure 6: Layer 17 probe predictions (blue) versus gold column/row index (orange) across linearized table cells. The column probe forms a sawtooth pattern that resets at row boundaries, and the row probe forms a stepwise function that increments across newlines, supporting a delimiter-driven ordinal coordinate system for tracking table cells during location.
  • Columns Live in a Linear Subspace: Column indices are represented as equidistant steps along a straight line in activation space. If you take the vector that shifts focus by +1 column, multiplying it by 3 shifts focus by +3 columns, and adding a +1 vector to a +3 vector cleanly mimics a +4 shift.

Key Results

  • Row Binding Is Causal and Fragile: Zero-ablating the top 20 row-alignment heads crashes synthetic accuracy from 94.4% to 5.2%. On real-world HiTab tables, ablating these heads causes 57.4% of outputs to collapse into empty answers.
  • Precise Geometric Alignment: In middle layers, coordinate-encoding heads track logical column indices with a Pearson correlation of 0.997 on synthetic tables (and 0.988 on HiTab's complex matrix indices).
Figure 3: Virtual-RoPE coordinate di- agnostic for coordinate-encoding heads. Logical column indices are used as vir- tual rotary positions. The diagonal pat- tern shows that target column indices are aligned with table column positions.
  • Delimiters Drive Causal Control: Patching attention heads selected from delimiter probes yields massive causal recovery (0.958 Effect Score for columns, 0.527 for rows), whereas heads selected from cell-content probes do almost nothing (0.025 and 0.006).
  • Additive Vector Steering: On column steering, a composite shift vector (+1 + +3) achieves an Effect Score of 1.169, closely matching a directly extracted +4 vector (1.079).

Limitations and Future Work

The main text notes a few natural boundaries to this internal coordinate system (while deferring broader discussion to appendices):

  • Scale Degradation: Probe prediction errors grow as row and column counts get larger, showing that the delimiter-counting mechanism degrades as table dimensions expand.
  • Local, Format-Dependent Steering: Linear column steering works locally—it weakens at large column offsets and table boundaries, and formats like HTML require format-specific vector extraction rather than a universal representation.
  • Hierarchical Bottlenecks: In complex real-world tables (HiTab), translating nested/merged header hierarchies into clean matrix coordinates remains a major failure bottleneck, even when row binding succeeds.

Summary updated

Abstract

While Large Language Models (LLMs) are increasingly deployed for table-related tasks, the internal mechanisms enabling them to process linearized two-dimensional structured tables remain opaque. In this work, we investigate the process of table understanding by dissecting the atomic task of cell location. Through activation patching and complementary interpretability techniques, we delineate the table understanding mechanism into a sequential three-stage pipeline: Semantic Binding, Coordinate Localization, and Information Propagation. We demonstrate that models locate the target cell via an ordinal mechanism that counts discrete delimiters to resolve coordinates, offering mechanistic evidence across diverse table formats. Furthermore, column indices are encoded within a linear subspace that allows for precise steering of model focus through vector arithmetic. Finally, we extend our analysis to the real-world HiTab dataset and show that the same three-stage mechanism persists in hierarchical real-world tables and more complex tasks.
BibTeX
@inproceedings{zhang2026how,
  author = {Xuanliang Zhang and Dingzirui Wang and Keyan Xu and Qingfu Zhu and Wanxiang Che},
  title = {{How Do Language Models Understand Tables? A Mechanistic Analysis of Cell Location}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=Fyw87Kl3h1},
}
Figure