AiM: Taking Answers in Mind to Correct Chinese Cloze Tests in Educational Applications

Yusen Zhang, Zhongli Li, Qingyu Zhou, Ziyi Liu, Chao Li, Mina Ma, Yunbo Cao, Hongzhi Liu

TL;DR

Traditional automated grading for handwritten text relies on a brittle pipeline: transcribe the handwriting via OCR and compare it to the correct answer. This paper introduces AiM (Answer-in-Mind), a multimodal approach that mimics human teachers by using the correct answer as a prior context to guide the visual interpretation of messy handwriting. By framing grading as a sequence labeling task over the answer text, AiM significantly outperforms standard OCR-based grading methods.

What Problem Does This Paper Address?

Automating the correction of handwritten assignments—specifically Chinese cloze (fill-in-the-blank) tests—is notoriously difficult. The standard industry approach uses Optical Character Recognition (OCR) to transcribe a student's response and then compares the text to the answer key.

However, standalone OCR models lack context. Handwritten Chinese characters frequently feature cursive ligatures, varying writing styles, and highly similar shapes. A slight spacing issue can cause an OCR model to split a single complex character into two simpler ones (e.g., recognizing the single character “轲” as two characters, “车可”).

Human teachers don't grade this way; they look at the student's writing with the correct answer already "in mind," allowing them to easily resolve visual ambiguities. This paper addresses the lack of target-answer context in automated grading pipelines.

Examples of how traditional OCR fails due to character spacing vs. how the multimodal AiM model correctly evaluates the student's intent.

Methods

The authors propose AiM, a multimodal architecture that processes both the handwriting image and the target answer text simultaneously.

  1. Image Encoder: A ResNet backbone extracts visual features from the handwriting image, which are then processed by Transformer self-attention blocks to capture spatial context.
  2. Text Encoder: The target answer text is converted into dense vectors using token embeddings and contextualized via another set of Transformer self-attention blocks.
  3. Fusion Module (Cross-Modal Attention): This is the core innovation. Instead of a standard Transformer decoder that generates text autoregressively (one token at a time), AiM uses a cross-modal attention mechanism that allows every character in the target answer to look at all visual pixel blocks simultaneously.
  4. Sequence Labeling Formulation: Rather than outputting a simple "right" or "wrong" classification, AiM performs fine-grained sequence labeling on the target answer text using a modified BIO (Beginning, Inside, Outside) annotation schema. It assigns tags like O (correct), B-sub (substitute character), B-del (delete character), or B-add (add character). If the model outputs only O tags, the answer is marked correct.

To ensure strong visual representations, the image encoder is first pretrained using a standard Connectionist Temporal Classification (CTC) loss on OCR datasets before being integrated into the multimodal pipeline.

Figure 2: The architecture of AiM. The image encoder of AiM is initialized by OCR pretraining. In AiM, the visual and textual representations are fused by cross-modal attention.

Datasets

The model was trained and evaluated using a mix of real-world, benchmark, and synthetic datasets:

  • EinkCC: A newly collected dataset from an educational app containing roughly 5,000 handwriting images, target answers, and teacher-annotated correction results from students practicing on e-ink tablets.
  • HWCC: Derived from the CASIA-HWDB benchmark for handwritten Chinese text recognition.
  • SynCC: A synthetic dataset generated by splicing individual handwritten character images together to form full sentences, used to scale up training data.

To train the sequence labeler effectively, the authors developed a negative sample augmentation method. They took correct pairings and artificially corrupted the answer text using random insertions, deletions, and substitutions (leveraging a Chinese character confusion set) to create challenging negative training examples.

Key Insights and Ideas

  • The Power of the Prior: Incorporating the answer text directly into the visual processing stage acts as a powerful regularizer. The model avoids the common OCR pitfall of over-segmenting characters because the cross-modal attention aligns the expected text directly to the corresponding visual regions.
  • Sequence Labeling > Open Generation: Constraining the model to label the known answer text rather than generating arbitrary OCR text drastically simplifies the optimization landscape and makes the system far more robust to messy handwriting.
  • Interpretability via Attention: Visualizing the cross-modal attention maps proves that the model accurately aligns textual characters to their physical locations in the image, even when a character appears multiple times in a sentence.
Visualization of cross-modal attention scores, demonstrating how the model successfully aligns characters in the answer text to specific pixel blocks in the handwriting image.

Key Results

AiM significantly outperformed traditional OCR-based baselines across both sequence-level and binary-level (right/wrong) metrics.

  • Binary Classification Accuracy: On the real-world EinkCC test set, AiM achieved an accuracy of 81.13%, vastly outperforming commercial-grade baselines like PP-OCRv2 (45.02%) and a strong Resnet-CTC baseline (70.13%).
  • Precision vs. Recall: Traditional OCR models suffer from terrible precision (often flagging correct answers as wrong due to minor transcription errors). AiM dramatically improved precision on the EinkCC dataset from 33.22% (Resnet-CTC) to 42.62%, yielding a much healthier balanced F1-score.
Figure 3: Data ablation of the AiM and its baseline performance at the binary level on the EinkCC test set.

Limitations and Future Work

Despite its success, the authors noted a drop in recall on the EinkCC dataset. AiM occasionally suffers from false positives, where it marks an incorrect student answer as correct. This typically happens when a student writes a character that is visually very similar to the correct answer (a shape-similar imposter), and the model's strong "answer-in-mind" bias overrides the subtle visual discrepancies.

Future work will likely need to focus on sharpening the model's sensitivity to fine-grained visual strokes to better catch these deceptive errors.

Summary updated

Abstract

To automatically correct handwritten assignments, the traditional approach is to use an OCR model to recognize characters and compare them to answers. The OCR model easily gets confused on recognizing handwritten Chinese characters, and the textual information of the answers is missing during the model inference. However, teachers always have these answers in mind to review and correct assignments. In this paper, we focus on the Chinese cloze tests correction and propose a multimodal approach (named AiM). The encoded representations of answers interact with the visual information of students' handwriting. Instead of predicting 'right' or 'wrong', we perform the sequence labeling on the answer text to infer which answer character differs from the handwritten content in a fine-grained way. We take samples of OCR datasets as the positive samples for this task, and develop a negative sample augmentation method to scale up the training data. Experimental results show that AiM outperforms OCR-based methods by a large margin. Extensive studies demonstrate the effectiveness of our multimodal approach.
BibTeX
@inproceedings{zhang2022aim,
  author = {Yusen Zhang and Zhongli Li and Qingyu Zhou and Ziyi Liu and Chao Li and Mina Ma and Yunbo Cao and Hongzhi Liu},
  title = {{AiM: Taking Answers in Mind to Correct Chinese Cloze Tests in Educational Applications}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2022},
}
Figure