Automatic Short Math Answer Grading via In-context Meta-learning

Mengxue Zhang, Sami Baral, Neil T. Heffernan, Andrew S. Lan

TL;DR

This paper introduces a novel framework for automatically grading short-answer math questions by combining MathBERT with in-context meta-learning. By providing a few labeled examples directly within the model's input prompt, the system can effectively "learn how to grade" new, previously unseen questions, significantly outperforming traditional methods that require training a separate model for every single question.

What Problem Does This Paper Address?

Automatic Short Answer Grading (ASAG) is a major hurdle in scaling personalized education. In the context of mathematics, the challenge is twofold:

  1. Mixed Modalities: Student responses are a messy blend of natural language and mathematical symbols (expressions, equations, etc.). Standard language models like BERT aren't specifically trained to understand this "math-speak."
  2. The "Cold Start" Problem: Most existing ASAG systems train one model per question. This is computationally expensive to store and, more importantly, means the system is useless for a new question until hundreds of student responses have been manually graded to provide training data.

The authors aim to create a "universal" grader that can generalize across different math topics and adapt to new questions using only a handful of examples.

Methods

The authors propose a framework built on two main pillars:

  • MathBERT as the Backbone: Instead of standard BERT, they use MathBERT, which was pre-trained on a massive corpus of mathematical content (from pre-K to college level). Unlike previous works that used these models only to extract "features," the authors fine-tune the entire model on the grading task.
  • In-Context Meta-Learning: This is the "secret sauce." Instead of just feeding the model a student's response, they provide a carefully crafted prompt that includes:
  • The target student response.
  • The question text or ID.
  • A description of the grading scale (e.g., "poor, fair, good, excellent").
  • Scored Examples: A few examples of other student responses to the same question along with their actual scores.

By including these examples, the task changes from "absolute grading" to "finding the most similar response among the examples," which is a much easier pattern-matching task for the transformer architecture.

Datasets

The study utilizes a real-world dataset from an online learning platform:

  • $D_{orig}$: 141,612 student responses to 2,042 open-ended math questions, graded on a 0–4 scale by 891 human teachers.
  • $D_{clean}$: A refined version created by the authors (131,046 responses, 1,333 questions) that removes noisy data, such as responses containing only images or questions without semantic meaning.

Key Insights and Ideas

  • Simplifying the Task: The most profound insight is that providing in-context examples reduces the complexity of the grading task. The model doesn't have to "know" the math perfectly; it just needs to recognize that "Student A's answer looks like Example B, which got a 4."
  • MathBERT’s Limits: Surprisingly, MathBERT didn't vastly outperform standard BERT on purely textual responses. The authors found that while MathBERT is better at handling symbols, it sometimes loses the "nuance" of natural language compared to its predecessor.
  • Context is Crucial: Ablation studies showed that removing the "scored examples" from the input caused the most significant drop in performance. The question text also proved vital for the model to understand the semantic context of the math being performed.

Key Results

  • Superior Generalization: On "unseen" questions (questions the model never saw during training), the Meta-finetune approach achieved an AUC of 0.689 and a Cohen’s Kappa of 0.456 with just one example. This is a nearly 50% improvement over some baseline methods.
  • Few-Shot Efficiency: The model's performance improves rapidly as more examples are added, stabilizing around 80 examples. Even with very few examples, it consistently outperformed SBERT-based baselines.
  • Robustness: The system proved more accurate at grading shorter responses and responses with a higher percentage of mathematical tokens.

Limitations and Future Work

  • Numerical Reasoning: The model still struggles with "number sense." For example, it might fail to distinguish between $15 \times 5 = 3$ and $15 / 3 = 5$ because the tokens are similar, even though the logic is fundamentally different.
  • Input Constraints: Current transformer models have a 512-token limit. This restricts how much context (question text + many examples) can be packed into a single prompt.
  • Unparsable Content: The system cannot yet handle responses submitted as images or attachments, which are common in math homework.
  • Future Directions: The authors suggest exploring newer versions of MathBERT that leverage tree structures for expressions and incorporating more metadata, like student grade levels or specific "Common Core" tags, to provide even better context.

Summary updated

BibTeX
@inproceedings{zhang2022automatic,
  author = {Mengxue Zhang and Sami Baral and Neil T. Heffernan and Andrew S. Lan},
  title = {{Automatic Short Math Answer Grading via In-context Meta-learning}},
  booktitle = {Edm},
  year = {2022},
}
Figure