NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Towards a Holistic Understanding of Mathematical Questions with Contrastive Pre-training

Yuting Ning, Zhenya Huang, Xin Lin, Enhong Chen, Shiwei Tong, Zheng Gong, Shijin Wang

Introduction

Understanding mathematical questions requires more than simple text processing; it necessitates grasping the underlying logic, formulas, and specific knowledge concepts. Existing models often struggle with two primary issues: literal over-reliance and the neglect of knowledge hierarchies. For instance, a model might fail to recognize that two questions are identical in intent if they use different variables (e.g., $x$ vs. $u$) or numbers. Furthermore, mathematical knowledge is inherently hierarchical; a question about "Power Functions" is more closely related to "Logarithmic Functions" than to "Cuboids."

To address these gaps, the authors propose QuesCo, a novel contrastive pre-training framework designed to represent questions based on their mathematical intent rather than literal phrasing. By leveraging domain-specific data augmentations and a ranking strategy based on hierarchical knowledge, QuesCo achieves a holistic understanding of mathematical problems.

Overview of mathematical question similarity based on a Knowledge Hierarchy.

Methodology

QuesCo utilizes a contrastive learning objective to "pull" similar questions together in vector space and "push" dissimilar ones apart. The framework consists of two main components: multi-level augmentation and hierarchy-aware ranking.

1. Two-Level Question Augmentation

To generate positive pairs that share the same mathematical intent, QuesCo employs:

  • Content-level Augmentation: This includes Formula Augmentation, where variables are renamed or scaled, operators are replaced with synonyms (e.g., $sin$ and $cos$), and numerical values are randomized.
  • Structure-level Augmentation: This involves Clause Shuffling and Useless Clause Insertion to force the model to focus on core logic rather than sentence structure.

2. Knowledge Hierarchy-Aware Rank (KHAR)

Rather than treating similarity as a binary label, the authors introduce the Knowledge Hierarchy-Aware Rank (KHAR). This module utilizes the tree structure of mathematical knowledge to define a KH-distance ($khd$).

Visual representation of Knowledge Hierarchy (KH) distance calculation between questions.

As shown in the figure above, the distance is determined by the path length between concepts in the hierarchy. Questions sharing deep-level concepts are ranked as highly similar, while those sharing only top-level concepts are moderately similar. The model is trained using Ranking Info Noise Contrastive Estimation (RINCE) loss, ensuring the vector space reflects these hierarchical relationships.

Experimental Results

The framework was evaluated on two real-world datasets: SYSTEM1 (123,200 questions with 3-level labels) and SYSTEM2 (25,287 questions with expert-labeled similarity scores). QuesCo was compared against baselines like BERT, MathBERT, and QuesNet.

  • Similarity Prediction: On SYSTEM2, QuesCo achieved a Pearson correlation of 0.7385, outperforming the next best model, DisenQNet (0.6922).
  • Concept Prediction: The model reached an accuracy of 91.76% for top-level concepts and 78.57% for specific level-2 concepts.
  • Difficulty Estimation: QuesCo demonstrated the lowest error rates (MAE/RMSE) and the highest Degree of Agreement (DOA), indicating that a holistic understanding of a question's purpose correlates strongly with its perceived difficulty for students.

Discussion and Conclusion

Ablation studies highlighted that formula augmentation is the most critical component of the framework; without it, models remain anchored to literal symbols. By using the knowledge hierarchy as a supervisor, QuesCo learns a nuanced similarity that mirrors human expertise.

While powerful, the framework currently relies on pre-defined hierarchies, which may be a limitation in fields where such structures are not well-established. Future work may involve extending these strategies to other logical subjects like Physics or Chemistry and adapting text augmentations for multi-language support. Overall, QuesCo represents a significant step toward AI that understands the "heart" of mathematical problems.

Summary updated

BibTeX
@inproceedings{ning2023towards,
  author = {Yuting Ning and Zhenya Huang and Xin Lin and Enhong Chen and Shiwei Tong and Zheng Gong and Shijin Wang},
  title = {{Towards a Holistic Understanding of Mathematical Questions with Contrastive Pre-training}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.1609/aaai.v37i11.26573},
}
Figure