SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2011.02690 · EMNLP · 2020

Entity Linking in 100 Languages

Zifei Shan, Jan Botha, Daniel Gillick

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 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, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 3 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/2011.02690.json · badge: /api/ran/2011.02690.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
hazyresearch/tabi community
Papers with Code archive
6 ran · 3 no recorded run
FunctionStatusWhere it lives
Aggregator Ran
ran on a synthesized input · constructed an object; no result was computed
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("e911f82624c5244f")
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, Aggregator: 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 torch
import torch.nn as nn

torch.manual_seed(0)

# The forward method expects last_hidden_state to be a tensor
# where it accesses [:, 0] to get embeddings from the first token
# Shape should be (batch_size, sequence_length, hidden_dim)
last_hidden_state = torch.randn(2, 3, 4)

ARGS = {
    'normalize': 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 Aggregator — 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 Aggregator 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
GatherLayer Ran
ran on a synthesized input · constructed an object; no result was computed
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("d4f502dc0e8d10f0")
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, GatherLayer: 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 torch
import torch.distributed as dist
from unittest.mock import MagicMock, patch

torch.manual_seed(0)

# Mock distributed training environment
# We need to mock dist functions since we're not in a real distributed setting
mock_world_size = 2
mock_rank = 0

def mock_get_world_size():
    return mock_world_size

def mock_get_rank():
    return mock_rank

def mock_all_gather(output_list, input_tensor):
    # Simulate gathering: fill output list with copies of input
    for i in range(len(output_list)):
        output_list[i].copy_(input_tensor)

# Patch the distributed functions
with patch.object(dist, 'get_world_size', mock_get_world_size):
    with patch.object(dist, 'get_rank', mock_get_rank):
        with patch.object(dist, 'all_gather', mock_all_gather):
            # Create test input tensor
            input_tensor = torch.randn(2, 4, requires_grad=True)
            
            # ARGS dict - GatherLayer.forward only takes 'input' as a parameter
            # (ctx is implicit in the Function framework)
            ARGS = {
                'input': input_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 GatherLayer — 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 GatherLayer 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
SupConLoss Ran
ran on a synthesized input
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("808229e9aa41a103")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 0, 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
import torch.nn as nn

class SupConLoss(nn.Module):
    """
    Supervised Contrastive Learning: https://arxiv.org/pdf/2004.11362.pdf.

    Modified from https://github.com/HobbitLong/SupContrast.
    """

    def __init__(self, temperature=0.01):
        super(SupConLoss, self).__init__()
        self.temperature = temperature

    def forward(self, embs, same_label_mask, no_label_mask):
        """Compute supervised contrastive loss (variant).

        Args:
            embs: (num_examples, hidden_dim)
            same_label_mask: (num_examples, num_examples)
            no_label_mask: (num_examples)

        Returns:
            A loss scalar
        """
        sim = embs @ embs.T / self.temperature
        sim_max, _ = torch.max(sim, dim=1, keepdim=True)
        sim = sim - sim_max.detach()
        negs = torch.exp(sim) * ~same_label_mask
        denominator = negs.sum(axis=1, keepdim=True) + torch.exp(sim)
        log_prob = sim - torch.log(denominator)
        pos_pairs_mask = same_label_mask.fill_diagonal_(0)
        include_in_loss = (pos_pairs_mask.sum(1) != 0) & (~no_label_mask).flatten()
        mean_log_prob_pos = (pos_pairs_mask * log_prob).sum(1) / (pos_pairs_mask.sum(1) + (~include_in_loss).float())
        mean_log_prob_pos = mean_log_prob_pos[include_in_loss]
        if mean_log_prob_pos.shape[0] == 0:
            return torch.tensor(0)
        loss = -1 * self.temperature * mean_log_prob_pos
        return loss.mean()


INIT_ARGS = {
    'temperature': 0.07
}

ARGS = {
    'embs': torch.randn(4, 8),
    'same_label_mask': torch.tensor([
        [True, True, False, False],
        [True, True, False, False],
        [False, False, True, True],
        [False, False, True, True]
    ]),
    'no_label_mask': torch.tensor([False, False, False, False])
}

if __name__ == '__main__':
    model = SupConLoss(**INIT_ARGS)
    loss = model(**ARGS)
    print(f"Loss: {loss}")
    print(f"Loss shape: {loss.shape}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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 0, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
TABiLoss Ran
ran on a synthesized input · constructed an object; no result was computed
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("fe93e92642b8e3da")
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, TABiLoss: 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Set up the helper function that TABiLoss uses
def get_type_label_mask(labels, type_equivalence='strict'):
    """Generate the mask indicating which queries have the same type."""
    if type_equivalence == 'weak':
        shared_labels = torch.matmul(labels.float(), labels.float().T)
        num_types_per_el = labels.sum(1)
        max_types = torch.cartesian_prod(num_types_per_el, num_types_per_el).max(1)[0].reshape(num_types_per_el.shape[0], -1)
        same_label_mask = (shared_labels > max_types * 0.5).float()
    else:
        shared_labels = torch.matmul(labels.float(), labels.float().T)
        labels_cols = labels.sum(1).repeat(len(labels), 1)
        labels_rows = labels.sum(1).unsqueeze(1).repeat(1, len(labels))
        same_label_mask = (torch.eq(shared_labels, labels_rows) & torch.eq(shared_labels, labels_cols)).float()
    return same_label_mask

# Set up SupConLoss class
class SupConLoss(nn.Module):
    """Supervised Contrastive Learning loss."""

    def __init__(self, temperature=0.01):
        super(SupConLoss, self).__init__()
        self.temperature = temperature

    def forward(self, embs, same_label_mask, no_label_mask):
        """Compute supervised contrastive loss (variant).

        Args:
            embs: (num_examples, hidden_dim)
            same_label_mask: (num_examples, num_examples)
            no_label_mask: (num_examples)

        Returns:
            A loss scalar
        """
        sim = embs @ embs.T / self.temperature
        sim_max, _ = torch.max(sim, dim=1, keepdim=True)
        sim = sim - sim_max.detach()
        negs = torch.exp(sim) * ~same_label_mask
        denominator = negs.sum(axis=1, keepdim=True) + torch.exp(sim)
        log_prob = sim - torch.log(denominator)
        pos_pairs_mask = same_label_mask.fill_diagonal_(0)
        include_in_loss = (pos_pairs_mask.sum(1) != 0) & (~no_label_mask).flatten()
        mean_log_prob_pos = (pos_pairs_mask * log_prob).sum(1) / (pos_pairs_mask.sum(1) + (~include_in_loss).float())
        mean_log_prob_pos = mean_log_prob_pos[include_in_loss]
        if mean_log_prob_pos.shape[0] == 0:
            return torch.tensor(0)
        loss = -1 * self.temperature * mean_log_prob_pos
        return loss.mean()

# Create train_utils namespace with required functions
import types as _types
train_utils = _types.SimpleNamespace(get_type_label_mask=get_type_label_mask)

# Build minimal tensors for the function
num_queries = 2
num_entities = 3
hidden_dim = 4
num_types = 2

query_embs = torch.randn(num_queries, hidden_dim)
entity_embs = torch.randn(num_entities, hidden_dim)
query_type_labels = torch.tensor([[1, 0], [0, 1]], dtype=torch.long)
query_entity_labels = torch.tensor([0, 1], dtype=torch.long)
entity_labels = torch.tensor([0, 1, 2], dtype=torch.long)

ARGS = {
    'temperature': 0.01,
    'alpha': 0.5,
    'type_equivalence': 'strict'
}
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 TABiLoss — 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 TABiLoss 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
first_nonzero Ran
ran; our contract draft was wrong, not the code
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("8add33ab60f64d81")
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 max. 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)

# Create a small tensor with some positive and zero values
# Shape: (4, 3) - small tensor with distinct dimensions
x = torch.tensor([
    [0.0, 1.5, 0.0],
    [0.0, 0.0, 2.1],
    [3.2, 0.0, 0.0],
    [0.0, 0.0, 0.0]
], dtype=torch.float32)

axis = 0

ARGS = {
    "x": x,
    "axis": axis
}
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 max — a max output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a max output the recorded ndim 2 and dtype family int 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_type_label_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("e8c58dab859a4046")
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, 2) 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)

# labels: (num_queries, num_types) - a 2D binary tensor indicating which types each query has
# Shape: (2 queries, 4 types)
labels = torch.tensor([
    [1, 0, 1, 0],
    [1, 0, 1, 0]
], dtype=torch.long)

ARGS = {
    'labels': labels,
    'type_equivalence': 'strict'
}
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, 2) — shape (2, 2) 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
Biencoder Not yet run
unverified (harvested, no recorded run)
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("8703f0123e49be68")
How it ran

no invocation recorded.

Encoder Not yet run
unverified (harvested, no recorded run)
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("e5ef02894e3ada8e")
How it ran

no invocation recorded.

gather_embs Not yet run
unverified (harvested, no recorded run)
hazyresearch/tabi/tabi/models/biencoder.py
code served (permissive licence) · get_code("a05d380c6227a2e0")
How it ran

no invocation recorded.

Also present in other papers' code

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

FunctionAlso present inEarliest-datedOthers named
GatherLayer
brick of this paper's assembly: helper
4 other papers
1 dated earlier, 3 later · 1 only as an assembly brick
2006.12681 (2020-06)
ContraGAN: Contrastive Learning for Conditional Image Generation
2103.09742 (2021-03)
Training GANs with Stronger Augmentations via Contrastive Discriminator
2111.01118 (2021-11)
Rebooting ACGAN: Auxiliary Classifier GANs with Stable Training
and 1 more not named here

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 propose a new formulation for multilingual entity linking, where language-specific mentions resolve to a language-agnostic Knowledge Base. We train a dual encoder in this new setting, building on prior work with improved feature representation, negative mining, and an auxiliary entity-pairing task, to obtain a single entity retrieval model that covers 100+ languages and 20 million entities. The model outperforms state-of-the-art results from a far more limited cross-lingual linking task. Rare entities and low-resource languages pose challenges at this large-scale, so we advocate for an increased focus on zero-and few-shot evaluation. To this end, we provide Mewsli-9, a large new multilingual dataset 1 matched to our setting, and show how frequency-based analysis provided key insights for our model and training enhancements.

For agents

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

get_harvested_code_for_paper("2011.02690")
get_code_for_paper("2011.02690")
have("2011.02690")

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

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

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

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

Connect an agent — have() is free.