SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2111.01026 · NeurIPS · 2021

Introspective Distillation for Robust Question Answering

Hanwang Zhang, Yulei Niu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 0 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2111.01026.json · badge: /api/ran/2111.01026.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
yuleiniu/introd canonical (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
elementwise_logsumexp Ran
ran; our contract draft was wrong, not the code
yuleiniu/introd/css/vqa_debias_loss_functions.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from chrisc36/bottom-up-attention-vqa, is pointer only (licence: GPL-3.0) · get_code("4bd23f3562cfbd1c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from chrisc36/bottom-up-attention-vqa, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

compute_score_with_logits Ran
ran on a synthesized input
yuleiniu/introd/css/train_introd.py
code served (permissive licence) · get_code("b0c03ea63e761316")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create logits tensor: shape (batch_size=2, num_classes=4)
logits = torch.randn(2, 4)

# Create labels tensor: shape (batch_size=2, num_classes=4)
# One-hot encoded labels for multi-label classification
labels = torch.zeros(2, 4)
labels[0, 1] = 1
labels[1, 2] = 1

ARGS = {
    "logits": logits,
    "labels": labels,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_sigmoid_logits_to_binary_logprobs Ran
ran; our contract draft was wrong, not the code
yuleiniu/introd/css/vqa_debias_loss_functions.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from chrisc36/bottom-up-attention-vqa, is pointer only (licence: GPL-3.0) · get_code("0e2c50fe59debfb7")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from chrisc36/bottom-up-attention-vqa, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

evaluate Ran
ran on a synthesized input
yuleiniu/introd/css/train_introd.py
code served (permissive licence) · get_code("0a0886422bf580b6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch.autograd import Variable

torch.manual_seed(0)

class DummyModel(nn.Module):
    def __init__(self):
        super(DummyModel, self).__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, v, q, a, b, c):
        # v: visual features, q: questions
        # Returns pred, _, _, _
        batch_size = v.size(0)
        pred = self.linear(v)  # (batch_size, 3) - logits for 3 answer classes
        return pred, None, None, None

# Create a small dataloader
# Each item: (v, q, a, b, qids, _)
# v: visual features (batch_size, 4)
# q: questions (batch_size, 4)
# a: answers one-hot (batch_size, 3)
# b: placeholder
# qids: question ids (batch_size,)
# _: placeholder
dataloader_items = []
for batch_idx in range(2):
    v = torch.randn(2, 4)  # batch_size=2, visual_dim=4
    q = torch.randn(2, 4)  # batch_size=2, question_dim=4
    a = torch.zeros(2, 3)  # batch_size=2, num_answers=3
    a[0, 1] = 1.0  # first sample, answer index 1
    a[1, 2] = 1.0  # second sample, answer index 2
    b = torch.randn(2, 1)  # placeholder
    qids = torch.tensor([1000 + batch_idx * 2, 1001 + batch_idx * 2])  # question ids
    placeholder = None
    dataloader_items.append((v, q, a, b, qids, placeholder))

class DummyDataLoader:
    def __init__(self, items):
        self.items = items
        self.dataset = type('obj', (object,), {'__len__': lambda self: sum(item[0].size(0) for item in items)})()
    
    def __iter__(self):
        return iter(self.items)
    
    def __len__(self):
        return len(self.items)

dataloader = DummyDataLoader(dataloader_items)

# Create qid2type mapping
qid2type = {
    '1000': 'yes/no',
    '1001': 'other',
    '1002': 'number',
    '1003': 'yes/no'
}

model = DummyModel()

ARGS = {
    'model': model,
    'dataloader': dataloader,
    'qid2type': qid2type
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_folder Ran
ran; our contract draft was wrong, not the code
yuleiniu/introd/css/utils.py
code served (permissive licence) · get_code("8c1252eacab71602")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory with some test files
temp_dir = tempfile.mkdtemp()

# Create some test files with different suffixes
test_files = [
    "image_001.jpg",
    "image_002.jpg",
    "image_003.png",
    "readme.txt",
    "data_file.jpg",
]

for filename in test_files:
    filepath = os.path.join(temp_dir, filename)
    with open(filepath, 'w') as f:
        f.write("test content")

# Define ARGS for load_folder function
ARGS = {
    "folder": temp_dir,
    "suffix": ".jpg"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
mask_softmax Ran
ran on a synthesized input
yuleiniu/introd/css/base_model_introd.py
code served (permissive licence) · get_code("f7c124aefa1d760f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Construct tiny tensors
# x: needs to support torch.exp, torch.max, multiplication, division
# Shape: (batch=2, seq_len=3, feature_dim=4)
x = torch.randn(2, 3, 4)

# mask: needs to support unsqueeze(2) and float()
# Shape: (batch=2, seq_len=3) - will be unsqueezed to (2, 3, 1)
mask = torch.ones(2, 3)

ARGS = {
    "x": x,
    "mask": mask,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
renormalize_binary_logits Ran
ran; our contract draft was wrong, not the code
yuleiniu/introd/css/vqa_debias_loss_functions.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from chrisc36/bottom-up-attention-vqa, is pointer only (licence: GPL-3.0) · get_code("21690a7e909f0f41")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from chrisc36/bottom-up-attention-vqa, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 1 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
load_folder 7 other papers
5 dated earlier, 2 later
1805.07932 (2018-05)
Bilinear Attention Networks
1902.09368 (2019-02)
Dual Attention Networks for Visual Reference Resolution in Visual Dialog
2006.14744 (2020-06)
Graph Optimal Transport for Cross-Domain Alignment
and 4 more not named here
convert_sigmoid_logits_to_binary_logprobs 4 other papers
4 dated earlier
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering
and 1 more not named here
elementwise_logsumexp 4 other papers
4 dated earlier
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering
and 1 more not named here
renormalize_binary_logits 3 other papers
3 dated earlier
1707.07998 (2017-07)
Bottom-Up and Top-Down Attention for Image Captioning and Visual Question Answering
1909.03683 (2019-09)
Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases
2003.06576 (2020-03)
Counterfactual Samples Synthesizing for Robust Visual Question Answering

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Question answering (QA) models are well-known to exploit data bias, e.g., the language prior in visual QA and the position bias in reading comprehension. Recent debiasing methods achieve good out-of-distribution (OOD) generalizability with a considerable sacrifice of the in-distribution (ID) performance. Therefore, they are only applicable in domains where the test distribution is known in advance. In this paper, we present a novel debiasing method called Introspective Distillation (IntroD) to make the best of both worlds for QA. Our key technical contribution is to blend the inductive bias of OOD and ID by introspecting whether a training sample fits in the factual ID world or the counterfactual OOD one. Experiments on visual QA datasets VQA v2, VQA-CP, and reading comprehension dataset SQuAD demonstrate that our proposed IntroD maintains the competitive OOD performance compared to other debiasing methods, while sacrificing little or even achieving better ID performance compared to the non-debiasing ones. Question answering (QA), which requires machines to answer questions given a context, is one of the most fundamental AI tasks. Popular contexts are vision (e.g., image for VQA [10]) and natural language (e.g., passage for extractive QA [38]). A common observation is that QA models prefer to over-exploit the training bias, which bypasses the context comprehension for a shortcut answer. For example, by only using the linguistic correlations between questions and answers, VQA models can answer most questions correctly [22,7,10,27]. Similarly, extractive QA models may use the spurious positional cues to locate the answer in the passage [30]. As a result, QA models that have already achieved strong in-distribution (ID) performance may inevitably fail in out-of-distribution (OOD) test scenarios, regardless of the scale of training data and models [20,30,50]. Recently, several debiasing methods aim to close the gap between the ID and OOD performances [12,17,13,35]. However, many of them hold the assumption that the training and test distributions are very different or even reversed, e.g., if there are more "yes" answers in training, there must be more "no" answers in testing. As a result, these methods encounter a severe performance drop under the ID evaluation, although they significantly outperform non-debiasing baselines in terms of OOD performance. An interesting observation from Figure 1 is that non-debiasing methods (circles) obtain high ID but low OOD performance, while debiasing methods (squares) achieve high OOD but low ID performance. This observation motivates us to ask: can we make the best of both worlds? 35th Conference on Neural Information Processing Systems (NeurIPS 2021).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2111.01026")
get_code_for_paper("2111.01026")
have("2111.01026")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2111.01026.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2111.01026.svg)](https://syntology.ai/paper/2111.01026)

Connect an agent — have() is free.