SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.02790 · 2023

Exploring the Relationship between Alignment and Cross-lingual Transfer in Multilingual Transformers

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 (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; 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/2306.02790.json · badge: /api/ran/2306.02790.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
posos-tech/multilingual-alignment-and-transfer canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
FunctionStatusWhere it lives
bitfit Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/models/partial_freezes.py
code served (permissive licence) · get_code("ca2784cbd62536cf")
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 MinimalBertModel. 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 torch.nn as nn
from transformers.models.bert.modeling_bert import BertPreTrainedModel, BertConfig, BertModel

torch.manual_seed(0)

# Create a minimal BertPreTrainedModel subclass for testing
class MinimalBertModel(BertPreTrainedModel):
    def __init__(self, config):
        super().__init__(config)
        self.bert = BertModel(config)
        self.post_init()
    
    def forward(self, input_ids, attention_mask=None):
        outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
        return outputs

# Create a minimal config
config = BertConfig(
    vocab_size=100,
    hidden_size=4,
    num_hidden_layers=2,
    num_attention_heads=1,
    intermediate_size=8,
    max_position_embeddings=16
)

# Instantiate the model
model = MinimalBertModel(config)

# Define ARGS dictionary
ARGS = {
    "model": model,
    "encoder_getter": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MinimalBertModel — a MinimalBertModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MinimalBertModel 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
load_biomedical_wmt19 Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/data.py
code served (permissive licence) · get_code("f08dba90e421e304")
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 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 os
import tempfile
import shutil
from collections import defaultdict

# Create temporary directory structure with minimal valid data files
temp_dir = tempfile.mkdtemp()
test_sets_dir = os.path.join(temp_dir, 'test_sets', 'Medline')
gold_standard_dir = os.path.join(test_sets_dir, 'gold_standard')
os.makedirs(gold_standard_dir, exist_ok=True)

# Create mapdocs file
mapdocs_file = os.path.join(gold_standard_dir, 'mapdocs_de_en.txt')
with open(mapdocs_file, 'w') as f:
    f.write("pid1\tdoc1\n")
    f.write("pid2\tdoc2\n")

# Create lang_lang2en file (de2en German sentences)
lang_lang2en_file = os.path.join(test_sets_dir, 'medline_de2en_de.txt')
with open(lang_lang2en_file, 'w') as f:
    f.write("doc1\t0\tDas ist ein guter Satz\n")
    f.write("doc1\t1\tDas ist noch besser\n")
    f.write("doc2\t0\tEin sehr kurzer\n")  # Will be filtered out (<=2 words)
    f.write("doc2\t1\tDas ist ein weiterer guter deutscher Satz\n")

# Create en_lang2en file (de2en English sentences)
en_lang2en_file = os.path.join(gold_standard_dir, 'medline_de2en_en.txt')
with open(en_lang2en_file, 'w') as f:
    f.write("doc1\t0\tThis is a good sentence\n")
    f.write("doc1\t1\tThis is even better\n")
    f.write("doc2\t0\tA very short\n")
    f.write("doc2\t1\tThis is another good English sentence\n")

# Create lang_en2lang file (en2de German sentences)
lang_en2lang_file = os.path.join(gold_standard_dir, 'medline_en2de_de.txt')
with open(lang_en2lang_file, 'w') as f:
    f.write("doc1\t2\tWas ist das\n")
    f.write("doc1\t3\tWirklich toll\n")

# Create en_en2lang file (en2de English sentences)
en_en2lang_file = os.path.join(test_sets_dir, 'medline_en2de_en.txt')
with open(en_en2lang_file, 'w') as f:
    f.write("doc1\t2\tWhat is this\n")
    f.write("doc1\t3\tReally great\n")

# Create alignment file
align_file = os.path.join(gold_standard_dir, 'align_validation_de_en.txt')
with open(align_file, 'w') as f:
    f.write("pid1\t0 <=> 0\tOK\n")
    f.write("pid1\t1 <=> 1\tOK\n")
    f.write("pid2\t0 <=> 0\tOK\n")
    f.write("pid2\t1 <=> 1\tOK\n")
    f.write("pid1\t2 <=> 2\tOK\n")
    f.write("pid1\t3 <=> 3\tOK\n")
    f.write("pid1\t99 <=> 99\tFAIL\n")  # Will be filtered (status != OK)

ARGS = {
    'data_dir': temp_dir,
    'lang': 'de',
    'shuffle': True
}
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 float — 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
load_europarl Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/data.py
code served (permissive licence) · get_code("2a6b57ba2d3b09cf")
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 map. 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 random
import tempfile
import shutil

# Create a temporary directory with mock Europarl files
temp_dir = tempfile.mkdtemp()

# Create mock Europarl data files
lang = 'de'
lang_file_path = os.path.join(temp_dir, f'europarl-v7.{lang}-en.{lang}')
en_file_path = os.path.join(temp_dir, f'europarl-v7.{lang}-en.en')

# Write some sample parallel sentences
with open(lang_file_path, 'w') as f:
    f.write("Guten Tag, wie geht es Ihnen?\n")
    f.write("Das ist ein Test.\n")
    f.write("Ich spreche Deutsch.\n")

with open(en_file_path, 'w') as f:
    f.write("Good day, how are you?\n")
    f.write("This is a test.\n")
    f.write("I speak German.\n")

ARGS = {
    'data_dir': temp_dir,
    'lang': 'de',
    'seed': 42,
    'shuffle': True
}
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 map — a map output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a map 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
load_from_fastalign_input Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/data.py
code served (permissive licence) · get_code("e9a42840640e9263")
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 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
import os

# Create a temporary file with fastalign format data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("Das ist ein Test ||| This is a test\n")
temp_file.write("Guten Morgen ||| Good morning\n")
temp_file.close()

ARGS = {
    'fname': temp_file.name,
    'left_lang': 'de',
    'right_lang': 'en',
    'shuffle': True
}
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 float — 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
remove_batch_dimension Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/models/utils.py
code served (permissive licence) · get_code("6b9c69ee7a3fcfae")
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 Tensor, ndim 2, dtype family float, shape (5, 3) 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

torch.manual_seed(0)

# Create a batch of sequences with different lengths
# Batch size: 2, max sequence length: 4, feature dimension: 3
input_tensor = torch.randn(2, 4, 3)

# Lengths for each sequence in the batch
lengths_tensor = torch.tensor([2, 3], dtype=torch.long)

ARGS = {
    "input": input_tensor,
    "lengths": lengths_tensor,
}
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 Tensor, ndim 2, dtype family float, shape (5, 3) — shape (5, 3) 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
sum_ranges_and_put_together Ran
ran on a synthesized input
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/models/utils.py
code served (permissive licence) · get_code("49acb57287ba20d1")
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 Tensor, ndim 3, dtype family float, shape (2, 3, 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 torch

torch.manual_seed(0)

# Small tensor dimensions: batch_size=2, length=5, dim=4
batch_size = 2
length = 5
dim = 4
num_ranges = 3

# reprs: (batch_size, length, dim) - transformer output
reprs = torch.randn(batch_size, length, dim)

# positions: (batch_size, num_ranges, 2) - start and end indices for ranges
# Each range is [start, end) where end is exclusive
positions = torch.tensor([
    [[0, 2], [2, 4], [4, 5]],  # batch 0: ranges [0:2], [2:4], [4:5]
    [[0, 1], [1, 3], [3, 5]]   # batch 1: ranges [0:1], [1:3], [3:5]
], dtype=torch.long)

# ids: (batch_size, num_ranges) - optional subset selection
# These are indices into the positions array
ids = torch.tensor([
    [0, 1, 2],
    [2, 1, 0]
], dtype=torch.long)

ARGS = {
    "reprs": reprs,
    "positions": positions,
    "ids": ids
}
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 Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
post_on_slack Not yet run
unverified (harvested, no recorded run)
posos-tech/multilingual-alignment-and-transfer/multilingual_eval/loggers.py
code served (permissive licence) · get_code("1212dede4f4a90d2")
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

Without any explicit cross-lingual training data, multilingual language models can achieve cross-lingual transfer. One common way to improve this transfer is to perform realignment steps before fine-tuning, i.e., to train the model to build similar representations for pairs of words from translated sentences. But such realignment methods were found to not always improve results across languages and tasks, which raises the question of whether aligned representations are truly beneficial for cross-lingual transfer. We provide evidence that alignment is actually significantly correlated with cross-lingual transfer across languages, models and random seeds. We show that fine-tuning can have a significant impact on alignment, depending mainly on the downstream task and the model. Finally, we show that realignment can, in some instances, improve cross-lingual transfer, and we identify conditions in which realignment methods provide significant improvements. Namely, we find that realignment works better on tasks for which alignment is correlated with cross-lingual transfer when generalizing to a distant language and with smaller models, as well as when using a bilingual dictionary rather than FastAlign to extract realignment pairs. For example, for POS-tagging, between English and Arabic, realignment can bring a +15.8 accuracy improvement on distilmBERT, even outperforming XLM-R Large by 1.7. We thus advocate for further research on realignment methods for smaller multilingual models as an alternative to scaling.

For agents

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

get_harvested_code_for_paper("2306.02790")
get_code_for_paper("2306.02790")
have("2306.02790")

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

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

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

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

Connect an agent — have() is free.