TL;DR
SheetCompass is a novel, graph-guided, and memory-driven multi-agent framework designed to master complex spreadsheet reasoning. By transforming flat tabular data into a hierarchical relation graph that preserves both spatial layouts and semantic connections, it enables LLM agents to navigate and manipulate multi-dimensional workbooks with human-like visual awareness. The framework achieves state-of-the-art performance across multiple complex benchmarks, significantly outperforming traditional text-flattening approaches.
What Problem Does This Paper Address?
While Large Language Models (LLMs) excel at understanding sequential text, spreadsheets are inherently visual, grid-based, and multi-dimensional. Standard LLM toolchains typically handle spreadsheets by "flattening" them into linear strings like Markdown or JSON.
This serialization approach breaks the spreadsheet's structural integrity in two major ways:
- Intra-sheet level: It shatters the orthogonal row-and-column positioning system, separating neighboring cells within the token stream and obscuring the original grid layout.
- Inter-sheet level: It hides implicit data dependencies and business logic across different worksheets (e.g., linking a cost sheet to a price sheet), turning connected data flows into isolated text fragments.
As a result, LLMs struggle with complex, cross-table reasoning tasks because they are deprived of the global spatial layouts that human experts naturally leverage during visual scanning.
Methods
To bridge this spatial understanding gap, SheetCompass introduces a framework structured around three pillars:
1. Hierarchical Graph Construction
Instead of linear text, SheetCompass models a spreadsheet as a hierarchical graph $G = (V, E)$ consisting of two tiers: table nodes and column nodes. The edges are divided into:
- Structural Edges ($E_{str}$): Automatically extracted via deterministic parsing rules to capture physical layouts (inclusion boundaries and horizontal adjacency).
- Semantic Edges ($E_{sem}$): Established by combining vector embeddings (using a pre-trained transformer to compute spatial-semantic similarity) and LLM-based logic verification (e.g., identifying primary/foreign keys).
2. Dual-Level Memory Mechanism
- Expert Knowledge Memory: A permanent repository containing static domain rules (e.g., formula constraints, chart types) and tool-use lessons learned from historical code-execution errors.
- Reasoning Experience Memory: A dynamic, short-term episodic log of the current task session (agent movements, sandbox error messages) that feeds back into the prompt loop to prevent repetitive mistakes. Successful trajectories are later transferred to long-term memory.
3. Coordinated Multi-Agent Workflow
SheetCompass orchestrates three specialized agents to execute tasks within a secure Python/Excel sandbox:
- Navigational Explorer: Deconstructs high-level user instructions into atomic steps and performs a breadth-first search on the graph to isolate a compact, task-relevant shared subgraph.
- Logical Programmer: Generates code variables strictly anchored to verified graph nodes, preventing ungrounded code generation.
- Critical Reflector: Translates user constraints into a concrete checklist, validates the spreadsheet's metadata state post-execution, and provides diagnostic feedback for iterative self-repair.
Datasets
The authors evaluated SheetCompass on three specialized benchmarks featuring complex sheet structures:
- SheetCopilotBench (SCB): 221 real-world software control tasks focusing on advanced manipulations like formulas, pivot tables, and charts.
- SpreadsheetBench (SB): 912 real user instructions from online forums; highly heterogeneous, with 35.7% containing multiple tables per sheet and 42.7% showing non-standard relational layouts. Each task includes three independent test cases to evaluate robustness.
- SheetRM: A subset of 90 multi-category tasks from professional spreadsheet exams, characterized by long-horizon reasoning chains and ambiguous requirements.
Key Insights and Ideas
- The Visual Grid Matters: The foundational insight is that spreadsheet reasoning is a spatial-cognitive task. Giving agents a graph-based topological map allows them to preserve grid properties without suffering from token overflow.
- The Shift in Edge Importance: In simpler, single-table tasks, the model relies heavily on physical layout (structural edges dominate at ~81-87%). However, as tasks transition to complex multi-table scenarios, the proportion of semantic edges utilized increases significantly (up to nearly 30% in SCB). This highlights that physical layout alone is insufficient when cross-table data connections are hidden.
- Self-Repair via State Checking: Syntactically valid code can still be semantically wrong (e.g., treating a percentage discount rate like
0.15as an absolute monetary deduction). The Reflector agent catches these domain-logic mismatches by checking the resulting spreadsheet state against business realities, triggering successful adaptive retries.
Key Results
SheetCompass consistently achieved state-of-the-art results across all benchmarks, outperforming strong baselines like Binder, SheetCopilot, and SheetAgent:
- Using GPT-4: SheetCompass improved the
pass@1metric on SCB to 63.2% and the stricthard restrictionmetric on SB to 18.3%, noticeably surpassing the closest baselines. - Scaling to GPT-5: Performance scaled up dramatically, reaching 71.3% on SCB, 22.0% on SB (hard restriction), and 52.3% on SheetRM.
- Resilience to Multi-Table Complexity: While traditional linear-input methods saw sharp performance drops when moving from single-table to multi-table tasks, SheetCompass proved highly resilient due to its stable structural anchors.
Limitations and Future Work
The authors do not include a dedicated limitations section, but hyperparameter sensitivity analyses point to clear boundaries:
- Graph Thresholding ($\alpha$): The framework is sensitive to the confidence threshold used to build the graph. Setting it too low introduces noisy, low-confidence nodes that mislead agents, while setting it too high prunes critical data paths.
- Reasoning Cycles ($\tau$): While iterative refinement helps, performance plateaus or slightly declines after 2 cycles, meaning the framework cannot indefinitely fix deeply flawed initial plans without incurring high computational costs or introducing unhelpful code edits.
Summary updated