0

I'm working on a question answering problem with limited data (~10,000s of data points) and very few features for both the context/question as well as the options/choices. Given:

  • a question Q and

  • options A, B, C, D, E (each characterized by some features, say, string similarity to Q or number of words in each option)

  • (while training) a single correct answer, say B.

I wish to predict exactly one of these as the correct answer. But I'm stuck because:

  1. If I arrange ground truth as [0 1 0 0 0], and give the concatenation of QABCDE as input, then the model will behave as if classifying an image into dog, cat, rat, human, bird, i.e. each class will have a meaning, however that's not true here. If I switched the input to QBCDEA, the prediction should be [1 0 0 0 0].

  2. If I split each data point into 5 data points, i.e. QA:0, QB:1, QC:0, QD:0, QE:0, then the model fails to learn that they're in fact interrelated, and only one of them must be predicted as 1.

One approach that seems viable is to make a custom loss function which penalizes multiple 1s for a single question, and which penalizes no 1s as well. But I think I might be missing something very obvious here :/

I'm also aware of how large models like BERT do this over SQuAD like datasets. They add positional embeddings to each option (eg. A gets 1, B gets 2), and then use a sort of concatenation over QA1 QB2 QC3 QD4 QE5 as input, and [0 1 0 0 0] as output. Unfortunately, I believe this will not work in my case given the very small dataset I have.

  • An obvious solution is to use graphical models or any form of structured prediction to add the prior knowledge that only one of these must be true. That'll be very time inefficient though, I think, from my past experiences with graphical models. – Avijit Thawani Aug 31 '19 at 17:13

1 Answers1

0

The problem you're having is that you removed all useful information from your "ground truth". The training target is not the ABCDE labels -- the target is the characteristics of the answers that those letters briefly represent.

Those five labels are merely array subscripts for classifications that are a 5Pn (5 objects chosen from n) shuffled subset of your training space. Bottom line: there is no information in those labels.

Rather, extract the salient characteristics from those answers. Your training needs to find the answer (characteristic set) that sufficiently matches the question. As such, what you're doing is close to multi-label training.

Multi-label models should handle this situation. This will include those that label photos, identifying multiple classes represented in the input.

Does that get you moving?


Response to OP comment

You understand correctly: predicting 0/1 for five arbitrary responses is meaningless to the model; the single-letter variables are of only transitory meaning, and have no relation to anything trainable.

A short thought experiment will demonstrate this. Imagine that we sort the answers such that A is always the correct answer; this doesn't change the information in the inputs and outputs; it's a valid arrangement of the multiple-choice test. Train the model; we'll get to 100% accuracy in short order. Now, consider the model weights: what has the model learned from the input? Nothing -- the weights will train to ignore the input and select A, or will have absolutely arbitrary values that come to the A conclusion.


You need to ignore the ABCDE designations entirely; the target information is in the answers themselves, not in those letters. Since you haven't posted any sample cases, we have little to guide us for an alternate approach.

If your paradigm is a typical multiple-choice examination, with few restrictions on the questions and answers, then the problem you're tackling is far larger than your project is likely to solve -- you're in "Watson" territory, requiring a large knowledge base and a strong NLP system to parse the inputs and available responses.

If you have a restricted paradigm for the answers, perhaps you can parse them into phrases and relations, yielding a finite set of classes to consider in your training. In this case, a multi-label model might well be able to solve your problem.

If your application is open-ended, i.e. open topic, then I expect that you need a different model class (such as BERT), but you'll still need to consider the five answers as text sequences, not as letters. You need a holistic match to the subject at hand. If this is a typical multiple-choice exam, then your model will still have classification troubles, as all five answers are likely to be on topic; finding the correct answer should depend on some level of semantic insight into question and answer, something stronger than "bag of words" processing.

Prune
  • 76,765
  • 14
  • 60
  • 81
  • Hi, the first part of your answer was inspiring! You're saying that since those 5 choices are just arbitrarily selected from the N possible choices/classes, defined by the set of features, predicting 0s and 1s for them doesn't really matter and model should instead predict a set of features directly, correct? I'm still stuck with how to model my target vector, given the large space of possible feature values. Also I couldn't follow the last part I think you assumed a multi *label* setting when you say "identifying multiple classes represented in the input." I only have one answer correct. – Avijit Thawani Aug 31 '19 at 17:07
  • Yes, `multi-label` is the correct term; I edited my answer. – Prune Sep 03 '19 at 14:29