SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1705.09296 · 2017

Neural Models for Documents with Metadata

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 4 failures of our instrument; 0 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/1705.09296.json · badge: /api/ran/1705.09296.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
dallascard/scholar canonical (classifier label)
classifier basis: classifier_2025
4 ran · 0 no recorded run
dallascard/neural_topic_models canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
maximilianahrens/scholar4regression extension (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
check_sparsity Ran
ran, honoured the contract we drafted
dallascard/neural_topic_models/theano_code/run_ngtm.py
code served (permissive licence) · get_code("3dc75aaf31d3c1f1")
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 float64, 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 numpy as np
import torch
import torch.nn as nn

class MockNVDMModel(nn.Module):
    def __init__(self, d_v, d_t, n_classes, use_interactions=False):
        super().__init__()
        self.d_v = d_v
        self.d_t = d_t
        self.n_classes = n_classes
        self.use_interactions = use_interactions
        
        # Create weight parameters with get_value() method
        self.W_decoder = MockParameter(np.random.randn(d_v, d_t) * 0.01)
        
        if n_classes > 1:
            self.W_decoder_label = MockParameter(np.random.randn(d_v, n_classes) * 0.01)
            
            if use_interactions:
                self.W_decoder_inter = MockParameter(np.random.randn(d_v, d_t, n_classes) * 0.01)

class MockParameter:
    def __init__(self, value):
        self.value = value
    
    def get_value(self):
        return self.value

# Create a minimal NVDM model with realistic dimensions
model = MockNVDMModel(
    d_v=4,      # vocabulary dimension
    d_t=3,      # topic dimension (> 1)
    n_classes=2, # number of classes (> 1)
    use_interactions=True
)

ARGS = {
    "model": model,
    "sparsity_threshold": 0.001
}
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 float64, 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
clean_text Ran
ran; our contract draft was wrong, not the code
dallascard/scholar/preprocess_data.py
code served (permissive licence) · get_code("128fcff9d8fad853")
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 str. 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 re
import string

punct_chars = list(set(string.punctuation) - set("'"))
punctuation = ''.join(punct_chars)
replace = re.compile('[%s]' % re.escape(punctuation))

def clean_text(text, strip_html=False, lower=True, keep_emails=False, keep_at_mentions=False):
    if strip_html:
        text = re.sub('<[^>]+>', '', text)
    else:
        text = re.sub('<', '(', text)
        text = re.sub('>', ')', text)
    if lower:
        text = text.lower()
    if not keep_emails:
        text = re.sub('\\S+@\\S+', ' ', text)
    if not keep_at_mentions:
        text = re.sub('\\s@\\S+', ' ', text)
    text = re.sub('_', ' ', text)
    text = re.sub("\\s\\'", ' ', text)
    text = re.sub("\\'\\s", ' ', text)
    text = re.sub('\\.', '', text)
    text = replace.sub(' ', text)
    text = re.sub("\\'", '', text)
    text = re.sub('\\s', ' ', text)
    text = text.strip()
    return text


ARGS = {
    'text': "Hello World! This is a test. Check out user@example.com and @mention with <tags> and some_underscore text.",
    'strip_html': False,
    'lower': True,
    'keep_emails': False,
    'keep_at_mentions': False
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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_init_bg Ran
ran, honoured the contract we drafted
maximilianahrens/scholar4regression/run_scholar_tf.py
code served (permissive licence) · get_code("cedf470224aa537d")
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 1, dtype family float, shape (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

# Create a small sample data array
# The function expects data where:
# - np.sum(data, axis=0) sums across rows (axis 0)
# - Result should be a 1D array of word counts
# Shape: (num_documents, num_words)
data = np.array([
    [5, 2, 3, 1],
    [1, 4, 2, 2],
], dtype=np.int32)

ARGS = {
    'data': data
}
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 1, dtype family float, shape (4,) — shape (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
load_covariates Ran
ran; our contract draft was wrong, not the code
dallascard/scholar/run_scholar.py
code served (permissive licence) · get_code("8034f621e3629839")
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 numpy as np
import pandas as pd

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

# Create sample covariate CSV files
covar_data_1 = pd.DataFrame({
    'covar1': [1.0, 2.0, 3.0, 4.0, 5.0],
    'covar2': [10.0, 20.0, 30.0, 40.0, 50.0]
}, index=['row0', 'row1', 'row2', 'row3', 'row4'])

covar_data_2 = pd.DataFrame({
    'covar3': [100.0, 200.0, 300.0, 400.0, 500.0],
    'covar4': [1000.0, 2000.0, 3000.0, 4000.0, 5000.0]
}, index=['row0', 'row1', 'row2', 'row3', 'row4'])

# Write CSV files
covar_data_1.to_csv(os.path.join(temp_dir, 'test_prefix.type1.csv'))
covar_data_2.to_csv(os.path.join(temp_dir, 'test_prefix.type2.csv'))

# Create row selector (boolean array selecting rows 0, 1, 2)
row_selector = np.array([True, True, True, False, False])

# Create covariate selector (boolean array selecting columns 0, 2)
covariate_selector = np.array([True, False, True, False])

ARGS = {
    'input_dir': temp_dir,
    'input_prefix': 'test_prefix',
    'row_selector': row_selector,
    'covars_to_load': 'type1,type2',
    'min_count': None,
    'covariate_selector': covariate_selector
}
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
load_labels Ran
ran; our contract draft was wrong, not the code
dallascard/scholar/run_scholar.py
code served (permissive licence) · get_code("6fe1b8e2e4cc2a38")
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 numpy as np
import pandas as pd
import tempfile
import shutil

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

# Create a sample CSV file with labels
label_data = pd.DataFrame({
    'label1': [0, 1, 0, 1],
    'label2': [1, 0, 1, 0],
    'label3': [0, 0, 1, 1]
})
label_data.index = ['row0', 'row1', 'row2', 'row3']
label_file_path = os.path.join(test_dir, 'test_prefix.mylabels.csv')
label_data.to_csv(label_file_path)

# Create row selector (boolean array selecting first 3 rows)
row_selector = np.array([True, True, True, False])

# Create options object with labels attribute
class Options:
    def __init__(self):
        self.labels = 'mylabels'

options = Options()

ARGS = {
    'input_dir': test_dir,
    'input_prefix': 'test_prefix',
    'row_selector': row_selector,
    'options': options
}
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
tokenize Ran
ran; our contract draft was wrong, not the code
dallascard/scholar/preprocess_data.py
code served (permissive licence) · get_code("9bbb1555c4d9140d")
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 re
import string
from collections import Counter

# Define ARGS dict with all parameters for tokenize function
ARGS = {
    'text': 'Hello world! This is a test email@example.com with @mentions and numbers 123.',
    'strip_html': False,
    'lower': True,
    'keep_emails': False,
    'keep_at_mentions': False,
    'keep_numbers': False,
    'keep_alphanum': False,
    'min_length': 3,
    'stopwords': {'is', 'a', 'with'},
    'vocab': {'hello', 'world', 'test', 'numbers'}
}
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 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

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, 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 6 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

Most real-world document collections involve various types of metadata, such as author, source, and date, and yet the most commonly-used approaches to modeling text corpora ignore this information. While specialized models have been developed for particular applications, few are widely used in practice, as customization typically requires derivation of a custom inference algorithm. In this paper, we build on recent advances in variational inference methods and propose a general neural framework, based on topic models, to enable flexible incorporation of metadata and allow for rapid exploration of alternative models. Our approach achieves strong performance, with a manageable tradeoff between perplexity, coherence, and sparsity. Finally, we demonstrate the potential of our framework through an exploration of a corpus of articles about US immigration.

For agents

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

get_harvested_code_for_paper("1705.09296")
get_code_for_paper("1705.09296")
have("1705.09296")

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

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

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

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

Connect an agent — have() is free.