# Multiple answers for a context

**URL:** <https://discuss.huggingface.co/t/multiple-answers-for-a-context/172168>\
**Category:** Models\
**Created:** [January 2, 2026, 12:32pm UTC](https://discuss.huggingface.co/t/multiple-answers-for-a-context/172168 "2026-01-02T12:32:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![RFTSystems](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/rftsystems/32/59206_2.png) [@RFTSystems](https://discuss.huggingface.co/u/RFTSystems)\
**Post date:** [January 2, 2026, 1:58pm UTC](https://discuss.huggingface.co/t/multiple-answers-for-a-context/172168/2 "2026-01-02T13:58:10Z")

</div>

Hey  
this is a very common with extractive QA.

RoBERTa (fine-tuned for _extractive_ QA like SQuAD) is fundamentally trained to return **one contiguous span** per (question, context). So if your real intent is “given this context, return _all_ matching spans (endorsement/code pairs)”, you’re trying to force a single-span head to do a **multi-span extraction** job — it will usually look “confused” because the supervision is contradictory (same input → different single-span labels).

There are basically 3 options:

1. If you only need _one_ answer at a time → make the question unambiguous

2. If you truly need _multiple answers from one question_ → treat it as extraction / tagging, not classic QA

3. If you want the model to output a list/JSON of all pairs → use a generative (seq2seq) model

Small note:  
“multiple answers” can also mean “multiple acceptable ground-truth strings for the _same_ answer” (synonyms / aliases). That _is_ supported by the SQuAD-style `answers = { "text": [...], "answer_start": [...] }` format — but the model still predicts one span; the multiple answers are mainly for evaluation and robustness, not for returning _all_ spans.

Links:

- HF Transformers QA task guide:  
[Question answering](https://huggingface.co/docs/transformers/en/tasks/question_answering)
- HF course section showing the expected `answers.text` / `answers.answer_start` list format:  
[Question answering - Hugging Face LLM Course](https://huggingface.co/learn/llm-course/en/chapter7/7)
- Token classification guide (good fit for multi-span extraction):  
[Token classification](https://huggingface.co/docs/transformers/en/tasks/token_classification)
- HF forum thread on multi-span QA → “cast it as token classification”:  
[How to do multi-span question answering?](https://discuss.huggingface.co/t/how-to-do-multi-span-question-answering/16291)
- Example reference paper for multi-span QA as sequence tagging:  
[https://aclanthology.org/2020.emnlp-main.248.pdf](https://aclanthology.org/2020.emnlp-main.248.pdf)

If you share what your _question_ looks like (and whether you need “all pairs” vs “one specific pair”), I can suggest what 1 of the 3 approaches above is best,  
hope this helps, Liam

---

_[View the full topic](https://discuss.huggingface.co/t/multiple-answers-for-a-context/172168)._
