Algebra Error Classification with Large Language Models

Hunter McNichols, Mengxue Zhang, Andrew S. Lan

TL;DR

Researchers from UMass Amherst have developed a flexible method for classifying student errors in algebra using Large Language Models (LLMs). By treating student math steps as text sequences rather than rigid syntax trees, their BERT-based approach outperforms previous state-of-the-art methods and successfully handles "messy" or syntactically invalid student responses.

What Problem Does This Paper Address?

Providing automated, real-time feedback is a "holy grail" for Intelligent Tutoring Systems (ITSs), as it allows for personalized instruction at scale. However, the first step—identifying exactly what error a student made—is notoriously difficult.

Traditionally, this was done using hand-crafted rules, which are expensive to build and fail to generalize to unexpected student behavior. Recent data-driven attempts relied on "tree embeddings," which require mathematical expressions to be parsed into perfect syntax trees. If a student makes a typo or writes something nonsensical (e.g., "x + 3 = unicorn"), these systems break. Furthermore, these older models struggle to incorporate non-mathematical context, such as a student's stated intent or their interaction history with the software.

Methods

The authors propose a more flexible framework: treating algebra error classification as a sequence classification task.

  1. Model Selection: They experimented with several LLMs, including BERT (Masked Language Modeling), GPT-2 (Autoregressive), MathBERT (pre-trained on math textbooks), and XLM-RoBERTa.
  2. Input Formulation: Instead of building trees, they tokenize the student’s step history (the previous equation and the current erroneous one) into a simple string.
  3. Context Augmentation: Because LLMs handle arbitrary text, the researchers could easily append "action" information—metadata from the ITS logs that describes what the student intended to do (e.g., "ADD_SIDE").
  4. Domain Adaptation (DA): They tested whether pre-training the models on a massive dataset of mathematical solutions (AMPS Mathematica) before fine-tuning them on student data would improve performance.

Datasets

  • CogTutor: A dataset of student interactions with the "Cognitive Tutor" ITS. The authors focused on a subset of 5,744 steps where an error (a "BUG") was detected.
  • CogTutorBugs: A newly curated version of the dataset introduced by the authors, containing 5,339 steps across 19 error labels. They have made this dataset publicly available.
  • AMPS Mathematica: A large-scale dataset of computer-generated math problems used for the Domain Adaptation phase.

Key Insights and Ideas

  • BERT is the "Goldilocks" Model: Despite being a general-purpose language model, standard BERT outperformed models specifically pre-trained on math (MathBERT). The authors suggest that MathBERT’s textbook-heavy training might not translate well to the specific, often fragmented way students solve problems in a tutor.
  • Robustness to "Noise": Because LLMs treat math as a series of tokens, they don't crash when a student provides a syntactically invalid response. This allows the system to classify a much larger percentage of student attempts than tree-based methods.
  • Intent Matters: Adding the "Action" context (what the student clicked or intended to do) provided a significant performance boost. This confirms that math errors aren't just about the final numbers; the process and intent are vital for accurate diagnosis.
  • The "Ambiguity Ceiling": Qualitative analysis showed that many "misclassifications" occurred because the error labels themselves were ambiguous. For example, if a student subtracts incorrectly, is it a "Wrong Operation" or a "Sign Error"? Often, both are technically true, suggesting there is an upper limit to how accurate any classifier can be when using human-defined labels.

Key Results

  • Superior Accuracy: BERT achieved 80.68% accuracy on the baseline labels, outperforming the previous state-of-the-art tree-embedding method (TE+C), which hit 78.71%.
  • Contextual Boost: When using the authors' new labeling system and adding "Action" information, BERT’s accuracy jumped from 82.02% to 85.90%.
  • XLM-RoBERTa's Leap: XLM-RoBERTa saw the largest improvement from added context, with a 6.5% increase in accuracy.
  • DA Diminishing Returns: Domain Adaptation helped the model learn faster in the early epochs of training but did not significantly improve the final accuracy, likely because the "vocabulary" of middle-school algebra is small enough for the model to learn during standard fine-tuning.

Limitations and Future Work

The authors acknowledge that their system is still bound by the "ground truth" of the ITS's original rule-based labels, which may not always be the absolute truth of a student's mental state.

Future directions include: * Moving beyond classification to generative feedback, where the LLM writes a personalized hint directly rather than just picking a category. * Incorporating more complex student data, such as longitudinal knowledge levels, to better predict why a specific student is struggling. * Expanding the method to more advanced math subjects like calculus or probability.

Summary updated

BibTeX
@inproceedings{mcnichols2023algebra,
  author = {Hunter McNichols and Mengxue Zhang and Andrew S. Lan},
  title = {{Algebra Error Classification with Large Language Models}},
  booktitle = {Aied},
  year = {2023},
  doi = {10.1007/978-3-031-36272-9\_30},
}
Figure