Template-Driven LLM-Paraphrased Framework for Tabular Math Word Problem Generation

Xiaoqiang Kang, Zimu Wang, Xiaobo Jin, Wei Wang, Kaizhu Huang, Qiufeng Wang

Introduction

Solving math word problems that involve tables (TMWPs) is a critical benchmark for evaluating mathematical reasoning in AI. However, training effective models requires massive amounts of high-quality data. Existing auto-generation methods generally fall into two categories: template-based methods and pure LLM-based generation. Template-based methods are mathematically sound but produce repetitive, "robotic" problems that lack linguistic diversity. Conversely, pure LLM-based generation often suffers from "hallucinations," where the generated question doesn't match the table data, or the provided solution is logically flawed.

Comparison of original and generated problems highlighting potential logic gaps in pure LLM outputs.

Furthermore, many existing datasets lack detailed, step-by-step reasoning annotations. Without these "illustrative" steps, models struggle to learn the underlying logic required to solve complex, multi-step problems.

The TeLL Framework

To address these challenges, we introduce TeLL (Template-driven LLM-paraphrased), a five-stage pipeline designed to ensure both correctness and diversity:

  1. Template Abstraction: Abstract mathematical "skeletons" (logic, table structure, and question type) are extracted from existing real-world problems.
  2. Template Augmentation: An LLM generalizes these skeletons to new, related question types—for example, turning a "mean" template into a "median" or "mode" template.
  3. Template Selection: A template is randomly chosen from the expanded database.
  4. Template Instantiation: Placeholders are filled with random numbers and categories satisfying specific mathematical constraints, ensuring the problem is solvable with an exact answer.
  5. Problem Paraphrasing: An LLM (e.g., Yi-Large-Turbo) rewrites the template-based problem into a natural, contextualized scenario.

Crucially, the framework generates illustrative solutions—detailed, multi-step reasoning paths that guide the model through identifying relevant data, performing calculations, and aggregating results.

An example of a generated TMWP with an illustrative, multi-step reasoning solution.

Datasets and Evaluation

Using this framework, we constructed the TabMWP-TeLL dataset, extending the original TabMWP benchmark with higher diversity and superior reasoning steps.

Our results demonstrate that hybridization is key: templates provide the "ground truth" logic, while LLMs provide human-like linguistic variety. Providing step-by-step "illustrative" solutions proved far more effective for fine-tuning than providing only final answers, as it forces the model to learn the process of reasoning.

Key Results

  • State-of-the-Art Performance: Fine-tuning Llama 3-8B on the combined dataset achieved 98.07% accuracy, significantly outperforming the base Llama 3 (71.99%) and human performance (90.22%).
  • Efficiency: The fine-tuned 8B models approached the performance of Chameleon (98.78%), which relies on a much larger GPT-4 backbone.
  • Solving "Hard" Problems: The framework was particularly effective for complex formats like stem-and-leaf plots, where accuracy jumped from ~66% to over 94%.

Conclusion and Future Work

While highly effective, human verification revealed a 2.5% error rate, primarily due to occasional logical inconsistencies in paraphrased solutions. Future work aims to generalize this approach to more complex multi-hop reasoning and problems requiring broader commonsense knowledge.

Summary updated

BibTeX
@inproceedings{kang2025template,
  author = {Xiaoqiang Kang and Zimu Wang and Xiaobo Jin and Wei Wang and Kaizhu Huang and Qiufeng Wang},
  title = {{Template-Driven LLM-Paraphrased Framework for Tabular Math Word Problem Generation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i23.34607},
}
Figure