SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.01976 · ACL · 2022

Overlap-based Vocabulary Generation Improves Cross-lingual Transfer Among Related Languages

Sunita Sarawagi, Partha Talukdar, Vaidehi Patil

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 (3 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 2 violated it and 4 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/2203.01976.json · badge: /api/ran/2203.01976.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
Vaidehi99/OBPE community
Papers with Code archive
6 ran · 1 no recorded run
FunctionStatusWhere it lives
BPEMultiTokenizer Ran
ran on a synthesized input · constructed an object; no result was computed
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("cafcf2e2bf72ef8f")
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 an instance of its own class, BPEMultiTokenizer: the run constructed the object and did not call it, so no result was computed. 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 tempfile
import os
from collections import defaultdict
import numpy as np

# Create temporary directories for testing
temp_dir = tempfile.mkdtemp()
input_dir = tempfile.mkdtemp()
output_dir = tempfile.mkdtemp()

# Create minimal input files
input_files = []
for i in range(2):
    filepath = os.path.join(input_dir, f"input_{i}.txt")
    with open(filepath, 'w') as f:
        f.write("hello world this is a test\n" * 5)
    input_files.append(filepath)

# Create minimal vocab files
vocab_files = []
for i in range(2):
    filepath = os.path.join(input_dir, f"vocab_{i}.txt")
    with open(filepath, 'w') as f:
        f.write("h e l o w r d t i s a b\n")
    vocab_files.append(filepath)

ARGS = {
    'input_files': input_files,
    'vocab_files': vocab_files,
    'output_dir': output_dir,
    'vocab_size': 100,
    'n_HRL': 2,
    'overlap': 'product',
    'p': -2,
    'use_vocab': True,
    'eow_suffix': '</w>',
    'cw_prefix': '##',
    'num_workers': 1,
    'alpha': 0.5,
    'tau': 0.001,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, tokenizers, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BPEMultiTokenizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a BPEMultiTokenizer 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
MaxHeap Ran
ran on a synthesized input · constructed an object; no result was computed
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("afcc525dbe642c99")
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 an instance of its own class, MaxHeap: the run constructed the object and did not call it, so no result was computed. 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 heapq

class MaxHeap(object):
    """Max Heap class that supports deletion (heapify doesn't support deletion of a key)"""

    def __init__(self):
        self.heap = []
        heapq.heapify(self.heap)
        self.deleted = {}

    def push(self, x):
        assert -1 * x not in self.deleted or self.deleted[-1 * x]
        heapq.heappush(self.heap, -1 * x)
        self.deleted[-1 * x] = 0

    def max(self):
        if len(self.heap) == 0:
            return -1
        while self.deleted[self.heap[0]]:
            heapq.heappop(self.heap)
        return -1 * self.heap[0]

    def delete(self, x):
        assert -1 * x in self.deleted and (not self.deleted[-1 * x])
        if -1 * x == self.heap[0]:
            heapq.heappop(self.heap)
        self.deleted[-1 * x] = 1


# Create a MaxHeap instance and test it
heap = MaxHeap()

# Push some values
heap.push(5)
heap.push(10)
heap.push(3)

# Get max
max_val = heap.max()

# Delete a value
heap.delete(10)

# Get max again
max_val2 = heap.max()

ARGS = {}
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 MaxHeap — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MaxHeap 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
MultilingualTokenizer Ran
ran on a synthesized input · constructed an object; no result was computed
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("d2a283c11f4d77c5")
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 an instance of its own class, MultilingualTokenizer: the run constructed the object and did not call it, so no result was computed. 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 tempfile
import os
from collections import Counter
from tokenizers.pre_tokenizers import BertPreTokenizer

# Create temporary files and directories for testing
temp_dir = tempfile.mkdtemp()
temp_input_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', dir=temp_dir)
temp_input_file.write("hello world this is a test\n")
temp_input_file.write("another line with some words\n")
temp_input_file.close()

temp_vocab_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.pkl', dir=temp_dir)
temp_vocab_file.close()

# Create a second input file and vocab file for multilingual support
temp_input_file2 = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', dir=temp_dir)
temp_input_file2.write("bonjour monde ceci est un test\n")
temp_input_file2.write("une autre ligne avec des mots\n")
temp_input_file2.close()

temp_vocab_file2 = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.pkl', dir=temp_dir)
temp_vocab_file2.close()

# Create output directory
output_dir = tempfile.mkdtemp()

# Create a pre-tokenizer
pre_tokenizer = BertPreTokenizer()

ARGS = {
    'input_files': [temp_input_file.name, temp_input_file2.name],
    'vocab_files': [temp_vocab_file.name, temp_vocab_file2.name],
    'output_dir': output_dir,
    'vocab_size': 1000,
    'n_HRL': 2,
    'overlap': 'product',
    'p': -2,
    'use_vocab': True,
    'eow_suffix': '</w>',
    'cw_prefix': '##',
    'num_workers': 1,
    'alpha': 0.5,
    'tau': 0.001
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tokenizers, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MultilingualTokenizer — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MultilingualTokenizer 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_vocabulary Ran
ran on a synthesized input
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("8ebaf21ef830e017")
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 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 tempfile
from collections import Counter
from io import StringIO

class MockPreTokenizer:
    """Minimal pre_tokenizer that implements pre_tokenize_str method"""
    def pre_tokenize_str(self, text):
        """Return list of (word, span) tuples"""
        words = text.strip().split()
        spans = []
        pos = 0
        result = []
        for word in words:
            result.append((word, (pos, pos + len(word))))
            pos += len(word) + 1
        return result

# Create a temporary file with some test content
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='utf8')
temp_file.write("hello world\n")
temp_file.write("hello there\n")
temp_file.write("world of python\n")
temp_file.close()

# Create a file object
fobj = open(temp_file.name, 'r', encoding='utf8')

# Create mock pre_tokenizer
pre_tokenizer = MockPreTokenizer()

ARGS = {
    'fobj': fobj,
    'pre_tokenizer': pre_tokenizer,
    'num_workers': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — 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 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
softmin_lin Ran
ran, violated the contract we drafted
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("8ee61df5b2ed5679")
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 float, shape (2, 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

# Construct arguments for softmin_lin
# The function takes three parameters:
# - f1: array-like (used in np.exp, arithmetic operations)
# - f2: array-like (used in np.exp, arithmetic operations)
# - tau: scalar (used in multiplication with arrays)

# Create small numpy arrays with distinct shapes for clarity
f1 = np.array([[1.0, 2.0, 3.0, 4.0],
               [0.5, 1.5, 2.5, 3.5]])

f2 = np.array([[0.1, 0.2, 0.3, 0.4],
               [0.05, 0.15, 0.25, 0.35]])

tau = 0.5

ARGS = {
    "f1": f1,
    "f2": f2,
    "tau": tau
}
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 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
softmin_log Ran
ran, violated the contract we drafted
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("ee213767175a98b3")
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

# Construct arguments for softmin_log function
# The function takes three parameters: f1, f2, and tau
# f1 and f2 are numpy arrays (used in exp and log operations)
# tau is a scalar (float) used as a temperature parameter

f1 = np.array([1.0, 2.0, 3.0, 4.0])
f2 = np.array([0.5, 1.5, 2.5, 3.5])
tau = 0.5

ARGS = {
    "f1": f1,
    "f2": f2,
    "tau": tau
}
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
_get_vocabulary Not yet run
unverified (harvested, no recorded run)
Vaidehi99/OBPE/tokenizer.py
code served (permissive licence) · get_code("c29a31a49b9a683e")
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-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

Pre-trained multilingual language models such as mBERT and XLM-R have demonstrated great potential for zero-shot cross-lingual transfer to low web-resource languages (LRL). However, due to limited model capacity, the large difference in the sizes of available monolingual corpora between high web-resource languages (HRL) and LRLs does not provide enough scope of co-embedding the LRL with the HRL, thereby affecting the downstream task performance of LRLs. In this paper, we argue that relatedness among languages in a language family along the dimension of lexical overlap may be leveraged to overcome some of the corpora limitations of LRLs. We propose Overlap BPE (OBPE), a simple yet effective modification to the BPE vocabulary generation algorithm which enhances overlap across related languages. Through extensive experiments on multiple NLP tasks and datasets, we observe that OBPE generates a vocabulary that increases the representation of LRLs via tokens shared with HRLs. This results in improved zero-shot transfer from related HRLs to LRLs without reducing HRL representation and accuracy. Unlike previous studies that dismissed the importance of token-overlap, we show that in the low-resource related language setting, token overlap matters. Synthetically reducing the overlap to zero can cause as much as a four-fold drop in zero-shot transfer accuracy.

For agents

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

get_harvested_code_for_paper("2203.01976")
get_code_for_paper("2203.01976")
have("2203.01976")

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

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

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

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

Connect an agent — have() is free.