SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2024.findings-emnlp.918 · EMNLP Findings · 2024

Targeted Multilingual Adaptation for Low-resource Language Families

Shane Steinert-Threlkeld, Terra Blevins, C Downey, Dhwani Serai, Dwija Parikh

Open in the Atlas

Code that ran

6 of 10 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; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 1 failure of our instrument; 4 no recorded run), measured 2026-11-24; 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/2024.findings-emnlp.918.json · badge: /api/ran/2024.findings-emnlp.918.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
CLMBRs/targeted-xlms canonical (classifier label)
classifier basis: census
6 ran · 4 no recorded run
FunctionStatusWhere it lives
batchify Ran
ran on a synthesized input
CLMBRs/targeted-xlms/src/eval_finetune.py
code served (permissive licence) · get_code("11429523cb4e2aaf")
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 torch

torch.manual_seed(0)

# Analyze the function batchify:
# - data: a list of tuples (input_ids, alignments, labels)
#   - input_ids: tensor with shape[-1] dimension
#   - alignments: some object (not used in function body, just passed through)
#   - labels: iterable of tensors that can be concatenated
# - pad_idx: integer for padding

# Create sample data
# Each item: (input_ids tensor, alignments object, labels list of tensors)
input_ids_1 = torch.LongTensor([1, 2, 3])  # shape (3,)
input_ids_2 = torch.LongTensor([4, 5])      # shape (2,)

alignments_1 = [0, 1, 2]  # arbitrary list, not used in function
alignments_2 = [0, 1]

labels_1 = [torch.LongTensor([10, 11, 12])]  # list of tensors
labels_2 = [torch.LongTensor([13, 14])]

data = [
    (input_ids_1, alignments_1, labels_1),
    (input_ids_2, alignments_2, labels_2),
]

pad_idx = 0

ARGS = {
    'data': data,
    'pad_idx': pad_idx,
}
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 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
evaluate_probe Ran
ran on a synthesized input
CLMBRs/targeted-xlms/src/eval_probe.py
code served (permissive licence) · get_code("56e3daa735e69ceb")
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. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal probe model
class ProbeModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)  # 4 input dims, 3 output classes
    
    def forward(self, input_ids):
        return self.linear(input_ids)

# Create model
model = ProbeModel()

# Create data as list of (input_ids, labels) tuples
# Each input_ids is a tensor of shape (1, 4) for batch dimension flexibility
# Each labels is a tensor of shape (1,) for single label
data = [
    (torch.randn(1, 4), torch.tensor([0])),
    (torch.randn(1, 4), torch.tensor([1])),
    (torch.randn(1, 4), torch.tensor([2])),
    (torch.randn(1, 4), torch.tensor([0])),
]

ARGS = {
    'model': model,
    'data': data,
    'bsz': 2
}
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 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
hex2dec Ran
ran, honoured the contract we drafted
CLMBRs/targeted-xlms/src/reinitialize_embeddings.py
code served (permissive licence) · get_code("74b4020b7c03984e")
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 int, ndim 0, dtype family int, 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 torch

# The function hex2dec takes a hexadecimal string and converts it to decimal
# It only requires one parameter: hex_str, which should be a string

ARGS = {
    "hex_str": "1A"
}
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 int, ndim 0, dtype family int, 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
load_ner_splits Ran
ran on a synthesized input
CLMBRs/targeted-xlms/src/utils.py
code served (permissive licence) · get_code("64345391c9802328")
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 json
import os
import tempfile
import shutil

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

# Create test JSON files for different language/split combinations
test_data_en_train = [
    {"tokens": ["John", "is", "here"], "ner_tags": ["B-PER", "O", "O"]},
    {"tokens": ["Paris", "is", "great"], "ner_tags": ["B-LOC", "O", "O"]}
]

test_data_en_dev = [
    {"tokens": ["Mary", "works"], "ner_tags": ["B-PER", "O"]}
]

test_data_en_test = [
    {"tokens": ["Bob"], "ner_tags": ["B-PER"]}
]

# Write test files
with open(os.path.join(temp_dir, "data_en_train.json"), 'w', encoding='utf-8') as f:
    json.dump(test_data_en_train, f)

with open(os.path.join(temp_dir, "data_en_dev.json"), 'w', encoding='utf-8') as f:
    json.dump(test_data_en_dev, f)

with open(os.path.join(temp_dir, "data_en_test.json"), 'w', encoding='utf-8') as f:
    json.dump(test_data_en_test, f)

ARGS = {
    "data_path": temp_dir,
    "lang": "en",
    "splits": ["train", "dev", "test"]
}
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 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
top_script Ran
ran; our contract draft was wrong, not the code
CLMBRs/targeted-xlms/src/reinitialize_embeddings.py
code served (permissive licence) · get_code("8e6d49aaf98611d9")
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.

from collections import defaultdict

# Create a simple mapping from character ordinals to script names
ord2script = {
    ord('a'): 'latin',
    ord('b'): 'latin',
    ord('c'): 'latin',
    ord('α'): 'greek',
    ord('β'): 'greek',
    ord('中'): 'cjk',
    ord('文'): 'cjk',
}

token = "abcαβ中"

ARGS = {
    'token': token,
    'ord2script': ord2script,
}
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
whitespace_to_sentencepiece Ran
ran on a synthesized input
CLMBRs/targeted-xlms/src/eval_finetune.py
code served (permissive licence) · get_code("e3eba24e4c0f85d1")
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. 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 tqdm import tqdm

torch.manual_seed(0)

class MockTokenizer:
    def __init__(self):
        self.cls_token_id = 101
        self.sep_token_id = 102
        self.eos_token_id = None
    
    def encode(self, text, add_special_tokens=False):
        # Return a small list of token ids based on text length
        return [1000 + i for i in range(len(text.split()))]

# Create a small dataset with sentences and labels
dataset = [
    (["hello", "world"], ["NOUN", "NOUN"]),
    (["the", "cat"], ["DET", "NOUN"]),
]

# Define label space
label_space = ["NOUN", "DET", "VERB", "ADJ"]

# Create tokenizer
tokenizer = MockTokenizer()

ARGS = {
    "tokenizer": tokenizer,
    "dataset": dataset,
    "label_space": label_space,
    "max_seq_length": 512,
    "layer_id": -1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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_ord2script Not yet run
unverified (harvested, no recorded run)
CLMBRs/targeted-xlms/src/reinitialize_embeddings.py
code served (permissive licence) · get_code("e8e4a9db7236b331")
How it ran

no invocation recorded.

load_hf_model Not yet run
unverified (harvested, no recorded run)
CLMBRs/targeted-xlms/src/utils.py
code served (permissive licence) · get_code("811eed6bd2964da0")
How it ran

no invocation recorded.

load_ud_splits Not yet run
unverified (harvested, no recorded run)
CLMBRs/targeted-xlms/src/utils.py
code served (permissive licence) · get_code("e67d4126db367f6d")
How it ran

no invocation recorded.

train_probe Not yet run
unverified (harvested, no recorded run)
CLMBRs/targeted-xlms/src/eval_probe.py
code served (permissive licence) · get_code("2bc11e1614508b49")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 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.

FunctionAlso present inEarliest-datedOthers named
get_ord2script 2 other papers
1 dated earlier, 1 same year, order not determinable
2309.04679 (2023-09)
Embedding structure matters: Comparing methods to adapt multilingual vocabularies to new languages
2408.15793 (2024-08)
Language Adaptation on a Tight Academic Compute Budget: Tokenizer Swapping Works and Pure bfloat16 Is Enough
hex2dec 2 other papers
1 dated earlier, 1 same year, order not determinable
2309.04679 (2023-09)
Embedding structure matters: Comparing methods to adapt multilingual vocabularies to new languages
2408.15793 (2024-08)
Language Adaptation on a Tight Academic Compute Budget: Tokenizer Swapping Works and Pure bfloat16 Is Enough
top_script 2 other papers
1 dated earlier, 1 same year, order not determinable
2309.04679 (2023-09)
Embedding structure matters: Comparing methods to adapt multilingual vocabularies to new languages
2408.15793 (2024-08)
Language Adaptation on a Tight Academic Compute Budget: Tokenizer Swapping Works and Pure bfloat16 Is Enough

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-24.

Repositories linked to this paper

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

Abstract

Massively multilingual models are known to have limited utility in any one language, and to perform particularly poorly on low-resource languages. By contrast, targeted multinguality has been shown to benefit low-resource languages. To test this approach more rigorously, we systematically study best practices for adapting a pre-trained model to a language family. Focusing on the Uralic family as a test case, we adapt XLM-R under various configurations to model 15 languages; we then evaluate the performance of each experimental setting on two downstream tasks and 11 evaluation languages. Our adapted models significantly outperform mono-and multilingual baselines. A regression analysis reveals that adapted vocabulary size is relatively unimportant for low-resource languages, and that low-resource languages can be aggressively up-sampled during training at little detriment to performance in high-resource languages. These results introduce new best practices for performing language adaptation in a targeted setting.

For agents

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

get_harvested_code_for_paper("2024.findings-emnlp.918")
get_code_for_paper("2024.findings-emnlp.918")
have("2024.findings-emnlp.918")

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

curl https://syntology.ai/api/ran/2024.findings-emnlp.918.json

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

[![Syntology run record](https://syntology.ai/api/ran/2024.findings-emnlp.918.svg)](https://syntology.ai/paper/2024.findings-emnlp.918)

Connect an agent — have() is free.