TL;DR
Spreadsheet-RL introduces the first end-to-end reinforcement learning (RL) framework designed to train LLM agents on complex, multi-step spreadsheet tasks within a realistic Microsoft Excel environment. By combining an automated data collection pipeline, a specialized spreadsheet-native tool harness, and GRPO-based RL training, it significantly boosts the performance of open-source models, enabling a 4B parameter model to outperform proprietary baselines like OpenAI o3.
What Problem Does This Paper Address?
Spreadsheets are foundational to modern data workflows, yet automating them with AI agents remains a massive challenge. Current state-of-the-art spreadsheet agents rely heavily on prompt engineering over massive, proprietary LLMs (like GPT-4o). While these agents can handle simple, single-step instructions, they routinely struggle with the complex, multi-step workflows typical of real-world business applications.
Training specialized, open-source spreadsheet agents via reinforcement learning has historically been blocked by three major hurdles:
- Data Scarcity: Collecting high-quality, paired initial-and-final spreadsheets for training is incredibly expensive and difficult to scale.
- Weak Initial Policies: Without costly step-by-step supervised fine-tuning (SFT) data, an agent starting RL from scratch has a near-zero success rate, making exploration ineffective.
- Environment Mismatches: Simplified open-source spreadsheet engines (like LibreOffice) lack the full formula fidelity and advanced features (e.g., dynamic arrays) of Microsoft Excel, creating a gap between the training sandbox and real-world usage.
Methods
The authors present Spreadsheet-RL, an end-to-end post-training framework built on three core components:
- Spreadsheet Data Agent: An automated pipeline that crawls real-world spreadsheet problems and discussion threads from online forums (such as ExcelForum). It leverages powerful coding agents to execute the discussed solutions, generating "oracle" final spreadsheets. Rigorous rule-based filtering ensures only error-free, valid pairs make it into the training set.
- Spreadsheet Gym & Native Harness: A multi-turn interactive environment that executes actions inside a real Microsoft Excel instance using filesystem-isolated workspaces. Instead of forcing the LLM to write raw Python code (which frequently fails due to index shifts or string escaping), the harness provides structured, spreadsheet-native tools like
fill_formula,clear_range,delete_rows, andrecalculate_and_read. - Asynchronous RL Pipeline: The agent is optimized using Group Relative Policy Optimization (GRPO) based on verifiable, outcome-based rewards. To overcome the latency of opening and recalculating workbooks in Excel, the authors implemented an asynchronous submit-and-poll verifier, keeping GPU utilization high during training.
Datasets
The paper utilizes three distinct datasets for training and evaluation:
- SpreadsheetBench: An existing benchmark containing 912 unique real-world spreadsheet tasks collected from online forums and verified by experts.
- Domain-Spreadsheet: A brand-new, domain-specific benchmark curated by the authors. It contains 1,660 tasks spanning professional analytical workflows in finance, supply chain management, human resources, sales, and real estate.
- Training Dataset: A new corpus of 5,928 high-quality, forum-sourced spreadsheet tasks automatically generated by the Spreadsheet Data Agent.
Key Insights and Ideas
- Action Space Specialization is Crucial: Forcing smaller LLMs to write raw Python code to manipulate spreadsheets often leads to low-level execution failures (e.g., deleting a column shifts all subsequent indices, breaking the loop). Providing a structured, spreadsheet-native tool harness acts as a powerful workflow prior, drastically improving the agent's initial success rate before RL even begins.
- Excel Fidelity Matters: Many advanced spreadsheet workflows rely on modern Excel features like dynamic array formulas (
FILTER,UNIQUE,SORT). Training or evaluating agents on simplified engines introduces semantic mismatches that hurt real-world generalization. - RL Curbs LLM Verbosity and Inefficiency: Beyond just improving accuracy, RL post-training naturally teaches the agent to be more efficient. Over the course of training, the mean response length dropped from 16k to 11k tokens, and the average number of interaction turns fell from 20 to 11, showing that the agent learned to plan better and avoid speculative trial-and-error.
Key Results
- SpreadsheetBench Breakthroughs: On SpreadsheetBench, Spreadsheet-RL improved the Pass@1 accuracy of
Qwen3-4B-Thinking-2507from a base of 12.0% to 23.4%. This post-trained 4B open-source model successfully outperformed the proprietary OpenAI o3 baseline (23.3%). - Cross-Domain Generalization: On the new Domain-Spreadsheet benchmark, the framework boosted overall Pass@1 accuracy from 8.4% to 17.2%, with the most dramatic improvements occurring in complex financial workflows.
Limitations and Future Work
Due to compute and resource constraints, the current study focuses entirely on lightweight open-source models at the 4B parameter scale. The authors acknowledge that they have not yet tested the framework on larger dense models or Mixture-of-Experts (MoE) architectures, leaving scaling as a primary direction for future research. Additionally, certain highly specialized domains, such as real estate analytics, remained flat in performance, indicating a need for more targeted domain-specific training data.
Summary updated