Abstract
Large Language Models (LLMs) face significant challenges when processing spreadsheets due to their two-dimensional structure, large scale, and inherent redundancy. We present SHEETENCODER, a framework that compresses spreadsheets by up to 25x while simultaneously enhancing the reasoning capabilities of LLMs. By employing structural-anchor-based compression, inverted-index translation, and data-format-aware aggregation, SHEETENCODER achieves state-of-the-art performance on spreadsheet understanding tasks, outperforming specialized models by over 12%.
Introduction
Spreadsheets are a ubiquitous medium for data storage and analysis, yet they pose significant challenges for Large Language Models (LLMs). Unlike linear text, spreadsheets are inherently two-dimensional, often containing thousands of cells, complex formatting, and multiple tables within a single file. Standard serialization methods often fail due to token limits, loss of spatial context, and high redundancy.
Problem Statement
LLMs face three primary hurdles when processing spreadsheets:
- Token Limits: Large files exceed context windows.
- Spatial Complexity: 1D serialization destroys 2D structural relationships.
- Redundancy: Sparse data and repetitive values waste tokens.
Methodology: The SHEETENCODER Framework
SHEETENCODER introduces three portable compression modules designed to preserve structural integrity while minimizing token usage:
- Structural-Anchor-Based Compression: This module identifies "structural anchors"—key rows and columns representing headers or boundaries. It removes repetitive data between these anchors to create a condensed "skeleton" of the spreadsheet.
- Inverted-Index Translation: A lossless method that maps unique cell values to their addresses or ranges in a JSON-style dictionary. This effectively eliminates the "token tax" on empty cells and repetitive entries.
- Data-Format-Aware Aggregation: This module clusters adjacent cells with identical formats (e.g., dates or currency). By replacing specific values with format strings (like
yyyy-mm-dd), it significantly reduces token counts in data-dense regions.
Additionally, the framework employs a Chain of Spreadsheet Encoding (CoS) pipeline, where the model first identifies relevant table boundaries before performing targeted reasoning.
Experimental Evaluation
The framework was evaluated on two primary benchmarks:
- Spreadsheet Table Detection: Real-world spreadsheets with annotated boundaries.
- Spreadsheet QA: A new dataset of 64 spreadsheets and 307 QA tuples requiring navigation of complex, multi-table layouts.
Key Results
- Massive Compression: SHEETENCODER reduced token usage by an average of 96% compared to vanilla encoding.
- State-of-the-Art Performance: On table detection, a fine-tuned LLM using SHEETENCODER achieved a 78.9% F1 score, a 12.3% improvement over TableSense-CNN.
- In-Context Learning Boost: GPT-4’s performance improved by 25.6% in few-shot scenarios when using SHEETENCODER’s compression.
- QA Accuracy: The framework reached 74.3% accuracy on the Spreadsheet QA benchmark, outperforming baselines like TAPEX and Binder.
Discussion and Limitations
While SHEETENCODER significantly advances spreadsheet processing, limitations remain. Current methods do not incorporate visual cues like cell colors or font styles, which often carry semantic meaning. Furthermore, the system clusters by format rather than semantic meaning (e.g., grouping country names) and is less optimized for long-form text within cells.
Conclusion
SHEETENCODER represents a major step toward "spreadsheet-native" LLMs. By prioritizing structure over raw data and utilizing efficient coordinate-based indexing, it enables LLMs to handle complex tabular data with unprecedented efficiency and accuracy.
Summary updated