SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1907.05545 · 2019

The Dynamic Embedded Topic Model

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; 0 honoured the contract we drafted, 0 violated it and 5 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/1907.05545.json · badge: /api/ran/1907.05545.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
adjidieng/DETM canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
get_data Ran
ran on a synthesized input
adjidieng/DETM/data.py
code served (permissive licence) · get_code("6afee90839f98e6f")
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 pickle
import scipy.io
import tempfile
import numpy as np

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

# Create mock vocabulary
vocab = ['word0', 'word1', 'word2', 'word3', 'word4']
with open(os.path.join(temp_dir, 'vocab.pkl'), 'wb') as f:
    pickle.dump(vocab, f)

# Helper function to create .mat files
def create_mat_file(path, key, data):
    scipy.io.savemat(path, {key: data})

# Create training data
create_mat_file(os.path.join(temp_dir, 'bow_tr_tokens.mat'), 'tokens', np.array([[1, 2], [3, 4]]))
create_mat_file(os.path.join(temp_dir, 'bow_tr_counts.mat'), 'counts', np.array([[1, 2], [3, 4]]))
create_mat_file(os.path.join(temp_dir, 'bow_tr_timestamps.mat'), 'timestamps', np.array([1, 2]))

# Create validation data
create_mat_file(os.path.join(temp_dir, 'bow_va_tokens.mat'), 'tokens', np.array([[5, 6]]))
create_mat_file(os.path.join(temp_dir, 'bow_va_counts.mat'), 'counts', np.array([[5, 6]]))
create_mat_file(os.path.join(temp_dir, 'bow_va_timestamps.mat'), 'timestamps', np.array([3]))

# Create test data
create_mat_file(os.path.join(temp_dir, 'bow_ts_tokens.mat'), 'tokens', np.array([[7, 8]]))
create_mat_file(os.path.join(temp_dir, 'bow_ts_counts.mat'), 'counts', np.array([[7, 8]]))
create_mat_file(os.path.join(temp_dir, 'bow_ts_timestamps.mat'), 'timestamps', np.array([4]))

# Create test split h1 data
create_mat_file(os.path.join(temp_dir, 'bow_ts_h1_tokens.mat'), 'tokens', np.array([[9, 10]]))
create_mat_file(os.path.join(temp_dir, 'bow_ts_h1_counts.mat'), 'counts', np.array([[9, 10]]))

# Create test split h2 data
create_mat_file(os.path.join(temp_dir, 'bow_ts_h2_tokens.mat'), 'tokens', np.array([[11, 12]]))
create_mat_file(os.path.join(temp_dir, 'bow_ts_h2_counts.mat'), 'counts', np.array([[11, 12]]))

ARGS = {
    'path': temp_dir,
    'temporal': False
}
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 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_document_frequency Ran
ran on a synthesized input
adjidieng/DETM/utils.py
code served (permissive licence) · get_code("bf0882a49ad15968")
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)

# The function expects:
# - data: a list of tensors (documents)
# - wi: a value to search for in documents (scalar or tensor element)
# - wj: optional, another value to search for

# Create sample document data as a list of tensors
# Each document is a 1D tensor containing word indices
doc1 = torch.tensor([[1, 2, 3, 4]])  # shape (1, 4)
doc2 = torch.tensor([[2, 5, 1]])     # shape (1, 3)
doc3 = torch.tensor([[3, 4, 5, 1, 2]]) # shape (1, 5)
doc4 = torch.tensor([[7]])            # shape (1, 1)

data = [doc1, doc2, doc3, doc4]

# Word indices to search for
wi = 1
wj = 2

ARGS = {
    "data": data,
    "wi": wi,
    "wj": wj
}
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
get_rnn_input Ran
ran on a synthesized input
adjidieng/DETM/data.py
code served (permissive licence) · get_code("6ba841db0c681c1e")
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 numpy as np
import torch

torch.manual_seed(0)

# Parameters for get_rnn_input
num_docs = 3
num_times = 2
vocab_size = 4

# Create tokens: list of arrays, one per document
# Each token array contains word indices
tokens = [
    np.array([0, 1, 2]),
    np.array([1, 3]),
    np.array([0, 2, 3, 1])
]

# Create counts: list of arrays, one per document
# Each count array contains word frequencies matching token indices
counts = [
    np.array([[1, 2, 1]]),
    np.array([[3, 2]]),
    np.array([[1, 1, 2, 1]])
]

# Create times: array of timestamps for each document
times = np.array([0, 1, 0])

ARGS = {
    'tokens': tokens,
    'counts': counts,
    'times': times,
    'num_times': num_times,
    'vocab_size': vocab_size,
    'num_docs': num_docs
}
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 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
get_topic_coherence Ran
ran on a synthesized input
adjidieng/DETM/utils.py
code served (permissive licence) · get_code("35d03c1f837283ae")
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 numpy as np
import torch

torch.manual_seed(0)

# Create sample data - list of documents where each document contains word indices
# Each element should be squeezable and containable (support "in" operator)
data = [
    torch.tensor([[1, 3, 5, 7]]),           # document 1
    torch.tensor([[2, 3, 4, 5]]),           # document 2
    torch.tensor([[1, 2, 6, 7]]),           # document 3
    torch.tensor([[3, 4, 6, 8]]),           # document 4
]

# Create beta - topic-word distribution matrix
# Shape: (num_topics, vocab_size)
# Each row represents a topic's probability distribution over vocabulary
num_topics = 2
vocab_size = 10
beta = np.random.dirichlet(np.ones(vocab_size), size=num_topics)

# Create vocab - mapping from word indices to word strings
vocab = {i: f"word_{i}" for i in range(vocab_size)}

ARGS = {
    "beta": beta,
    "data": data,
    "vocab": vocab,
}
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
log_gaussian Ran
ran on a synthesized input
adjidieng/DETM/utils.py
code served (permissive licence) · get_code("9c2bb7c80d3605e9")
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 (3, 2) 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

torch.manual_seed(0)

# z: tensor of shape (seq_len, batch_size, latent_dim)
# The function accesses z.size(), z.size(1), z.size(2), z.device
# and performs operations z - mu

z = torch.randn(3, 2, 4)  # (seq_len=3, batch_size=2, latent_dim=4)

# mu: optional, if provided should be shape (batch_size, latent_dim)
mu = torch.randn(2, 4)

# logvar: optional, if provided should be shape (batch_size, latent_dim)
logvar = torch.randn(2, 4)

ARGS = {
    "z": z,
    "mu": mu,
    "logvar": logvar
}
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 Tensor, ndim 2, dtype family float, shape (3, 2) — shape (3, 2) 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_batch Not yet run
unverified (harvested, no recorded run)
adjidieng/DETM/data.py
code served (permissive licence) · get_code("d1863ef9eb725187")
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, 1 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.

FunctionAlso present inEarliest-datedOthers named
get_document_frequency 1 other paper
1 the same month
1907.04907 (2019-07)
Topic Modeling in Embedding Spaces

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

Topic modeling analyzes documents to learn meaningful patterns of words. For documents collected in sequence, dynamic topic models capture how these patterns vary over time. We develop the dynamic embedded topic model (D-ETM), a generative model of documents that combines dynamic latent Dirichlet allocation (D-LDA) and word embeddings. The D-ETM models each word with a categorical distribution parameterized by the inner product between the word embedding and a per-time-step embedding representation of its assigned topic. The D-ETM learns smooth topic trajectories by defining a random walk prior over the embedding representations of the topics. We fit the D-ETM using structured amortized variational inference with a recurrent neural network. On three different corpora---a collection of United Nations debates, a set of ACL abstracts, and a dataset of Science Magazine articles---we found that the D-ETM outperforms D-LDA on a document completion task. We further found that the D-ETM learns more diverse and coherent topics than D-LDA while requiring significantly less time to fit.

For agents

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

get_harvested_code_for_paper("1907.05545")
get_code_for_paper("1907.05545")
have("1907.05545")

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

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

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

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

Connect an agent — have() is free.