SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.07737 · 2020

Cross-lingual Contextualized Topic Models with Zero-shot Learning

arXiv · PDF · Open in the Atlas

Code that ran

6 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 6 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2004.07737.json · badge: /api/ran/2004.07737.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
MilaNLProc/contextualized-topic-models canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
aaronmueller/contextualized-topic-models community (classifier label)
classifier basis not recorded on the link
2 ran · 0 no recorded run
FunctionStatusWhere it lives
get_bag_of_words Ran
ran on a synthesized input
MilaNLProc/contextualized-topic-models/contextualized_topic_models/utils/data_preparation.py
code served (permissive licence) · get_code("b0c176c7853fcf40")
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 csr_matrix. 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 numpy as np
import scipy.sparse

# Analyze the function:
# - data: iterable of numpy arrays containing integers (possibly with None values)
# - min_length: integer used in np.bincount
# The function filters out None values, converts to int, counts occurrences,
# and creates a sparse matrix from the results

# Create sample data: list of numpy arrays with integer values
# Some arrays may have None-like values that need filtering
data = [
    np.array([0, 1, 2, 1, 0]),  # array with some repeated integers
    np.array([1, 2, 3, 2]),      # another array
    np.array([0, 0, 1]),         # simpler array
]

min_length = 5

ARGS = {
    "data": data,
    "min_length": min_length,
}
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 csr_matrix — a csr_matrix output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a csr_matrix 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
get_bag_of_words Ran
ran on a synthesized input
aaronmueller/contextualized-topic-models/contextualized_topic_models/utils/data_preparation.py
code served (permissive licence) · get_code("2bab4ca3b1881667")
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 int, shape (3, 5) 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

# Analyze the function:
# - data: iterable of numpy arrays
# - min_length: int (minlength parameter for np.bincount)
# 
# The function:
# 1. Iterates over x in data
# 2. Filters x[x != np.array(None)] - removes None values
# 3. Converts to int with .astype('int')
# 4. Uses np.bincount(x, minlength=min_length)
# 5. Filters out rows where np.sum(x[x != np.array(None)]) == 0
#
# So data should be a list/iterable of numpy arrays containing integers and possibly None values

# Create sample data: list of numpy arrays with integer values
# Include one array that will be filtered out (all None or sum to 0)
data = [
    np.array([0, 1, 2, 1, 0]),
    np.array([1, 3, 1, 2]),
    np.array([2, 2, 0]),
]

# min_length parameter - should be >= max value in arrays
min_length = 5

ARGS = {
    'data': data,
    'min_length': min_length,
}
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 ndarray, ndim 2, dtype family int, shape (3, 5) — shape (3, 5) 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
load_topics Ran
ran on a synthesized input
aaronmueller/contextualized-topic-models/sample_docs_per_topic.py
code served (permissive licence) · get_code("dcddf652ee7fa2f2")
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 int; 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 tempfile
import os

# Create a temporary file with topic data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("5\n")
temp_file.write("10\n")
temp_file.write("3\n")
temp_file.write("7\n")
temp_file.close()

ARGS = {
    'topic_file': temp_file.name
}
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 int — 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
overlap Ran
ran on a synthesized input
MilaNLProc/contextualized-topic-models/contextualized_topic_models/evaluation/rbo/rbo.py
code served (permissive licence) · get_code("f023d128a418f9ec")
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 numpy as np

# Based on the function signature and docstring examples:
# overlap(list1, list2, depth)
# - list1: a list (can contain strings, ints, or sets)
# - list2: a list (can contain strings, ints, or sets)
# - depth: an integer representing how many elements to consider

# From the doctests we can see:
# - overlap("abcd", "abcd", 3) returns 3.0
# - overlap("abcd", "abcd", 5) returns 4.0
# - overlap with lists containing sets like ["a", {"b", "c"}, "d"]

# Create test arguments based on the docstring examples
list1 = "abcd"
list2 = "abcd"
depth = 3

ARGS = {
    "list1": list1,
    "list2": list2,
    "depth": depth
}
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 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
raw_overlap Ran
ran on a synthesized input
MilaNLProc/contextualized-topic-models/contextualized_topic_models/evaluation/rbo/rbo.py
code served (permissive licence) · get_code("d210d869cd7f10c9")
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, ndim 1, dtype family int; 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 torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - raw_overlap takes list1, list2, and depth
# - It calls set_at_depth on both lists
# - set_at_depth takes lst and depth, slices lst[:depth], and creates a set
#   from elements, updating if element is a set, otherwise adding it
# - The function returns overlap counts based on set intersection

# Create test data: lists with mixed elements and sets
list1 = [1, 2, {3, 4}, 5, 6]
list2 = [2, 3, {4, 5}, 7, 8]
depth = 3

ARGS = {
    "list1": list1,
    "list2": list2,
    "depth": depth
}
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, ndim 1, dtype family int — a tuple 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
set_at_depth Ran
ran on a synthesized input
MilaNLProc/contextualized-topic-models/contextualized_topic_models/evaluation/rbo/rbo.py
code served (permissive licence) · get_code("e6436bd35135088d")
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 set. 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 numpy as np

torch.manual_seed(0)

# The function set_at_depth takes a list and a depth parameter
# It iterates through the first 'depth' elements of the list
# For each element, if it's a set, it updates ans with its contents
# Otherwise, it adds the element directly to ans
# Return type is a set

# Create test arguments
lst = [
    {1, 2, 3},           # a set
    5,                   # an integer
    {7, 8},              # another set
    "hello",             # a string
    {10, 11, 12}         # another set
]

depth = 3

ARGS = {
    "lst": lst,
    "depth": depth
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
kl_div Not yet run
unverified (harvested, no recorded run)
MilaNLProc/contextualized-topic-models/contextualized_topic_models/evaluation/measures.py
code served (permissive licence) · get_code("7e573106cb435fab")
How it ran

no invocation 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, 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 7 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-21.

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 data sets (e.g., reviews, forums, news, etc.) exist parallelly in multiple languages. They all cover the same content, but the linguistic differences make it impossible to use traditional, bag-of-word-based topic models. Models have to be either single-language or suffer from a huge, but extremely sparse vocabulary. Both issues can be addressed by transfer learning. In this paper, we introduce a zero-shot cross-lingual topic model. Our model learns topics on one language (here, English), and predicts them for unseen documents in different languages (here, Italian, French, German, and Portuguese). We evaluate the quality of the topic predictions for the same document in different languages. Our results show that the transferred topics are coherent and stable across languages, which suggests exciting future research directions.

For agents

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

get_harvested_code_for_paper("2004.07737")
get_code_for_paper("2004.07737")
have("2004.07737")

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

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

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

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

Connect an agent — have() is free.