Skip to content

About

My work on SemEval 2024 - Task 9: BRAINTEASER

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

BrainTeaser — SemEval 2024 Task 9

Three unsupervised approaches to lateral-thinking riddles, built around word-sense disambiguation. None of them need labelled training data.

This is the StFX-NLP submission to SemEval 2024 Task 9: BRAINTEASER, a shared task on multiple-choice question answering for lateral-thinking puzzles. The accepted workshop paper is included as BrainTeaser.pdf.

📄 StFX-NLP at SemEval-2024 Task 9: BRAINTEASER: Three Unsupervised Riddle-Solvers — Heavey, Hughes, & King (2024). Proceedings of SemEval-2024, pages 28–33.

The task

BRAINTEASER asks models to answer riddles whose surface-level commonsense answer is wrong by design — the kind that requires "thinking outside the box." There are two sub-tasks (sentence puzzles, word puzzles), each with four-way multiple choice including a "none of the above" option. Every original puzzle also has two adversarial variants — a semantic reconstruction (rephrasing) and a context reconstruction (different scenario, same trick) — used to test whether a system actually generalises rather than pattern-matches.

Sentence puzzle example: "A man shaves everyday, yet keeps his beard long." → He is a barber.

Word puzzle example: "What part of London is in France?" → The letter N.

Why unsupervised

The standard route on SemEval tasks is to fine-tune a transformer on the training data. We deliberately went the other way: all three of our systems use only the test set at inference time, with no labelled data and no hyperparameters to tune. The trade-off is that we cap our ceiling — but the resulting methods are portable to settings where labelled riddles are not available, and the analysis isolates what knowledge-based WSD can contribute on its own.

Three approaches

flowchart LR
    A[Puzzle + 4 choices] --> B[Stanford log-linear<br/>POS tagger]
    B --> C[Extract nouns]
    C --> D[SensEmBERT + WordNet<br/>sense extraction<br/>Algorithm 1]
    D --> E1[BOW-WSD]
    D --> E2[Sense Comparison]
    A --> E3[Language Modelling]

    E1 --> F1[Token overlap<br/>between bags]
    E2 --> F2[Cosine sim. over<br/>sense CLS embeddings]
    E3 --> F3[BERT scores each<br/>question+answer concat]

    F1 --> G[Argmax answer]
    F2 --> G
    F3 --> G
Loading

All three systems use bert-large-cased as the backbone (matching SensEmBERT's underlying model).

Bag-of-Words with WSD (BOW-WSD) — extract nouns from the question and each candidate, look up the most-similar WordNet sense via SensEmBERT's sense embeddings, take the union of sense tokens minus stopwords, and pick the candidate whose bag has the highest token-overlap (Dice-style score) with the question's bag. This was our best performer.

Language Modelling (LM) — append each candidate to the question and score the resulting text under bert-large-cased. Pick the candidate that yields the highest probability continuation.

Sense Comparison (SC) — for each sense extracted from the question and each candidate, retrieve the [CLS] embedding from bert-large-cased. Average pairwise cosine similarities between question senses and candidate senses; pick the candidate with the highest average. Algorithm 2 in the paper details the procedure.

Results

Accuracy on each puzzle category. Baselines and best-overall submission are shown for comparison. Bold marks our top model in each cell.

Sentence puzzles

System Original Semantic Context O+S O+S+C Overall
Human .907 .907 .944 .907 .889 .920
ChatGPT .608 .593 .679 .507 .397 .627
RoBERTa-L baseline .435 .402 .464 .330 .201 .434
BOW-WSD (ours) .425 .400 .475 .350 .200 .433
LM (ours) .225 .200 .375 .075 .050 .267
SC (ours) .175 .200 .350 .175 .125 .242

Word puzzles

System Original Semantic Context O+S O+S+C Overall
Human .917 .917 .917 .917 .900 .917
ChatGPT .561 .524 .518 .439 .292 .535
RoBERTa-L baseline .195 .195 .232 .146 .061 .207
BOW-WSD (ours) .406 .219 .344 .125 .063 .323
LM (ours) .438 .250 .500 .125 .031 .396
SC (ours) .156 .063 .219 .063 .031 .146

Headline: BOW-WSD essentially matches the RoBERTa-L baseline on sentence puzzles (.433 vs .434) and beats it on 5 of 6 word puzzle categories. LM does the inverse — better on word puzzles than sentence puzzles, likely because word puzzles are short questions where appending an answer yields a natural continuation. SC underperformed across the board.

Final placement: 10th of 11 unique positions on both subtasks (13 teams competed, ties collapsed positions). Honest take: this is a hard task, ChatGPT scored .627/.535, and we left the train+dev sets untouched by choice.

What we learned

  • WordNet sense overlap between a question's nouns and a candidate's nouns is a genuinely useful signal for sentence riddles. In the barber example, "barber"'s WordNet gloss (a hairdresser who cuts hair and shaves beards as a trade) shares the tokens shave and beard with the question, which lifts it above the distractors.
  • LM scoring is sensitive to the surface form of a puzzle. Word puzzles, which are mostly single questions, give LM scoring more to work with than sentence puzzles, where any candidate can be made to follow grammatically.
  • Sense Comparison alone underperformed Bag-of-Words alone — the averaging step washes out the discriminative signal that BOW's hard token overlap preserves.

Future work

The paper flags two directions worth pursuing: ensembling the three approaches (BOW-WSD and LM have complementary strengths across the two subtasks), and a sense-distance penalty for BOW-WSD that down-weights candidates whose senses are too far from the question's senses — a way to make the model wary of obvious red herrings.

Key files

  • POSTagging.py — Stanford POS tagger wrapper, extracts nouns
  • sensembert.py — SensEmBERT sense embeddings, WordNet sense lookup (Algorithm 1 in paper)
  • bag_o_words.py — BOW-WSD: best-performing system
  • language_modelling.py — LM: question+candidate scoring with bert-large-cased
  • sense_comparison.py — SC: cosine similarity over sense [CLS] embeddings (Algorithm 2)
  • dataset_tomfoolery.py — data loading and preprocessing
  • data/ — task data (test set; we don't use train/dev)
  • Results/ — predictions per system
  • POS/ — cached POS-tagged artefacts
  • BrainTeaser.pdf — accepted SemEval-2024 workshop paper

Setup

git clone https://github.com/VeiledTee/BrainTeaser.git
cd BrainTeaser
pip install -r requirements.txt

Python 3.10.11. Major dependencies: NumPy 1.26.1, NLTK 3.8.1, Transformers 4.35.0, scikit-learn 1.4.0, PyTorch 2.1.0+cu118.

Citation

@inproceedings{heavey-etal-2024-stfx,
    title = "{S}t{FX}-{NLP} at {S}em{E}val-2024 Task 9: {BRAINTEASER}: Three Unsupervised Riddle-Solvers",
    author = "Heavey, Ethan  and
      Hughes, James  and
      King, Milton",
    editor = {Ojha, Atul Kr.  and
      Do{\u{g}}ru{\"o}z, A. Seza  and
      Tayyar Madabushi, Harish  and
      Da San Martino, Giovanni  and
      Rosenthal, Sara  and
      Ros{\'a}, Aiala},
    booktitle = "Proceedings of the 18th International Workshop on Semantic Evaluation (SemEval-2024)",
    month = jun,
    year = "2024",
    address = "Mexico City, Mexico",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.semeval-1.5/",
    doi = "10.18653/v1/2024.semeval-1.5",
    pages = "28--33",
    abstract = "In this paper, we explore three unsupervised learning models that we applied to Task 9: BRAINTEASER of SemEval 2024. Two of these models incorporate word sense disambiguation and part-of-speech tagging, specifically leveraging SensEmBERT and the Stanford log-linear part-of-speech tagger. Our third model relies on a more traditional language modelling approach. The best performing model, a bag-of-words model leveraging word sense disambiguation and part-of-speech tagging, secured the 10th spot out of 11 places on both the sentence puzzle and word puzzle subtasks."
}

Related work

For the previous year's SemEval submission on argument-based human value detection, see SemEval-2023. Full PhD research portfolio at github.com/VeiledTee.

About

My work on SemEval 2024 - Task 9: BRAINTEASER

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages