Skip to content
usm-aiirPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

MathDisAm: Towards Math Query Disambiguation

Welcome to the official repository for the paper MathDisAm: Towards Math Query Disambiguation. This repository contains the dataset, query generation pipelines, and baseline classifier models designed to distinguish between ambiguous and unambiguous mathematical queries.


Repository Structure

  • Choosing_sample_questions/: Contains the scripts used to process a snapshot of Math Stack Exchange and select candidate questions for the dataset.
  • query_generator/: Contains the generate_ambiguous and generate_unambiguous codebases that power the synthetic generation of queries based on the Math Stack Exchange posts.
  • data/: Stores the dataset splits for the MathDisAM task.
  • classifier/: Contains the training pipeline (train_bert_classifier.py) and scripts to run the baseline transformer models.

Dataset

The data directory contains the core datasets used for training and evaluating the disambiguation models:

  • MathDisAM_train.tsv: The training file containing MathSE IDs, mathematical questions, and their corresponding tags ("Ambiguous" or "Unambiguous").
  • MathDisAM_test.tsv: The untouched, held-out test file used for final model evaluation.

Query Generation

The query generation process leverages a two-agent Large Language Model pipeline (using Gemma) to process natural mathematical questions:

  • Ambiguous Query Generation:
    • Uses an "Injector" agent to rewrite a math question to introduce deliberate ambiguity.
    • Uses a "Verifier" agent to independently judge if the rewrite is genuinely ambiguous.
    • The script processes questions until a target of 1,000 verified ambiguous questions is produced.
  • Unambiguous Query Generation:
    • Uses a "Clarifier" agent to rewrite queries to remove ambiguity.
    • Uses a "Verifier" agent to evaluate if the query is fully well-posed and unambiguous.
    • This pipeline also targets 1,000 verified unambiguous questions.

Classifier & Baselines

To run the classifier code, you can use the following commands. These represent the three baseline models we introduced for this task:

A) RoBERTa Base

CUDA_VISIBLE_DEVICES=0 python classifier/train_bert_classifier.py --train_file data/MathDisAM_train.tsv --test_file data/MathDisAM_test.tsv --model_name roberta-base --epochs 20

B) BERT Base Uncased

CUDA_VISIBLE_DEVICES=0 python classifier/train_bert_classifier.py --train_file data/MathDisAM_train.tsv --test_file data/MathDisAM_test.tsv --model_name bert-base-uncased --epochs 20

C) MathBERT

CUDA_VISIBLE_DEVICES=0 python classifier/train_bert_classifier.py --train_file data/MathDisAM_train.tsv --test_file data/MathDisAM_test.tsv --model_name tbs17/MathBERT --epochs 20

Requirements

To run the classifier pipeline, install the required dependencies:

pip install transformers datasets torch scikit-learn pandas accelerate matplotlib tqdm beautifulsoup4

You will also need to find and download the file 'Posts.xml' to run most of the files in the choosing_sample_questions folder

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages