SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.04116 · ACL · 2023

Unbalanced Optimal Transport for Unbalanced Word Alignment

Sho Yokoi, Han Bao, Yuki Arase

arXiv · PDF · Open in the Atlas

Code that ran

9 of 14 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 9 have no contract verdict; 0 failures of our instrument; 5 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/2306.04116.json · badge: /api/ran/2306.04116.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
yukiar/OTAlign canonical (classifier label)
classifier basis: census
9 ran · 5 no recorded run
FunctionStatusWhere it lives
BERTScore_Alignment Ran
ran on a synthesized input
yukiar/OTAlign/src/baseline.py
code served (permissive licence) · get_code("a24d62116715875f")
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 set. 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.functional as F

torch.manual_seed(0)

# The function uses:
# - vecX: a 2D tensor that gets normalized and used in matmul with vecY.t()
# - vecY: a 2D tensor that gets normalized and transposed for matmul
# - merge_type: a string that determines the merge strategy

# Create small tensors with distinct dimensions
# vecX: shape (4, 3) - 4 items, 3-dimensional embeddings
# vecY: shape (5, 3) - 5 items, 3-dimensional embeddings
vecX = torch.randn(4, 3)
vecY = torch.randn(5, 3)

# merge_type: one of the supported strategies
merge_type = 'intersect'

ARGS = {
    'vecX': vecX,
    'vecY': vecY,
    'merge_type': merge_type,
}
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 set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
alignment_collate Ran
ran on a synthesized input
yukiar/OTAlign/src/util.py
code served (permissive licence) · get_code("66c04783570df92e")
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, 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 torch
import numpy as np
from collections import namedtuple

torch.manual_seed(0)

# Test case 1: batch of tensors
batch_tensors = [
    torch.randn(2, 4),
    torch.randn(2, 4),
]

# Test case 2: batch of numpy arrays
batch_numpy = [
    np.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]),
    np.array([[9.0, 10.0, 11.0, 12.0], [13.0, 14.0, 15.0, 16.0]]),
]

# Test case 3: batch of floats
batch_floats = [1.5, 2.5]

# Test case 4: batch of ints
batch_ints = [1, 2]

# Test case 5: batch of strings
batch_strings = ["hello", "world"]

# Test case 6: batch of dicts with tensors
batch_dicts = [
    {"a": torch.randn(2, 4), "b": torch.randn(3, 5)},
    {"a": torch.randn(2, 4), "b": torch.randn(3, 5)},
]

# Test case 7: batch of namedtuples
Point = namedtuple('Point', ['x', 'y'])
batch_namedtuples = [
    Point(torch.randn(2, 4), torch.randn(3, 5)),
    Point(torch.randn(2, 4), torch.randn(3, 5)),
]

# Test case 8: batch of lists
batch_lists = [
    [torch.randn(2, 4), torch.randn(3, 5)],
    [torch.randn(2, 4), torch.randn(3, 5)],
]

# Primary test case: batch of tensors
ARGS = {
    "batch": batch_tensors
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, yaml — 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, 2, 4) — shape (2, 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
apply_distortion Ran
ran on a synthesized input
yukiar/OTAlign/src/model_parts.py
code served (permissive licence) · get_code("634f8a5bd7f32333")
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 (2, 3) 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

torch.manual_seed(0)

# Create a small similarity matrix (2x3 shape for distinctness)
sim_matrix = torch.randn(2, 3)

# Create a ratio parameter
ratio = 0.5

ARGS = {
    "sim_matrix": sim_matrix,
    "ratio": ratio
}
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 (2, 3) — shape (2, 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
entropic_partial_wasserstein Ran
ran on a synthesized input
yukiar/OTAlign/src/my_pot.py
code served (permissive licence) · get_code("87ca66890dc85cc7")
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. 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 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 small tensors for the function parameters
# a: distribution over source (dim_a elements)
# b: distribution over target (dim_b elements)
# M: cost matrix (dim_a x dim_b)
# reg: regularization parameter
# m: partial mass parameter (optional)

dim_a = 4
dim_b = 3

# Create valid probability distributions
a = torch.ones(dim_a, dtype=torch.float64) / dim_a
b = torch.ones(dim_b, dtype=torch.float64) / dim_b

# Create a cost matrix
M = torch.randn(dim_a, dim_b, dtype=torch.float64)

# Regularization parameter (must be positive)
reg = 0.1

# Partial mass parameter
m = torch.tensor(0.5, dtype=torch.float64)

ARGS = {
    'a': a,
    'b': b,
    'M': M,
    'reg': reg,
    'm': m,
    'numItermax': 100,
    'stopThr': 1e-9,
    'verbose': False,
    'log': True,
}
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
load_annotation Ran
ran on a synthesized input
yukiar/OTAlign/src/preprocess/edinburgh.py
code served (permissive licence) · get_code("71d53f8be599aefb")
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 torch

torch.manual_seed(0)

annotation = {
    'S': [
        (0, [0, 1]),
        (1, [2]),
    ],
    'P': [
        (0, [2]),
        (2, [0, 1]),
    ]
}

sure_and_possible = True

sent1 = "hello world foo"

sent2 = "bonjour monde baz qux"

ARGS = {
    'annotation': annotation,
    'sure_and_possible': sure_and_possible,
    'sent1': sent1,
    'sent2': sent2,
}
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 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
read_Word_Alignment_Dataset Ran
ran on a synthesized input
yukiar/OTAlign/src/util.py
code served (permissive licence) · get_code("6988d5e2da254801")
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 tempfile
import os

# Create a temporary file with test data in the expected format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("1\tthe cat sat\tX\ton the mat\tY\tZ\tW\t0-0 1-1 2-2\t0-0 1-1 2-2 1-3\n")
temp_file.write("2\ta dog runs\tX\tun chien court\tY\tZ\tW\t0-0 1-1 2-2\t0-0 1-1 2-2\n")
temp_file.close()

ARGS = {
    'filename': temp_file.name,
    'sure_and_possible': False,
    'transpose': False
}
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 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
select_from_list Ran
ran on a synthesized input
yukiar/OTAlign/src/preprocess/edinburgh.py
code served (permissive licence) · get_code("d51893d58237db4c")
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 torch

torch.manual_seed(0)

# input_list: a list that can be indexed by integers
# indices: a list of integers used to index into input_list

input_list = [10, 20, 30, 40, 50]
indices = [0, 2, 4, 1]

ARGS = {
    "input_list": input_list,
    "indices": indices,
}
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 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
send_batch_to_gpu Ran
ran on a synthesized input
yukiar/OTAlign/src/util.py
code served (permissive licence) · get_code("3cd9511aa0c35e35")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Test case 1: Simple tensor
elem_tensor = torch.randn(2, 4)
device_cpu = torch.device('cpu')

# Test case 2: Dictionary with tensors
elem_dict = {
    'input': torch.randn(2, 3),
    'target': torch.randn(2, 5),
    'nested': {
        'hidden': torch.randn(2, 4)
    }
}

# Test case 3: List of tensors
elem_list = [torch.randn(2, 4), torch.randn(2, 3), torch.randn(2, 5)]

# Test case 4: Mixed nested structure
elem_mixed = {
    'tensors': [torch.randn(2, 4), torch.randn(2, 3)],
    'scalar': 42,
    'nested': {
        'tensor': torch.randn(2, 2),
        'string': 'test'
    }
}

# Define ARGS for the function execution
ARGS = {
    'elem': elem_mixed,
    'device': device_cpu
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, yaml — 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
sinkhorn_knopp_unbalanced Ran
ran on a synthesized input
yukiar/OTAlign/src/my_pot.py
code served (permissive licence) · get_code("7dc737c4d7d6bb93")
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 (4, 3) 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

torch.manual_seed(0)

# Small cost matrix (4x3)
M = torch.randn(4, 3, dtype=torch.float32)

# Marginal distributions for rows (dim_a=4) and columns (dim_b=3)
a = torch.ones(4, dtype=torch.float32) / 4
b = torch.ones(3, dtype=torch.float32) / 3

# Regularization parameters
reg = 0.1
reg_m_1 = 0.5
reg_m_2 = 0.5

# Optional parameters
numItermax = 100
stopThr = 1e-6
verbose = False
log = False

ARGS = {
    'a': a,
    'b': b,
    'M': M,
    'reg': reg,
    'reg_m_1': reg_m_1,
    'reg_m_2': reg_m_2,
    'numItermax': numItermax,
    'stopThr': stopThr,
    'verbose': verbose,
    'log': log,
}
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 (4, 3) — shape (4, 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
eval_null_alignments Not yet run
unverified (harvested, no recorded run)
yukiar/OTAlign/src/unsupervised_alignment.py
code served (permissive licence) · get_code("68c9ecf45685f549")
How it ran

no invocation recorded.

evaluate Not yet run
unverified (harvested, no recorded run)
yukiar/OTAlign/src/unsupervised_alignment.py
code served (permissive licence) · get_code("75743674e5649573")
How it ran

no invocation recorded.

evaluate_total_score Not yet run
unverified (harvested, no recorded run)
yukiar/OTAlign/src/unsupervised_alignment.py
code served (permissive licence) · get_code("df7c9ece1e6d1859")
How it ran

no invocation recorded.

load_Edinburgh_corpus Not yet run
unverified (harvested, no recorded run)
yukiar/OTAlign/src/preprocess/edinburgh.py
code served (permissive licence) · get_code("1d47d9d817fa012b")
How it ran

no invocation recorded.

load_MSR_RTE_corpus Not yet run
unverified (harvested, no recorded run)
yukiar/OTAlign/src/preprocess/msr_rte.py
code served (permissive licence) · get_code("d724980d92a0a2fa")
How it ran

no invocation recorded.

Also present in other papers' code

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

Monolingual word alignment is crucial to model semantic interactions between sentences. In particular, null alignment, a phenomenon in which words have no corresponding counterparts, is pervasive and critical in handling semantically divergent sentences. Identification of null alignment is useful on its own to reason about the semantic similarity of sentences by indicating there exists information inequality. To achieve unbalanced word alignment that values both alignment and null alignment, this study shows that the family of optimal transport (OT), i.e., balanced, partial, and unbalanced OT, are natural and powerful approaches even without tailor-made techniques. Our extensive experiments covering unsupervised and supervised settings indicate that our generic OT-based alignment methods are competitive against the state-of-the-arts specially designed for word alignment, remarkably on challenging datasets with high null alignment frequencies.

For agents

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

get_harvested_code_for_paper("2306.04116")
get_code_for_paper("2306.04116")
have("2306.04116")

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

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

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

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

Connect an agent — have() is free.