SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.01188 · ICLR · 2024

Quantifying the Plausibility of Context Reliance in Neural Machine Translation

Gabriele Sarti, Grzegorz Chrupała, Malvina Nissim, Arianna Bisazza

arXiv · PDF · Open in the Atlas

Code that ran

10 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 8 failures of our instrument; 3 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/2310.01188.json · badge: /api/ran/2310.01188.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
gsarti/pecore canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
inseq-team/inseq canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
rachtibat/lrp-explains-transformers community
Papers with Code archive
2 ran · 0 no recorded run
FunctionStatusWhere it lives
conf_bounds Ran
ran; our contract draft was wrong, not the code
gsarti/pecore/pecore/analysis_utils.py
code served (permissive licence) · get_code("0ace5674b058777d")
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, 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 numpy as np
from scipy.stats import rankdata, sem, t

# The function conf_bounds takes:
# - data: a list or array-like object of numeric values
# - confidence: a float between 0 and 1 (default 0.95)

# Create sample data - a simple list of numeric values
data = [10.5, 11.2, 9.8, 10.1, 11.5, 10.3, 9.9, 10.7]

# confidence parameter with default value
confidence = 0.95

ARGS = {
    "data": data,
    "confidence": confidence
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
conservation_check_wrap Ran
ran; our contract draft was wrong, not the code
rachtibat/lrp-explains-transformers/lxt/explicit/functional.py
pointer only (licence: NOASSERTION) · get_code("4b04c5d178561f3d")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, rachtibat/lrp-explains-transformers (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.

dot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gsarti/pecore/pecore/analysis_utils.py
code served (permissive licence) · get_code("b91f1cf1920ad068")
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. 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

torch.manual_seed(0)

# The function dot(y, pred) performs np.matmul(pred, y).item()
# This means:
# - pred and y are array-like objects that can be multiplied via np.matmul
# - The result must have a .item() method, so it should be a 0-d array or scalar
# For np.matmul(pred, y) to return a scalar with .item(), both should be 1-D arrays (vectors)
# or pred should be 2-D and y should be 1-D with compatible shapes

# Create a 1-D numpy array for y
y = np.array([1.0, 2.0, 3.0, 4.0])

# Create a 1-D numpy array for pred (same shape so matmul gives scalar)
pred = np.array([0.5, 0.5, 0.5, 0.5])

ARGS = {
    "y": y,
    "pred": pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
encode_examples Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gsarti/pecore/pecore/model_utils.py
code served (permissive licence) · get_code("056c5d571f8a92ac")
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
from typing import Any, Dict, Optional, Tuple, Union

class StandInTokenizer:
    def __init__(self):
        self.model_max_length = 512
    
    def __call__(self, text, truncation=False, padding=None, **kwargs):
        if isinstance(text, str):
            text = [text]
        
        # Simulate tokenization by returning a dict with input_ids and attention_mask
        batch_size = len(text)
        max_length = 10
        
        input_ids = torch.randint(0, 1000, (batch_size, max_length))
        attention_mask = torch.ones((batch_size, max_length), dtype=torch.long)
        
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask
        }

examples = {
    'sentence': ['Hello world', 'This is a test']
}

tokenizer = StandInTokenizer()

ARGS = {
    'examples': examples,
    'tokenizer': tokenizer
}
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 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
get_match_from_contrastive_pair Ran
ran, honoured the contract we drafted
gsarti/pecore/pecore/alignment_utils.py
code served (permissive licence) · get_code("c6fbb96c23b6b25f")
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 re
from typing import Any, List, Optional, Tuple

def get_match_from_contrastive_pair(ref_text: str, contrast_ref_text: str, pred_text: str) -> List[int]:
    """Returns a list of 0s and 1s, where 0 means that the word is not in the MT output and 1 means that it is."""
    ref_tok = re.findall('\\w+\\b', ref_text)
    contrast_ref_tok = re.findall('\\w+\\b', contrast_ref_text)
    if not isinstance(pred_text, str):
        return [0]
    pred_tok = [x.lower() for x in re.findall('\\w+\\b', pred_text)]
    keywords = [ref.lower() for ref, con in zip(ref_tok, contrast_ref_tok) if ref != con]
    out = []
    for kw in keywords:
        if kw not in pred_tok:
            out += [0]
        else:
            out += [1]
            pred_tok.remove(kw)
    return out

ARGS = {
    "ref_text": "The quick brown fox jumps over the lazy dog",
    "contrast_ref_text": "The slow red fox jumps over the active cat",
    "pred_text": "the quick fox jumps over lazy dog"
}
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 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
get_model_id Ran
ran; our contract draft was wrong, not the code
gsarti/pecore/pecore/model_utils.py
code served (permissive licence) · get_code("855db51138564171")
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
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'dataset': 'cifar10',
    'model_type': 'resnet18',
    'context_size': 256,
    'context_word_dropout': 10
}
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
get_model_name Ran
ran; our contract draft was wrong, not the code
gsarti/pecore/pecore/model_utils.py
code served (permissive licence) · get_code("d8eaed17dffaccf9")
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
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "dataset": "wmt14",
    "model_type": "transformer",
    "context_size": 512,
    "context_word_dropout": 10,
    "model_id": None,
    "src_lang": "english",
    "tgt_lang": "german",
}
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
mrr Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gsarti/pecore/pecore/analysis_utils.py
code served (permissive licence) · get_code("4ff702e65ddf0941")
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. 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
from scipy.stats import rankdata

# Create small example data for the mrr function
# y should be a list/array with binary labels (0 or 1)
# pred should be a list/array of prediction scores

y = [0, 1, 0, 1]  # binary labels where 1 indicates a gold/relevant item
pred = [0.2, 0.8, 0.3, 0.9]  # prediction scores

ARGS = {
    "y": y,
    "pred": pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
softmax_fn Ran
ran on a synthesized input · constructed an object; no result was computed
rachtibat/lrp-explains-transformers/lxt/explicit/functional.py
pointer only (licence: NOASSERTION) · get_code("5bacd40145b1bc65")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, rachtibat/lrp-explains-transformers (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.

tokenize_words Ran
ran; our contract draft was wrong, not the code
gsarti/pecore/pecore/alignment_utils.py
code served (permissive licence) · get_code("2815c122de006aab")
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 re
from typing import Any, List, Optional, Tuple

def tokenize_words(text: str, is_tagged: bool=False) -> List[str]:
    """Tokenizes a string of words splitting on word boundaries and spaces, optionally with tags."""
    pattern_nonspace = '(<p>|</p>|<hon>|<hoff>|\\S+)' if is_tagged else '(\\S+)'
    pattern_word = '(<p>|</p>|<hon>|<hoff>|\\w+)' if is_tagged else '(\\w+)'
    return [x for nonspace in re.split(pattern_nonspace, text) for x in re.split(pattern_word, nonspace) if x.strip()]

# Test case 1: Basic text without tags
text_simple = "hello world this is a test"
is_tagged_false = False

# Test case 2: Text with tags
text_tagged = "<p>hello world</p> <hon>important</hon> text <hoff> end"
is_tagged_true = True

ARGS = {
    "text": text_simple,
    "is_tagged": is_tagged_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 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
check_attribute_positions Not yet run
unverified (harvested, no recorded run)
inseq-team/inseq/inseq/attr/feat/attribution_utils.py
code served (permissive licence) · get_code("4dd6c5ffdb165126")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

get_src_ref_sentences Not yet run
unverified (harvested, no recorded run)
gsarti/pecore/pecore/data_utils.py
code served (permissive licence) · get_code("2948f24003a1918c")
How it ran

no invocation recorded.

load_mt_dataset Not yet run
unverified (harvested, no recorded run)
gsarti/pecore/pecore/data_utils.py
code served (permissive licence) · get_code("01efe19adc8853c2")
How it ran

no invocation recorded.

Also present in other papers' code

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

Establishing whether language models can use contextual information in a humanplausible way is important to ensure their trustworthiness in real-world settings. However, the questions of when and which parts of the context affect model generations are typically tackled separately, with current plausibility evaluations being practically limited to a handful of artificial benchmarks. To address this, we introduce Plausibility Evaluation of Context Reliance (PECORE), an end-to-end interpretability framework designed to quantify context usage in language models' generations. Our approach leverages model internals to (i) contrastively identify context-sensitive target tokens in generated texts and (ii) link them to contextual cues justifying their prediction. We use PECORE to quantify the plausibility of context-aware machine translation models, comparing model rationales with human annotations across several discourse-level phenomena. Finally, we apply our method to unannotated model translations to identify context-mediated predictions and highlight instances of (im)plausible context usage throughout generation.

For agents

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

get_harvested_code_for_paper("2310.01188")
get_code_for_paper("2310.01188")
have("2310.01188")

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

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

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

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

Connect an agent — have() is free.