SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.01375 · EACL Findings · 2024

Dive into the Chasm: Probing the Gap between In-and Cross-Topic Generalization

Iryna Gurevych, Yufang Hou, Andreas Waldis

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 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; 7 failures of our instrument; 3 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/2402.01375.json · badge: /api/ran/2402.01375.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
ukplab/eacl2024-cross-topic-probing canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
assign_labels Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/control.py
code served (permissive licence) · get_code("0dc7954105dd5021")
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. 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 pickle
import numpy as np
import tempfile
import os

# Create a temporary pickle file with sample data
temp_dir = tempfile.mkdtemp()
pickle_file = os.path.join(temp_dir, "sample_data.pkl")

# Create sample data: list of lists of words
sample_lines = [
    ["apple", "banana", "cherry"],
    ["dog", "cat", "elephant"],
    ["apple", "dog", "fox"]
]

with open(pickle_file, 'wb') as f:
    pickle.dump(sample_lines, f)

# Define arguments for the function
ARGS = {
    "in_f": pickle_file,
    "n_labels": 5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
forward_from_specific_layer Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/bert_encoding.py
code served (permissive licence) · get_code("4e602ab97e73567f")
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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Build a minimal BertForMaskedLM-like model structure
class MinimalBertLayer(nn.Module):
    def __init__(self, hidden_size=768):
        super().__init__()
        self.dense = nn.Linear(hidden_size, hidden_size)
    
    def forward(self, x):
        return (self.dense(x),)

class MinimalBertEncoder(nn.Module):
    def __init__(self, num_layers=4, hidden_size=768):
        super().__init__()
        self.layer = nn.ModuleList([MinimalBertLayer(hidden_size) for _ in range(num_layers)])
    
    def forward(self, x):
        return x

class MinimalBertPredictions(nn.Module):
    def __init__(self, hidden_size=768):
        super().__init__()
        self.dense = nn.Linear(hidden_size, hidden_size)
        self.transform = nn.Sequential(
            nn.Linear(hidden_size, hidden_size),
            nn.Tanh(),
            nn.Linear(hidden_size, hidden_size)
        )
    
    def forward(self, x):
        return self.transform(x)

class MinimalBert(nn.Module):
    def __init__(self, hidden_size=768, num_layers=4):
        super().__init__()
        self.encoder = MinimalBertEncoder(num_layers, hidden_size)

class MinimalCls(nn.Module):
    def __init__(self, hidden_size=768):
        super().__init__()
        self.predictions = MinimalBertPredictions(hidden_size)

class MinimalBertForMaskedLM(nn.Module):
    def __init__(self, hidden_size=768, num_layers=4):
        super().__init__()
        self.bert = MinimalBert(hidden_size, num_layers)
        self.cls = MinimalCls(hidden_size)
    
    def forward(self, x):
        return self.bert(x)

# Instantiate the model
model = MinimalBertForMaskedLM(hidden_size=768, num_layers=4)

# Create arguments
seq_length = 5
layer_number = 1
layer_representation = torch.randn(1, seq_length, 768)

ARGS = {
    "model": model,
    "layer_number": layer_number,
    "layer_representation": layer_representation
}
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 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
get_num_labels Ran
ran, honoured the contract we drafted
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/control.py
code served (permissive licence) · get_code("4c42d81f47c0a093")
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 pickle
import tempfile
import os

# Create a temporary pickle file with sample labels
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "labels.pkl")

# Create sample label data: a list of lists
sample_labels = [
    [0, 1, 2],
    [1, 2, 3],
    [0, 3]
]

with open(temp_file, 'wb') as f:
    pickle.dump(sample_labels, f)

ARGS = {
    'in_f': temp_file
}
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 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
get_projection_to_intersection_of_nullspaces Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/debias/debias.py
code served (permissive licence) · get_code("f51466d4f47f3d3d")
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 ndarray, ndim 2, dtype family float, shape (4, 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 scipy.linalg

def get_rowspace_projection(W: np.ndarray) -> np.ndarray:
    """
    :param W: the matrix over its nullspace to project
    :return: the projection matrix over the rowspace
    """
    if np.allclose(W, 0):
        w_basis = np.zeros_like(W.T)
    else:
        w_basis = scipy.linalg.orth(W.T)
    w_basis * np.sign(w_basis[0][0])
    P_W = w_basis.dot(w_basis.T)
    return P_W

def get_projection_to_intersection_of_nullspaces(rowspace_projection_matrices: list, input_dim: int):
    """
    Given a list of rowspace projection matrices P_R(w_1), ..., P_R(w_n),
    this function calculates the projection to the intersection of all nullspasces of the matrices w_1, ..., w_n.
    uses the intersection-projection formula of Ben-Israel 2013 http://benisrael.net/BEN-ISRAEL-NOV-30-13.pdf:
    N(w1)∩ N(w2) ∩ ... ∩ N(wn) = N(P_R(w1) + P_R(w2) + ... + P_R(wn))
    :param rowspace_projection_matrices: List[np.array], a list of rowspace projections
    :param input_dim: input dim
    """
    I = np.eye(input_dim)
    Q = np.sum(rowspace_projection_matrices, axis=0)
    P = I - get_rowspace_projection(Q)
    return P

# Create small test matrices
input_dim = 4

# Create a couple of small weight matrices
W1 = np.random.randn(3, input_dim)
W2 = np.random.randn(2, input_dim)

# Compute their rowspace projection matrices
P_W1 = get_rowspace_projection(W1)
P_W2 = get_rowspace_projection(W2)

rowspace_projection_matrices = [P_W1, P_W2]

ARGS = {
    "rowspace_projection_matrices": rowspace_projection_matrices,
    "input_dim": input_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 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
get_rowspace_projection Ran
ran, honoured the contract we drafted
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/debias/debias.py
code served (permissive licence) · get_code("8df841b6db2c9c8a")
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 ndarray, ndim 2, dtype family float, shape (3, 3) 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 scipy

# Construct a valid numpy array argument for W
# The function uses W to check if it's close to 0, compute its transpose,
# perform SVD via scipy.linalg.orth, and do matrix multiplication
# Using a small 4x3 matrix to have distinct dimensions

W = np.array([
    [1.0, 0.5, 0.2],
    [0.3, 0.8, 0.1],
    [0.2, 0.1, 0.9],
    [0.4, 0.6, 0.3]
], dtype=np.float64)

ARGS = {
    "W": W
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 3) — shape (3, 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
label_sentences Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/control.py
code served (permissive licence) · get_code("1e2440ad06038e17")
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 pickle
import tempfile
import os
import numpy as np

# Create a temporary pickle file with sample data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'test_sentences.pkl')

# Create sample data: list of sentences where each sentence is a list of words
sample_lines = [
    ['hello', 'world', 'foo'],
    ['bar', 'hello', 'baz'],
    ['new', 'word', 'test']
]

with open(temp_file, 'wb') as f:
    pickle.dump(sample_lines, f)

# Create initial words_labels dictionary with some pre-existing mappings
words_labels_dic = {
    'hello': 0,
    'world': 1
}

# Number of labels
n_labels = 5

ARGS = {
    'in_f': temp_file,
    'words_labels_dic': words_labels_dic,
    'n_labels': n_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
load_config Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/parsing/convert_cross_topic_tasks.py
code served (permissive licence) · get_code("76f97aa1b9b381f6")
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. 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 tempfile
import os
import yaml

# Create a temporary YAML file with valid configuration
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, "test_config.yaml")

test_config = {
    "model": "test_model",
    "learning_rate": 0.001,
    "batch_size": 32,
    "epochs": 10,
    "layers": [64, 128, 256]
}

with open(config_path, 'w') as f:
    yaml.dump(test_config, f)

ARGS = {
    "path": config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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_data Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/debiased_finetuning/utils.py
code served (permissive licence) · get_code("e57d2979287b15b3")
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 os
import tempfile
import pickle
import numpy as np

# Create a temporary directory with the required files
temp_dir = tempfile.mkdtemp()

# Create last_vec.npy with some sample data
# The function expects vectors and slices them [1:-1]
sample_vecs = np.array([
    [0.1, 0.2, 0.3, 0.4, 0.5],
    [0.6, 0.7, 0.8, 0.9, 1.0]
], dtype=np.float32)
np.save(f'{temp_dir}/last_vec.npy', sample_vecs)

# Create tokens.pickle with sample labels
sample_labels = ['label1', 'label2']
with open(f'{temp_dir}/tokens.pickle', 'wb') as f:
    pickle.dump(sample_labels, f)

# Define ARGS with the path parameter
ARGS = {
    'path': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
load_labels Ran
ran; our contract draft was wrong, not the code
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/debiased_finetuning/utils.py
code served (permissive licence) · get_code("6686bf211e128ab1")
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. 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 pickle
import tempfile
import os

# Create a temporary file with pickled labels
temp_dir = tempfile.mkdtemp()
labels_file = os.path.join(temp_dir, "labels.pkl")

# Create sample labels data (can be any picklable object)
sample_labels = {
    "train": [0, 1, 0, 1],
    "val": [1, 0, 1, 0],
    "test": [0, 0, 1, 1]
}

# Write the labels to a pickle file
with open(labels_file, 'wb') as f:
    pickle.dump(sample_labels, f)

ARGS = {
    "labels_file": labels_file
}
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 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
debias_by_specific_directions Not yet run
unverified (harvested, no recorded run)
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/debias/debias.py
code served (permissive licence) · get_code("32cf84be209e2a2e")
How it ran

no invocation recorded.

lm_encoding Not yet run
unverified (harvested, no recorded run)
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/bert_encoding.py
code served (permissive licence) · get_code("6d612990f1913f51")
How it ran

no invocation recorded.

lm_masked_encoding Not yet run
unverified (harvested, no recorded run)
ukplab/eacl2024-cross-topic-probing/src/amnesic_probing/encoders/bert_encoding.py
code served (permissive licence) · get_code("35bf6ca8949889cf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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
get_projection_to_intersection_of_nullspaces 6 other papers
6 dated earlier
1901.09451 (2019-01)
Bias in Bios: A Case Study of Semantic Representation Bias in a High-Stakes Setting
2007.00049 (2020-07)
OSCaR: Orthogonal Subspace Correction and Rectification of Biases in Word Embeddings
2203.07893 (2022-03)
Gold Doesn't Always Glitter: Spectral Removal of Linear and Nonlinear Guarded Attribute Information
and 3 more not named here
debias_by_specific_directions 5 other papers
5 dated earlier
1901.09451 (2019-01)
Bias in Bios: A Case Study of Semantic Representation Bias in a High-Stakes Setting
2007.00049 (2020-07)
OSCaR: Orthogonal Subspace Correction and Rectification of Biases in Word Embeddings
2203.07893 (2022-03)
Gold Doesn't Always Glitter: Spectral Removal of Linear and Nonlinear Guarded Attribute Information
and 2 more not named here

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

Pre-trained language models (LMs) perform well in In-Topic setups, where training and testing data come from the same topics. However, they face challenges in Cross-Topic scenarios where testing data is derived from distinct topics -such as Gun Control. This study analyzes various LMs with three probing-based experiments to shed light on the reasons behind the Invs. Cross-Topic generalization gap. Thereby, we demonstrate, for the first time, that generalization gaps and the robustness of the embedding space vary significantly across LMs. Additionally, we assess larger LMs and underscore the relevance of our analysis for recent models. Overall, diverse pre-training objectives, architectural regularization, or data deduplication contribute to more robust LMs and diminish generalization gaps. Our research contributes to a deeper understanding and comparison of language models across different generalization scenarios. 1

For agents

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

get_harvested_code_for_paper("2402.01375")
get_code_for_paper("2402.01375")
have("2402.01375")

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

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

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

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

Connect an agent — have() is free.