SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1902.10339 · 2019

How Large a Vocabulary Does Text Classification Need? A Variational Approach to Vocabulary Selection

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 3 have no contract verdict; 0 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/1902.10339.json · badge: /api/ran/1902.10339.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
wenhuchen/Variational-Vocabulary-Selection canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
ROC Ran
ran on a synthesized input
wenhuchen/Variational-Vocabulary-Selection/data_utils.py
code served (permissive licence) · get_code("2513d2d212c88f1f")
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 numpy as np
import math
from sklearn import metrics
from scipy.interpolate import interp1d

def enhanced(x, y):
    f2 = interp1d(x, y, kind='slinear')
    new_x = list(np.linspace(min(x), 1000, 200)) + list(np.linspace(1000, max(x), 800))
    new_y = f2(new_x)
    return (new_x, new_y)

def ROC(y, x, maximum_x=None):
    if maximum_x is not None:
        y.append(y[-1])
        x.append(maximum_x)
    new_x, new_y = enhanced(x, y)
    new_x = [math.log10(_) for _ in new_x]
    new_x = [_ / max(new_x) for _ in new_x]
    new_y = [_ / max(new_y) for _ in new_y]
    area = metrics.auc(new_x, new_y)
    return area

# Construct arguments
# y: a list that will be appended to, so must be mutable and contain numeric values
# x: a list that will be appended to, so must be mutable and contain numeric values that will be passed to enhanced()
# maximum_x: optional numeric value

y_vals = [0.1, 0.3, 0.5, 0.7, 0.9]
x_vals = [1.0, 10.0, 100.0, 1000.0, 5000.0]
maximum_x_val = 10000.0

ARGS = {
    "y": y_vals,
    "x": x_vals,
    "maximum_x": maximum_x_val
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn — 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
enhanced Ran
ran on a synthesized input
wenhuchen/Variational-Vocabulary-Selection/data_utils.py
code served (permissive licence) · get_code("74d1f3431662a7cf")
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 2, dtype family float; 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 numpy as np
from scipy.interpolate import interp1d

# The function enhanced(x, y) expects:
# - x: array-like, independent variable for interpolation
# - y: array-like, dependent variable for interpolation
# Both are used with scipy's interp1d and numpy operations

# Create valid x and y arrays
x = np.array([0.0, 100.0, 500.0, 1500.0, 2000.0])
y = np.array([10.0, 20.0, 50.0, 100.0, 120.0])

ARGS = {
    'x': x,
    'y': y
}
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, ndim 2, dtype family float — 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
obtain_interval Ran
ran on a synthesized input
wenhuchen/Variational-Vocabulary-Selection/data_utils.py
code served (permissive licence) · get_code("575ab852ece5d750")
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 math

def obtain_interval(V):
    Maximum = 200
    interval = math.log(V) / Maximum
    splits = []
    for _ in range(1, Maximum + 1):
        val = min(V - 1, math.ceil(math.exp(_ * interval)))
        if val not in splits:
            splits.append(val)
    return splits

# The function takes a single parameter V which is used in math.log(V)
# and arithmetic operations, so it should be a positive number greater than 1
V = 100

ARGS = {
    "V": V
}
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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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

With the rapid development in deep learning, deep neural networks have been widely adopted in many real-life natural language applications. Under deep neural networks, a pre-defined vocabulary is required to vectorize text inputs. The canonical approach to select pre-defined vocabulary is based on the word frequency, where a threshold is selected to cut off the long tail distribution. However, we observed that such simple approach could easily lead to under-sized vocabulary or over-sized vocabulary issues. Therefore, we are interested in understanding how the end-task classification accuracy is related to the vocabulary size and what is the minimum required vocabulary size to achieve a specific performance. In this paper, we provide a more sophisticated variational vocabulary dropout (VVD) based on variational dropout to perform vocabulary selection, which can intelligently select the subset of the vocabulary to achieve the required performance. To evaluate different algorithms on the newly proposed vocabulary selection problem, we propose two new metrics: Area Under Accuracy-Vocab Curve and Vocab Size under X\% Accuracy Drop. Through extensive experiments on various NLP classification tasks, our variational framework is shown to significantly outperform the frequency-based and other selection baselines on these metrics.

For agents

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

get_harvested_code_for_paper("1902.10339")
get_code_for_paper("1902.10339")
have("1902.10339")

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

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

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

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

Connect an agent — have() is free.