Paper · 2022-09-20 · cs.CL, cs.AI, cs.CV, cs.LG, cs.MM
Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering
Introduces ScienceQA, 21,208 multimodal science multiple-choice questions with lectures and explanations, and trains or prompts models to write the answer followed by a lecture and explanation (chain of thought). Author-reported: fine-tuned UnifiedQA improves from 70.12% to 74.11%, and 2-shot GPT-3 from 73.97% to 75.17%.
Chain-of-thought promptingMultimodal language modelBenchmark validitybenchmarkmultimodalchain-of-thoughtscience-qa
arXivPDFCodeMarkdown12 min read
AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Some questions a student answers from school, such as a question about a diagram of a food web, need more than the text on the page. The answerer has to read the picture, remember a rule from class and string the steps together. This paper builds a set of about 21,000 such multiple-choice questions from grade-school science, social studies and language lessons. Most questions come with a short lesson and a worked explanation.
The authors then ask whether a language model does better if it is trained or prompted to write out the reasoning along with its answer. In their setup the model writes the answer first, then the lesson and the explanation. Models that do this score a few points higher than the same models without it. The gains are modest, the dataset is licensed for non-commercial use only, and the generated explanations are not always correct.
TL;DR
- Introduces ScienceQA: 21,208 multiple-choice questions with optional image or text context, plus lectures (general knowledge) and explanations (specific reasons) §3 tab. 1.
- Chain-of-thought (CoT) output format: answer, then lecture, then explanation. It improves fine-tuned UnifiedQA_\text{BASE} by 3.99 points and 2-shot GPT-3 by 1.20 points §4.2 tab. 3.
- Author-reported best result: 75.17% for 2-shot GPT-3 CoT on the 4,241-question test split; human accuracy is 88.40% tab. 3.
- Dataset is CC BY-NC-SA 4.0; the code is MIT. The paper's own CC BY 4.0 license does not cover the dataset [checklist] LICENSE-DATA.
Problem
Science question answering needs multimodal inputs, domain knowledge and multi-step reasoning. Before this work, most science datasets lacked annotated explanations, and those that had them were text-only or small §1 §2. The authors also observe that existing vision-language baselines fail on these questions and do not produce correct explanations §1.
Method
Dataset. Each item has a question, 2 to 5 options, optional text and image context, a correct answer, and optionally a lecture and an explanation. Items are split 60:20:20 at random into train, validation and test, giving 12,726, 4,241 and 4,241 items §3 §3.1 app. A.3 tab. 1. The lecture gives background for a class of problems; the explanation gives the reason for this answer §3.
Baselines. Three families are benchmarked §4.1:
- Heuristics: random choice, averaged over three trials on the whole test set, and human accuracy from Mechanical Turk workers §4.1.
- VQA models trained on the train split, fed the question, context and options as text and the image as visual input §4.1 tab. 3.
- Language models in zero-shot and few-shot form. Images are turned into captions, which are then used as text context §4.1.
Chain-of-thought formats. The paper uses one answer-first layout for both model families §4.2 fig. 5:
- UnifiedQA_\text{BASE} is fine-tuned to generate the answer, followed by the lecture and the explanation. Other formats are compared in the table (QCM→A, QCM→AE, QCM→ALE, with Q = question, C = context, M = options) §4.2 tab. 3.
- GPT-3 (text-davinci-002) is prompted with n demonstrations in the same layout and then asked to produce "The answer is X. BECAUSE: lecture explanation" for the test item §4.2 fig. 5. The paper's standard setting is 2 demonstrations §5.2 §5.4.
The idea is to replace the usual "explain, then answer" order (the original CoT form [wei2022chain]) with "answer, then explain". The paper gives the reason: a model that must write a long explanation first is more likely to stop early or run out of tokens before it gives the answer §5.4 tab. 7.
# Build a QCM->ALE prompt for one test item [§4.2] [fig. 5]
# Input: shot_ids (n training ids), test_id
# Output: one prompt string; the model writes after the final "Answer:"
def build_prompt(problems, shot_ids, test_id):
examples = []
# Demonstrations come from the training split [§5.1]
# [code: models/base_prompt.py#L101-L117]
for shot_id in shot_ids:
# Each demonstration shows the answer, then lecture, then explanation
examples.append(format_item(problems[shot_id], with_answer=True))
# The test item stops at "Answer:" so the model writes the rest [fig. 5]
examples.append(format_item(problems[test_id], with_answer=False))
# Items are separated by a blank line [code: models/base_prompt.py#L138]
return "\n\n".join(examples)
# Lay out one item as Question, Context, Options, then Answer [fig. 5]
def format_item(item, with_answer):
# Context is the text hint; the paper states an empty string when there
# is no context [app. B.1]
lines = [
"Question: " + item.question,
"Context: " + item.context,
"Options: " + options_text(item.choices), # "(A) x (B) y ..."
]
if not with_answer:
lines.append("Answer:")
return "\n".join(lines)
# Answer first, then the lecture and explanation after "BECAUSE:"
# [fig. 5] [§4.2]; newlines inside them are escaped as "\n" [app. B.1]
lines.append(
"Answer: The answer is " + item.answer_letter
+ ". BECAUSE: " + item.lecture + " " + item.solution
)
return "\n".join(lines)# Read the answer letter from one greedy GPT-3 completion [§5.1] [app. B.1]
# Input: prompt string
# Output: letter "A".."E", or None when the text has no clear answer
def predict_letter(prompt):
# Temperature 0, top-p 1, no penalties [app. B.1]
# The completion stops at the first newline [code: models/run_gpt3.py#L49]
text = complete(prompt, temperature=0.0, max_tokens=512, stop="\n")
# Look for the phrase "The answer is X." [code: models/run_gpt3.py#L53]
matches = find_all("The answer is ([A-Z]).", text)
if len(matches) == 1:
return matches[0]
return None# Turn a letter into an option index, guessing when the letter is unusable
# [code: models/run_gpt3.py#L63-L70]. The paper does not describe this step.
# Input: letter or None, number of options
# Output: option index in 0 .. num_options - 1
def resolve_index(letter, num_options):
options = ["A", "B", "C", "D", "E"]
if letter in options[:num_options]:
return options.index(letter)
# Uniform random guess among the real options
return random.randrange(num_options)Explanation metrics. Generated text is scored against the gold lecture plus gold explanation, after the "The answer is X. BECAUSE: " prefix is removed evaluations.py evaluations.py. BLEU-1 and BLEU-4, ROUGE-L and sentence-embedding cosine similarity are reported §5.3 tab. 4. Human raters judge each explanation as relevant, correct and complete, and a majority of three workers decides app. B.3.
Hyperparameters
Values in the paper come first; code-only values are marked as such.
| Name | Value | Where | Notes |
|---|---|---|---|
| GPT-3 engine | text-davinci-002 | §5.1 run_gpt3.py | "most capable version" per the paper |
| GPT-3 temperature | 0.0 | app. B.1 run_gpt3.py | greedy |
| GPT-3 top-p | 1.0 | app. B.1 run_gpt3.py | |
| GPT-3 frequency / presence penalty | 0.0 / 0.0 | app. B.1 run_gpt3.py | |
| GPT-3 max output tokens | 512 | run_gpt3.py | not stated in the paper; the paper's 512 is for the captioner |
| GPT-3 stop sequence | newline | run_gpt3.py | not stated in the paper |
| GPT-3 demonstrations (final model) | 2 | §5.2 §5.4 exp1.sh | shot counts 1 to 32 studied in fig. 7 |
| GPT-3 demonstration IDs (final run) | 6493, 16241 | app. B.1 trial 1 table; final_test_QCM-ALE_2_seed_3.json | |
| Random seed | 3 | app. B.1 exp1.sh | trial 1 |
| Repeats for error bars | 4 trials (seeds 3, 5, 7, 9) | app. B.1 | main table uses trial 1 only |
| VQA learning rate | 5e-5 | §5.1 | optimizer not stated |
| VQA max epochs | 50 | §5.1 | |
| VQA max input length | 100 tokens | app. B.1 | |
| VQA batch size | 64 | app. B.1 | |
| UnifiedQA training steps | 50k, eval every 1k | §5.1 | |
| UnifiedQA early stopping | patience 3 evaluations | §5.1 | |
| UnifiedQA learning rate, optimizer | not stated | §5.1 | no UnifiedQA training code in the repo |
| UnifiedQA batch size | 4 | app. B.1 | |
| Captioner | nlpconnect/vit-gpt2-image-captioning | app. B.1 generate_caption.py | |
| Caption max length | 16 (paper) / 64 (code) | app. B.1 / generate_caption.py | conflict, see Paper vs code |
| Caption beams | 4 | app. B.1 generate_caption.py | |
| Caption max output tokens | 512 | app. B.1 | |
| Compute | 2 × GeForce RTX 3090 | app. B.1 | for VQA and UnifiedQA; GPT-3 via the online API |
| Dataset split | 60:20:20 | §3.1 | 12,726 / 4,241 / 4,241 |
Results
Author-reported. Setup: 4,241 test items; accuracy in percent; GPT-3 runs through the API with text-davinci-002 §5.1. The first three accuracy columns split by subject, the next three by context type, and the last three by grade band and overall average tab. 3. Bold and underline marks from the paper are dropped. Deltas in parentheses are absolute points against the matching row.
| Model | Learning | Format | NAT | SOC | LAN | TXT | IMG | NO | G1-6 | G7-12 | Avg |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Random chance | - | M→A | 40.28 | 46.13 | 29.25 | 47.45 | 40.08 | 33.66 | 39.35 | 40.67 | 39.83 |
| Q only [Anderson2017up] | train set | Q→A | 41.34 | 27.22 | 47.00 | 41.79 | 35.15 | 44.60 | 39.28 | 40.87 | 39.85 |
| C_I only [Anderson2017up] | train set | C_I→A | 41.34 | 29.25 | 45.45 | 42.33 | 36.09 | 42.93 | 39.21 | 41.07 | 39.87 |
| Q+M only [Anderson2017up] | train set | QM→A | 52.66 | 51.86 | 60.18 | 55.57 | 50.37 | 57.42 | 52.53 | 57.88 | 54.44 |
| Q+C_T+M only [Anderson2017up] | train set | QC_T M→A | 57.28 | 49.04 | 61.36 | 60.46 | 52.80 | 58.82 | 54.44 | 60.51 | 56.61 |
| Q+C_I+M only [Anderson2017up] | train set | QC_I M→A | 58.97 | 53.77 | 60.45 | 62.85 | 54.49 | 57.63 | 56.72 | 61.04 | 58.26 |
| MCAN [yu2019mcan] | train set | QCM→A | 56.08 | 46.23 | 58.09 | 59.43 | 51.17 | 55.40 | 51.65 | 59.72 | 54.54 |
| Top-Down [Anderson2017up] | train set | QCM→A | 59.50 | 54.33 | 61.82 | 62.90 | 54.88 | 59.79 | 57.27 | 62.16 | 59.02 |
| BAN [Kim2018] | train set | QCM→A | 60.88 | 46.57 | 66.64 | 62.61 | 52.60 | 65.51 | 56.83 | 63.94 | 59.37 |
| DFAF [gao2019dynamic] | train set | QCM→A | 64.03 | 48.82 | 63.55 | 65.88 | 54.49 | 64.11 | 57.12 | 67.17 | 60.72 |
| ViLT [pmlr-v139-kim21k] | train set | QCM→A | 60.48 | 63.89 | 60.27 | 63.20 | 61.38 | 57.00 | 60.72 | 61.90 | 61.14 |
| Patch-TRM [lu2021iconqa] | train set | QCM→A | 65.19 | 46.79 | 65.55 | 66.96 | 55.28 | 64.95 | 58.04 | 67.50 | 61.42 |
| VisualBERT [li2019visualbert] | train set | QCM→A | 59.33 | 69.18 | 61.18 | 62.71 | 62.17 | 58.54 | 62.96 | 59.92 | 61.87 |
| UnifiedQA_\text{SMALL} [raffel2020exploring] | zero-shot | QCM→A | 47.78 | 40.49 | 46.00 | 50.24 | 44.12 | 44.39 | 45.56 | 46.21 | 45.79 |
| UnifiedQA_\text{BASE} [raffel2020exploring] | zero-shot | QCM→A | 50.13 | 44.54 | 48.18 | 53.08 | 48.09 | 46.69 | 47.58 | 50.03 | 48.46 |
| UnifiedQA_\text{SMALL} [raffel2020exploring] | train set | QCM→A | 53.77 | 58.04 | 61.09 | 52.10 | 51.51 | 61.46 | 58.22 | 53.59 | 56.57 |
| UnifiedQA_\text{BASE} [raffel2020exploring] | train set | QCM→A | 68.16 | 69.18 | 74.91 | 63.78 | 61.38 | 77.84 | 72.98 | 65.00 | 70.12 |
| UnifiedQA_\text{BASE} (CoT) | train set | QCM→AE | 70.60 | 74.02 | 78.36 | 65.69 | 64.80 | 81.53 | 75.48 | 69.48 | 73.33 (+3.21) |
| UnifiedQA_\text{BASE} (CoT) | train set | QCM→ALE | 71.00 | 76.04 | 78.91 | 66.42 | 66.53 | 81.81 | 77.06 | 68.82 | 74.11 (+3.99) |
| GPT-3 [chen2020big] | zero-shot | QCM→A | 75.04 | 66.59 | 78.00 | 74.24 | 65.74 | 79.58 | 76.36 | 69.87 | 74.04 |
| GPT-3 [chen2020big] | 2-shot | QCM→A | 74.64 | 69.74 | 76.00 | 74.44 | 67.28 | 77.42 | 76.80 | 68.89 | 73.97 |
| GPT-3 (CoT) | 2-shot | QCM→AE | 76.60 | 65.92 | 77.55 | 75.51 | 66.09 | 79.58 | 78.49 | 67.63 | 74.61 (+0.64) |
| GPT-3 (CoT) | 2-shot | QCM→ALE | 75.44 | 70.87 | 78.09 | 74.68 | 67.43 | 79.93 | 78.23 | 69.68 | 75.17 (+1.20) |
| Human | - | QCM→A | 90.23 | 84.97 | 87.48 | 89.60 | 87.50 | 88.10 | 91.59 | 82.42 | 88.40 |
Format key: Q question, C context, C_T text context, C_I image context, M options, A answer, AE answer and explanation, ALE answer, lecture and explanation tab. 3.
Explanation quality, author-reported, from tab. 4:
| Model | Format | BLEU-1 | BLEU-4 | ROUGE-L | Similarity | Relevant | Correct | Complete | Gold |
|---|---|---|---|---|---|---|---|---|---|
| UnifiedQA_\text{BASE} (CoT) | QCM→ALE | 0.397 | 0.370 | 0.714 | 0.811 | 80.4% | 76.6% | 76.1% | 56.9% |
| GPT-3 (CoT) | QCM→AE | 0.234 | 0.048 | 0.351 | 0.561 | 76.9% | 73.0% | 70.5% | 52.5% |
| GPT-3 (CoT) | QCM→ALE | 0.192 | 0.052 | 0.323 | 0.595 | 88.5% | 78.8% | 84.5% | 65.2% |
Ablations and upper bounds, author-reported:
- Prompt layout with 4 demonstrations, GPT-3 CoT, on accuracy fig. 7a: the paper reports QCM→ALE as the highest mean and lowest variance; QCM→AE has the largest variance.
- Number of demonstrations fig. 7b: QCM→ALE peaks at 2 demonstrations, then declines as more are added.
- Dynamic demonstration selection tab. 5: QCM→ALE with examples from the same topic, category or skill scores 75.15, 74.58 and 75.10, against 75.17 for random sampling.
- Upper bound with gold lecture or explanation in the test prompt tab. 6: QCME*→A 94.03 (+18.86); QCMLE*→A 94.13 (+18.96) over QCM→ALE 75.17. These use gold answers' explanations, so they are oracle numbers, not a method.
- Output order on 1,000 test items tab. 7: QCM→ALE 73.6; QCM→LA 60.6; QCM→EA 56.0; QCM→LEA 55.4; QCM→ELA 51.5.
- Fewer training items fig. 8: UnifiedQA with CoT reaches the accuracy of plain UnifiedQA with only 40% of the training data §1 §5.4.
Paper vs code
Official repository: lupantech/ScienceQA, owned by first author Pan Lu, at
commit 2cbf8318e07b9ece895bb2ae605e71e38d623264. It holds the GPT-3 runner,
prompt builder, captioner and evaluation scripts. It does not hold the VQA
baseline or UnifiedQA training code. Discrepancies:
- Caption length. The paper says the captioner's maximum caption length is
16 app. B.1. The code uses
max_length = 64generate_caption.py, and the releaseddata/captions.jsonrecordsmax_length64 captions.json. - Empty context. The paper says an empty string when there is no context app. B.1. The code writes "N/A" base_prompt.py.
- Captions in the GPT-3 run. Captions are used only with
--use_caption, which defaults to off run_gpt3.py. The provided run command does not pass it exp1.sh. The released result file'sargshas nouse_captionkey final_test_QCM-ALE_2_seed_3.json, so whether captions reached the 75.17% run cannot be read from the repository. The paper does not say either. - Demonstration choice. The paper lists fixed trial IDs app. B.1. The code
draws demonstrations with Python's
random.sampleafterrandom.seed(seed)run_gpt3.py run_gpt3.py. The released run's IDs (6493, 16241) are the first two of trial 1, which suggests the seed reproduces the paper's draws, but this is inferred from the outputs, not stated. - Unparseable outputs. The code guesses at random when no "The answer is X." phrase is found run_gpt3.py run_gpt3.py. The paper does not mention this fallback, and the number of such cases is not reported.
- Similarity model. The paper names Sentence-BERT §5.3. The code loads
sentence-transformers/all-MiniLM-L6-v2evaluate_explaination.py. - Explanation reference. The code uses lecture plus solution as the BLEU, ROUGE and similarity reference evaluations.py. The paper does not say what the reference is.
- Script name.
models/paper.shcallsrun_gpt3_v2.py, which is not in the repository paper.sh. The working command is inexp1.sh, which callsrun_gpt3.pyexp1.sh. - Shot-ID flag.
--shot_qidsis declared withtype=listrun_gpt3.py. Given on the command line, argparse splits the string into single characters, so the flag does not work as written. The IDs have to be set in code. - Test split default. The runner defaults to
valrun_gpt3.py;exp1.shpassestest. The paper's 75.17% is on test.
No other differences were found in the GPT-3 prompt format, sampling settings or answer-first layout, which match §4.2 and fig. 5.
Pitfalls
- Dataset license. The paper's CC BY 4.0 covers the paper. The dataset is CC BY-NC-SA 4.0 and "for non-commercial research purposes only", with the copyright held by IXL [checklist] app. A.1. The project page and LICENSE-DATA say the same LICENSE-DATA. Do not reuse the dataset commercially. This card publishes only the paper's aggregate numbers.
- Improvements are absolute points. "3.99%" and "1.20%" are differences between accuracies, not relative gains tab. 3. Against zero-shot GPT-3 (74.04), the best 2-shot CoT result (75.17) is 1.13 points higher (computed from tab. 3); the 1.20-point headline is against 2-shot GPT-3 without CoT.
- Oracle numbers. The 94% upper bounds put gold explanations in the prompt §5.4 tab. 6. They show that explanation quality matters, not that a model can reach that score.
- Output order. Writing the lecture or explanation before the answer costs many points tab. 7, and the code stops generation at a newline run_gpt3.py. A parser that expects the answer on the same line as the explanation will fail if the model inserts a newline.
- Explanation metrics. Automatic scores track surface and embedding similarity to the gold text. The paper itself says these are partial §5.3. Human ratings are majority votes of three workers, and the study pays about $0.5 per HIT for 15 questions app. B.2 app. B.3.
- Dataset inconsistency. §3.1 says 91.3% of questions have an explanation; tab. 1 gives 19,202 of 21,208 (90.5%). Use the table.
- Caption quality. The paper says captions "lack fine-grained semantics" and fail on diagrams app. B.4. Image-context results depend on this text bridge.
- Human baseline. The AMT study uses qualification by exam (4 of 5 correct) and three workers per set app. B.2. Human 88.40% is an author-run number, not a reference ceiling.
- Reproducing 75.17. Needs text-davinci-002 through the OpenAI API (the paper's engine; its current availability is not stated here), the same two demonstration IDs, seed 3, the test split of 4,241 items, greedy decoding, and the answer-first QCM→ALE format. The repository asserts 4,241 items in its accuracy script evaluate_acc.py.
- Missing details. UnifiedQA learning rate, optimizer and exact input string are not stated §5.1 §4.1. The VQA baselines' optimizer is not stated.
Lineage
- Builds on: chain-of-thought prompting [wei2022chain] (2201.11903); the paper reverses its explain-then-answer order §4.2. UnifiedQA [khashabi2020unifiedqa] and GPT-3 [chen2020big] are the base models; neither has a card here.
- Compared against: VQA models Top-Down, BAN, DFAF, ViLT, Patch-TRM and VisualBERT tab. 3; the image-caption baselines use [dosovitskiy2020image] and [radford2019language] §4.1.
- Used by later work: the README of the official repository lists Multimodal-CoT, arXiv:2302.00923 (2302.00923), among follow-ups that use ScienceQA README.md.
Source and license
Adapted from “Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering” by Pan Lu, Swaroop Mishra, Tony Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, Ashwin Kalyan (arXiv:2209.09513), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/lupantech/ScienceQA at commit 2cbf8318e07b (MIT). Any quoted code is shown under that license.