SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.15020 · 2023

An Efficient Multilingual Language Model Compression through Vocabulary Trimming

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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; 3 no recorded run), measured 2026-11-23; 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/2305.15020.json · badge: /api/ran/2305.15020.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
asahi417/lm-vocab-trimmer canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
download Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/experiments/result.sentiment_xnli.py
code served (permissive licence) · get_code("6a3affbd85c7c0bb")
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 os
import json
import tempfile
from unittest.mock import Mock, patch

# Create a temporary directory for metric_files
temp_dir = tempfile.mkdtemp()
metric_files_dir = os.path.join(temp_dir, 'metric_files')
os.makedirs(metric_files_dir, exist_ok=True)

# Create a sample JSON file to avoid network requests
sample_data = {"metric": "value", "score": 0.95}
sample_filename = "test_metric.json"
sample_filepath = os.path.join(metric_files_dir, sample_filename)
with open(sample_filepath, 'w') as f:
    json.dump(sample_data, f)

# Mock the requests.get to avoid actual network calls
def mock_get(url):
    mock_response = Mock()
    mock_response.content = json.dumps({"downloaded": True, "data": "test"}).encode('utf-8')
    return mock_response

# Patch requests.get globally
import requests
original_get = requests.get
requests.get = mock_get

# Also patch the metric_files directory to use our temp directory
import builtins
original_open = builtins.open

def patched_open(path, *args, **kwargs):
    if 'metric_files' in str(path):
        path = path.replace('metric_files', metric_files_dir)
    return original_open(path, *args, **kwargs)

builtins.open = patched_open

ARGS = {
    'filename': 'test_metric.json',
    'url': 'https://example.com/metric.json'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
requests — 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
emphasize Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/experiments/result.qa_qg.py
code served (permissive licence) · get_code("e258efb71ebab463")
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 torch
import numpy as np

def emphasize(x, y):
    return f'\textbf{{{x}}}' if x == y else str(x)

# The function compares x and y for equality
# If equal, it formats x as bold LaTeX
# If not equal, it converts x to string
# Both x and y can be simple types (strings, numbers, etc.)

ARGS = {
    'x': 'hello',
    'y': 'hello'
}
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 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_cache_dir Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/vocabtrimmer/util.py
code served (permissive licence) · get_code("6f04b0fee3a05006")
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 os
import tempfile

def get_cache_dir(root_dir):
    _id = 0
    while True:
        path = f'{root_dir}.{_id}'
        if not os.path.exists(path):
            break
        _id += 1
    return path

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()
root_dir = os.path.join(temp_dir, 'cache_test')

ARGS = {
    'root_dir': root_dir
}
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
pretty Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/vocabtrimmer/util.py
code served (permissive licence) · get_code("337714394b87af04")
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 torch

def pretty(num):
    return '{:,}'.format(num)

ARGS = {
    'num': 1000000
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — 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
show_table Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/experiments/result.qa_qg.py
code served (permissive licence) · get_code("118c134ef85e29c4")
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 torch
import numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - show_table takes a 'table' parameter
# - It treats 'table' as a string
# - It concatenates it with header and footer strings
# - It calls .replace() on the result
# So 'table' must be a string

# Create a sample LaTeX table string
table_content = """\\begin{tabular}{|c|c|}
\\hline
Feature & Value \\\\
\\hline
Accuracy & 0.95 \\\\
Loss & NaN \\\\
F1-Score & 0.92 \\\\
\\hline
\\end{tabular}"""

ARGS = {
    'table': table_content
}
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 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
update_fq Ran
ran on a synthesized input
asahi417/lm-vocab-trimmer/vocabtrimmer/vocab_miner.py
code served (permissive licence) · get_code("80a9c43061429b76")
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 defaultdict. 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
from collections import defaultdict

torch.manual_seed(0)

# Construct the arguments
tokens = ['apple', 'banana', 'apple', 'cherry', 'banana', 'apple']
fq = defaultdict(int)

ARGS = {
    'tokens': tokens,
    'fq': fq
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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
download Not yet run
unverified (harvested, no recorded run)
asahi417/lm-vocab-trimmer/experiments/result.qa_qg.py
code served (permissive licence) · get_code("cf86152564d8753e")
How it ran

no invocation recorded.

show_parameter Not yet run
unverified (harvested, no recorded run)
asahi417/lm-vocab-trimmer/vocabtrimmer/base_trimmer.py
code served (permissive licence) · get_code("e607de1f62f6d877")
How it ran

no invocation recorded.

vocab_miner Not yet run
unverified (harvested, no recorded run)
asahi417/lm-vocab-trimmer/vocabtrimmer/vocab_miner.py
code served (permissive licence) · get_code("b3cfed138086ef7e")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Multilingual language model (LM) have become a powerful tool in NLP especially for non-English languages. Nevertheless, model parameters of multilingual LMs remain large due to the larger embedding matrix of the vocabulary covering tokens in different languages. On the contrary, monolingual LMs can be trained in a target language with the language-specific vocabulary only, but this requires a large budget and availability of reliable corpora to achieve a high-quality LM from scratch. In this paper, we propose vocabulary-trimming (VT), a method to reduce a multilingual LM vocabulary to a target language by deleting irrelevant tokens from its vocabulary. In theory, VT can compress any existing multilingual LM to build monolingual LMs in any language covered by the multilingual LM. In our experiments, we show that VT can retain the original performance of the multilingual LM, while being smaller in size (in general around 50% of the original vocabulary size is enough) than the original multilingual LM. The evaluation is performed over four NLP tasks (two generative and two classification tasks) among four widely used multilingual LMs in seven languages. Finally, we show that this methodology can keep the best of both monolingual and multilingual worlds by keeping a small size as monolingual models without the need for specifically retraining them, and even limiting potentially harmful social biases.

For agents

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

get_harvested_code_for_paper("2305.15020")
get_code_for_paper("2305.15020")
have("2305.15020")

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

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

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

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

Connect an agent — have() is free.