SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.14523 · EMNLP · 2020

Exploiting Sentence Order in Document Alignment

Philipp Koehn, Brian Thompson

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 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 5 have no contract verdict; 2 failures of our instrument; 1 no recorded run), measured 2026-11-21; 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/2004.14523.json · badge: /api/ran/2004.14523.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
thompsonb/vecalign canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
facebookresearch/LASER community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
make_doc_embedding Ran
ran on a synthesized input
thompsonb/vecalign/vecalign/dp_utils.py
code served (permissive licence) · get_code("8480418ca87edb70")
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 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 numpy as np

# Set seeds for reproducibility
np.random.seed(0)

# Create small test data
lines = [
    "Hello world",
    "This is a test",
    "Another sentence here",
]

# Create line_embeddings - a numpy array of shape (num_embeddings, embedding_dim)
# We need enough embeddings to cover all possible overlaps of lines
num_overlaps = 2
vecsize = 4

# Generate embeddings for different line combinations
line_embeddings = np.random.randn(20, vecsize).astype(np.float32)
# Normalize them
line_embeddings = line_embeddings / np.linalg.norm(line_embeddings, axis=1, keepdims=True)

# Create sent2line mapping - maps preprocessed line strings to embedding indices
sent2line = {}

# Add single lines
sent2line["Hello world"] = 0
sent2line["This is a test"] = 1
sent2line["Another sentence here"] = 2

# Add overlapped lines (num_overlaps=2)
sent2line["Hello world This is a test"] = 3
sent2line["This is a test Another sentence here"] = 4

# Add padded versions
sent2line["PAD"] = 5

ARGS = {
    "sent2line": sent2line,
    "line_embeddings": line_embeddings,
    "lines": lines,
    "num_overlaps": num_overlaps,
}
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 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
pert_pdf_normalized Ran
ran on a synthesized input
thompsonb/vecalign/vecalign/standalone_document_embedding_demo.py
code served (permissive licence) · get_code("546f4fc8cee2587b")
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 (100,) 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

ARGS = {
    "xx": np.linspace(0, 1, 100),
    "peak": 0.5,
    "g": 20,
    "low": -0.001,
    "high": 1.001
}
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 (100,) — shape (100,) 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
preprocess_line Ran
ran on a synthesized input
thompsonb/vecalign/vecalign/dp_utils.py
code served (permissive licence) · get_code("eb8f2845c132102e")
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

torch.manual_seed(0)

# The function preprocess_line takes a single parameter 'line' which should be a string
# It strips whitespace, and if the result is empty, replaces it with 'BLANK_LINE'
# Otherwise returns the stripped line

ARGS = {
    'line': 'hello world  '
}
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
read_in_embeddings Ran
ran on a synthesized input
thompsonb/vecalign/vecalign/dp_utils.py
code served (permissive licence) · get_code("83237f782dedf200")
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
import numpy as np

# Create temporary files for text and embeddings
temp_dir = tempfile.mkdtemp()
text_file = os.path.join(temp_dir, 'text.txt')
embed_file = os.path.join(temp_dir, 'embeddings.bin')

# Write text file with sample sentences
sentences = [
    "This is the first sentence",
    "This is the second sentence",
    "This is the third sentence",
]

with open(text_file, 'w', encoding='utf-8') as f:
    for sent in sentences:
        f.write(sent + '\n')

# Create embedding file with proper dimensions
# 3 sentences * 1024 dimensions = 3072 float32 values
num_sentences = len(sentences)
embedding_dim = 1024
embeddings = np.random.randn(num_sentences, embedding_dim).astype(np.float32)
embeddings.tofile(embed_file)

ARGS = {
    'text_file': text_file,
    'embed_file': embed_file,
}
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 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
score Ran
ran; our contract draft was wrong, not the code
facebookresearch/LASER/source/mine_bitexts.py
pointer only (licence: NOASSERTION) · get_code("ce7491b4961154f3")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/LASER (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

score_candidates Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
facebookresearch/LASER/source/mine_bitexts.py
pointer only (licence: NOASSERTION) · get_code("d89e697e2a60269c")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, facebookresearch/LASER (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

score_multiple Ran
ran on a synthesized input
thompsonb/vecalign/vecalign/score.py
code served (permissive licence) · get_code("2655212d4b431740")
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 numpy as np

# score_multiple takes gold_list, test_list, and value_for_div_by_0
# gold_list and test_list are lists of alignment pairs
# Each alignment is a list of (source_tuple, target_tuple) pairs
# where source and target can be lists/tuples of indices

# Create sample gold alignments
gold_align_1 = [
    ([0, 1], [2, 3]),
    ([1], [3, 4]),
]

gold_align_2 = [
    ([0], [1]),
    ([2, 3], [4]),
]

gold_list = [gold_align_1, gold_align_2]

# Create sample test alignments with some matches and some mismatches
test_align_1 = [
    ([0, 1], [2, 3]),  # exact match
    ([1], [5]),        # mismatch
]

test_align_2 = [
    ([0], [1]),        # exact match
    ([2], [4, 5]),     # partial match (2 overlaps)
]

test_list = [test_align_1, test_align_2]

ARGS = {
    "gold_list": gold_list,
    "test_list": test_list,
    "value_for_div_by_0": 0.0,
}
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 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
build_doc_embedding Not yet run
unverified (harvested, no recorded run)
thompsonb/vecalign/vecalign/standalone_document_embedding_demo.py
code served (permissive licence) · get_code("8a937937aede187b")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

We present a simple document alignment method that incorporates sentence order information in both candidate generation and candidate re-scoring. Our method results in 61% relative reduction in error compared to the best previously published result on the WMT16 document alignment shared task. Our method improves downstream MT performance on web-scraped Sinhala-English documents from ParaCrawl, outperforming the document alignment method used in the most recent ParaCrawl release. It also outperforms a comparable corpora method which uses the same multilingual embeddings, demonstrating that exploiting sentence order is beneficial even if the end goal is sentence-level bitext.

For agents

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

get_harvested_code_for_paper("2004.14523")
get_code_for_paper("2004.14523")
have("2004.14523")

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

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

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

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

Connect an agent — have() is free.