SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.05655 · 2022

DisentQA: Disentangling Parametric and Contextual Knowledge with Counterfactual Question Answering

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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 4 have no contract verdict; 0 failures of our instrument; 1 no recorded run), 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/2211.05655.json · badge: /api/ran/2211.05655.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
ellaneeman/disent_qa canonical (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
get_data_for_fine_tuning Ran
ran on a synthesized input
ellaneeman/disent_qa/run_nq_fine_tuning.py
code served (permissive licence) · get_code("f1d4e257c8e1ff65")
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 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 pandas as pd
import tempfile
import os

# Create temporary directory and CSV files
temp_dir = tempfile.mkdtemp()

# Create sample training data
train_data = {
    'text': ['sample text 1', 'sample text 2', 'sample text 3'],
    'label': ['A', 'B', 'A']
}
train_df = pd.DataFrame(train_data)
train_path = os.path.join(temp_dir, 'data_train_split.csv')
train_df.to_csv(train_path, index=False)

# Create sample validation data
val_data = {
    'text': ['sample text 4', 'sample text 5'],
    'label': ['B', 'A']
}
val_df = pd.DataFrame(val_data)
val_path = os.path.join(temp_dir, 'data_val_split.csv')
val_df.to_csv(val_path, index=False)

# Create the main data file path (will be split to get train/val splits)
main_path = os.path.join(temp_dir, 'data.csv')

ARGS = {
    'path': main_path,
    'n_epochs': 3,
    'learning_rate': 0.0001,
    's_max_token_len': 396,
    'batch_size': 8
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
json_to_pandas Ran
ran on a synthesized input
ellaneeman/disent_qa/prepare_data.py
code served (permissive licence) · get_code("a19a75e14c98f83a")
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 DataFrame. 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 json
import pandas as pd
import gzip
import tempfile
import os

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

# Create a test JSON Lines file (uncompressed)
json_lines_path = os.path.join(temp_dir, "test.jsonl")
with open(json_lines_path, 'w') as f:
    f.write(json.dumps({"name": "Alice", "age": 30}) + "\n")
    f.write(json.dumps({"name": "Bob", "age": 25}) + "\n")
    f.write(json.dumps({"name": "Charlie", "age": 35}) + "\n")

# Create a test gzipped JSON Lines file
gzipped_path = os.path.join(temp_dir, "test.jsonl.gz")
with gzip.open(gzipped_path, 'wt') as f:
    f.write(json.dumps({"name": "Dave", "age": 28}) + "\n")
    f.write(json.dumps({"name": "Eve", "age": 32}) + "\n")

ARGS = {
    "path": json_lines_path,
    "gzipped": False,
    "nrows": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
save_split Ran
ran on a synthesized input
ellaneeman/disent_qa/prepare_data.py
code served (permissive licence) · get_code("4aee7c93f0ffb3ad")
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 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 pandas as pd
import tempfile
import os

# Create a temporary directory for file output
temp_dir = tempfile.mkdtemp()
temp_path = os.path.join(temp_dir, "test_data")

# Create a sample DataFrame with the required 'type' column
df = pd.DataFrame({
    'type': ['answerable', 'unanswerable', 'answerable', 'answerable', 'unanswerable', 'answerable'],
    'question': ['Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6'],
    'answer': ['A1', 'A2', 'A3', 'A4', 'A5', 'A6']
})

ARGS = {
    'df': df,
    'path': temp_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
split_by_fraction Ran
ran on a synthesized input
ellaneeman/disent_qa/prepare_data.py
code served (permissive licence) · get_code("0417db2d6a6d3158")
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 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 pandas as pd
import numpy as np

# Create a small DataFrame with some sample data
data = {
    'col1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
    'col2': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],
    'col3': [10.5, 20.5, 30.5, 40.5, 50.5, 60.5, 70.5, 80.5, 90.5, 100.5]
}
df = pd.DataFrame(data)

ARGS = {
    'df': df,
    'fraction': 0.8
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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_answer Not yet run
unverified (harvested, no recorded run)
ellaneeman/disent_qa/query_model.py
code served (permissive licence) · get_code("a0de6f5df583e698")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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 models commonly have access to two sources of "knowledge" during inference time: (1) parametric knowledge - the factual knowledge encoded in the model weights, and (2) contextual knowledge - external knowledge (e.g., a Wikipedia passage) given to the model to generate a grounded answer. Having these two sources of knowledge entangled together is a core issue for generative QA models as it is unclear whether the answer stems from the given non-parametric knowledge or not. This unclarity has implications on issues of trust, interpretability and factuality. In this work, we propose a new paradigm in which QA models are trained to disentangle the two sources of knowledge. Using counterfactual data augmentation, we introduce a model that predicts two answers for a given question: one based on given contextual knowledge and one based on parametric knowledge. Our experiments on the Natural Questions dataset show that this approach improves the performance of QA models by making them more robust to knowledge conflicts between the two knowledge sources, while generating useful disentangled answers.

For agents

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

get_harvested_code_for_paper("2211.05655")
get_code_for_paper("2211.05655")
have("2211.05655")

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

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

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

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

Connect an agent — have() is free.