SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.11212 · NeurIPS · 2022

VISFIS: Visual Feature Importance Supervision with Right-for-the-Right-Reason Objectives

Peter Hase, Mohit Bansal, Zhuofan Ying

arXiv · PDF · Open in the Atlas

Code that ran

5 of 6 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2206.11212.json · badge: /api/ran/2206.11212.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
zfying/visfis canonical (classifier label)
classifier basis: classifier_2025
5 ran · 1 no recorded run
FunctionStatusWhere it lives
SHAP_weighting Ran
ran; our contract draft was wrong, not the code
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("0950909878002e97")
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 float, ndim 0, dtype family float, shape () 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
import torch.nn as nn
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n - r)
    numer = reduce(op.mul, range(n, n - r, -1), 1)
    denom = reduce(op.mul, range(1, r + 1), 1)
    return numer // denom

def SHAP_weighting(opt, x):
    d = opt.num_objects
    k = int(sum(x))
    mult = 20
    return mult * (d - 1) / (ncr(d, k) * k * (d - k))

# Create a minimal config object with num_objects attribute
class OptConfig:
    def __init__(self, num_objects):
        self.num_objects = num_objects

# Create the opt object
opt = OptConfig(num_objects=5)

# Create x as a tensor with some binary values
# x represents which objects are included, so sum(x) should be valid for ncr calculation
torch.manual_seed(0)
x = torch.tensor([1.0, 0.0, 1.0, 0.0, 1.0])

ARGS = {
    "opt": opt,
    "x": x
}
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 float, ndim 0, dtype family float, shape () — shape () 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
apply_mask Ran
ran; our contract draft was wrong, not the code
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("511904da852d99b3")
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) and returned Tensor, ndim 3, dtype family float, shape (2, 4, 3) 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)

class Opt:
    def __init__(self, replace_func):
        self.replace_func = replace_func

# Test with a simple replace_func
opt = Opt('0s')

# Create small tensors with distinct dimensions
# batch_size=2, height=4, width=3, channels=5
inputs = torch.randn(2, 4, 3, device='cpu')
mask = torch.randint(0, 2, (2, 4, 3), dtype=torch.float32, device='cpu')

ARGS = {
    'opt': opt,
    'inputs': inputs,
    'mask': mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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, 4, 3) — shape (2, 4, 3) 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
forward Ran
ran; our contract draft was wrong, not the code
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("eec3cde903e4d38e")
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) and returned tuple. The image it ran in was 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

torch.manual_seed(0)

# Create a minimal config-like object
class OptConfig:
    def __init__(self, model_type):
        self.model_type = model_type

# Create a minimal tokenizer that returns the expected structure
class MinimalTokenizer:
    def __call__(self, text, padding=None, max_length=None, truncation=None, 
                 return_token_type_ids=None, return_attention_mask=None, 
                 add_special_tokens=None, return_tensors=None):
        batch_size = 2 if isinstance(text, list) else 1
        if isinstance(text, str):
            batch_size = 1
        
        class TokenizerOutput:
            def __init__(self, batch_size):
                self.input_ids = torch.randint(0, 1000, (batch_size, 20))
                self.attention_mask = torch.ones(batch_size, 20)
                self.token_type_ids = torch.zeros(batch_size, 20, dtype=torch.long)
        
        return TokenizerOutput(batch_size)

# Create a minimal model for non-lxmert case
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(2052, 100)
    
    def forward(self, qns, objs):
        batch_size = objs.shape[0]
        words = torch.randint(0, 1000, (batch_size, 10))
        logits = torch.randn(batch_size, 100)
        attended_objs = torch.randn(batch_size, 36, 2048)
        ans_idxs = torch.randint(0, 100, (batch_size,))
        return (words, logits, attended_objs, ans_idxs)

# Create a minimal LXMERT-like model
class MinimalLXMERTModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.qa_head = nn.Linear(768, 3129)
    
    def forward(self, input_ids, attention_mask, visual_feats, visual_pos, 
                token_type_ids, return_dict=True, output_attentions=False):
        batch_size = input_ids.shape[0]
        logits = torch.randn(batch_size, 3129)
        
        if return_dict:
            return {'question_answering_score': logits}
        return logits

# Test case 1: non-lxmert model
opt_non_lxmert = OptConfig(model_type='bert')
model_non_lxmert = MinimalModel()
tokenizer = MinimalTokenizer()

# Batch size 2, 36 objects, 2048 features + 5 spatial dims
objs_non_lxmert = torch.randn(2, 36, 2053)
qns_non_lxmert = torch.randint(0, 1000, (2, 20))
q_ori_non_lxmert = ["What is this?", "Where is it?"]

# Test case 2: lxmert model
opt_lxmert = OptConfig(model_type='lxmert')
model_lxmert = MinimalLXMERTModel()

# Batch size 2, 36 objects, 2048 features + 5 spatial dims
objs_lxmert = torch.randn(2, 36, 2053)
qns_lxmert = torch.randint(0, 1000, (2, 20))
q_ori_lxmert = ["What is this?", "Where is it?"]

# Use the lxmert case for ARGS
ARGS = {
    'opt': opt_lxmert,
    'model': model_lxmert,
    'tokenizer': tokenizer,
    'objs': objs_lxmert,
    'qns': qns_lxmert,
    'q_ori': q_ori_lxmert
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
generate_masks Ran
ran, honoured the contract we drafted
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("9c5dc8aa19cdc86e")
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) and returned Tensor, ndim 2, dtype family float, shape (5, 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 numpy as np
import torch

torch.manual_seed(0)
np.random.seed(0)

ARGS = {
    "num_samples": 5,
    "input_dim": 4,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, 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 (5, 4) — shape (5, 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
ncr Ran
ran, honoured the contract we drafted
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("8884fda34ce90d8e")
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 int, ndim 0, dtype family int, shape () 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
import numpy as np
from functools import reduce
import operator as op

torch.manual_seed(0)

# The function ncr(n, r) computes binomial coefficient "n choose r"
# It takes two parameters: n and r, both should be integers
# The function uses:
# - range() function calls with n, r as arguments
# - reduce with op.mul
# - integer division
# So n and r should be non-negative integers where r <= n

ARGS = {
    "n": 5,
    "r": 2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () 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
FI_forward Not yet run
unverified (harvested, no recorded run)
zfying/visfis/components/feature_impt.py
code served (permissive licence) · get_code("c3ee409c02ed594b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 5 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
ncr
brick of this paper's assembly: helper
1 other paper
1 later
2209.05523 (2022-09)
Generalization despite overfitting in quantum machine learning models

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-23.

Repositories linked to this paper

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

Abstract

Many past works aim to improve visual reasoning in models by supervising feature importance (estimated by model explanation techniques) with human annotations such as highlights of important image regions. However, recent work has shown that performance gains from feature importance (FI) supervision for Visual Question Answering (VQA) tasks persist even with random supervision, suggesting that these methods do not meaningfully align model FI with human FI. In this paper, we show that model FI supervision can meaningfully improve VQA model accuracy as well as performance on several Right-for-the-Right-Reason (RRR) metrics by optimizing for four key model objectives: (1) accurate predictions given limited but sufficient information (Sufficiency); (2) max-entropy predictions given no important information (Uncertainty); (3) invariance of predictions to changes in unimportant features (Invariance); and (4) alignment between model FI explanations and human FI explanations (Plausibility). Our best performing method, Visual Feature Importance Supervision (VISFIS), outperforms strong baselines on benchmark VQA datasets in terms of both in-distribution and out-of-distribution accuracy. While past work suggests that the mechanism for improved accuracy is through improved explanation plausibility, we show that this relationship depends crucially on explanation faithfulness (whether explanations truly represent the model's internal reasoning). Predictions are more accurate when explanations are plausible and faithful, and not when they are plausible but not faithful. Lastly, we show that, surprisingly, RRR metrics are not predictive of out-of-distribution model accuracy when controlling for a model's in-distribution accuracy, which calls into question the value of these metrics for evaluating model reasoning. 2 * Equal contribution. 2 All supporting code for experiments in this paper is available at https://github.com/zfying/visfis.

For agents

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

get_harvested_code_for_paper("2206.11212")
get_code_for_paper("2206.11212")
have("2206.11212")

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

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

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

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

Connect an agent — have() is free.