SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1808.09367 · 2018

Deriving Machine Attention from Human Rationales

arXiv · PDF · Open in the Atlas

Code that ran

8 of 13 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; 1 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 5 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/1808.09367.json · badge: /api/ran/1808.09367.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
YujiaBao/R2A canonical (classifier label)
classifier basis: census
8 ran · 5 no recorded run
FunctionStatusWhere it lives
count_parameters Ran
ran, honoured the contract we drafted
YujiaBao/R2A/rationalization/src/model_utils.py
code served (permissive licence) · get_code("f6b944f50d3f15ae")
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) and returned int, ndim 0, dtype family int, 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 torch.nn as nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
count_parameters Ran
ran on a synthesized input
YujiaBao/R2A/r2a/src/model_utils.py
code served (permissive licence) · get_code("e3d35848a15450ec")
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 int, ndim 0, dtype family int, 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 torch.nn as nn

torch.manual_seed(0)

# Create simple models for the model_dict
class SimpleModel1(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class SimpleModel2(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 2)
    
    def forward(self, x):
        return self.linear(x)

class SimpleModel3(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv1d(4, 8, kernel_size=3)
    
    def forward(self, x):
        return self.conv(x)

# Create model_dict with multiple models
model_dict = {
    'model_1': SimpleModel1(),
    'model_2': SimpleModel2(),
    'model_3': SimpleModel3(),
}

# Ensure all parameters require gradients (default behavior)
for model in model_dict.values():
    for param in model.parameters():
        param.requires_grad = True

ARGS = {
    'model_dict': model_dict
}
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 int, ndim 0, dtype family int, 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
load_data Ran
ran on a synthesized input
YujiaBao/R2A/r2a/src/data_utils.py
code served (permissive licence) · get_code("014184fc7c49101f")
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 TSV file with sample data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'data.tsv')

with open(temp_file, 'w') as f:
    # Write header
    f.write('id\tlabel\ttext\n')
    # Write sample data rows
    f.write('1\t0\thello world this is a test\n')
    f.write('2\t1\tthis is another example sentence\n')
    f.write('3\t0\tshort text\n')
    f.write('4\t1\ta longer piece of text with more words in it\n')

ARGS = {
    'path': temp_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 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_data Ran
ran on a synthesized input
YujiaBao/R2A/rationalization/src/data_utils.py
code served (permissive licence) · get_code("25c65741859bf90b")
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 TSV file with the expected format
temp_dir = tempfile.mkdtemp()
temp_path = os.path.join(temp_dir, "test_data.tsv")

# Write a sample TSV file with header and data lines
with open(temp_path, 'w') as f:
    f.write("id\tlabel\ttext\n")
    f.write("1\t1.5\thello world test\n")
    f.write("2\t2.3\tthis is a sample\n")
    f.write("3\t1.1\tanother example here\n")

ARGS = {
    'path': temp_path,
    'regression': True
}
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 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_rat_pred_gold Ran
ran on a synthesized input
YujiaBao/R2A/r2a/src/data_utils.py
code served (permissive licence) · get_code("088a2348ab2808cf")
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 TSV file with test data
temp_dir = tempfile.mkdtemp()
tsv_path = os.path.join(temp_dir, "test_data.tsv")

# Write test data to TSV file
with open(tsv_path, 'w') as f:
    # Header
    f.write("task\tlabel\ttext\trationale\tpred_att\tgold_att\n")
    
    # Row 1: Classification task with all fields
    f.write("task1\t1\tthis is a test sentence with words\t1 0 1 0 1 0\t0.1 0.2 0.3 0.4 0.5 0.6\t0.15 0.25 0.35 0.45 0.55 0.65\n")
    
    # Row 2: Another classification example
    f.write("task1\t0\tanother example sentence here\t0 1 1 0\t0.2 0.3 0.4 0.5\t0.22 0.32 0.42 0.52\n")
    
    # Row 3: Regression task with label as float
    f.write("task1\t3.5\tregression test text\t1 1 0\t0.6 0.7 0.8\t0.65 0.75 0.85\n")
    
    # Row 4: Different task (should be skipped)
    f.write("task2\t1\tdifferent task text\t1 0\t0.1 0.9\t0.2 0.8\n")
    
    # Row 5: Minimal fields (no rationale, pred_att, gold_att)
    f.write("task1\t0\tminimal example\n")

ARGS = {
    "path": tsv_path,
    "task": "task1",
    "regression": 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
load_rationale Ran
ran on a synthesized input
YujiaBao/R2A/r2a/src/data_utils.py
code served (permissive licence) · get_code("a0c2821175227637")
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 TSV file with sample data
temp_file = tempfile.NamedTemporaryFile(mode='w', suffix='.tsv', delete=False)
temp_path = temp_file.name

# Write header and sample data for classification task
temp_file.write("task\tlabel\ttext\trationale\n")
temp_file.write("task1\t0\tthis is a sample text with words\t0 1 0 1 0 0 1 0\n")
temp_file.write("task1\t1\tanother example sentence for testing\t1 0 1 0 1 0 0 1\n")
temp_file.write("task2\t0\tmore text data goes here now\t0 0 1 1 0 1 0 0\n")
temp_file.write("task2\t1\tfinal sample with more content words\t1 1 0 0 1 0 1 1\n")
temp_file.close()

ARGS = {
    'path': temp_path,
    'regression': False
}
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 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
print_dev_res Ran
ran on a synthesized input
YujiaBao/R2A/r2a/src/train_utils.py
code served (permissive licence) · get_code("3aa84988b3de4f32")
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 numpy as np
from collections import namedtuple

torch.manual_seed(0)

# Create a minimal args object with the required attributes
ArgsConfig = namedtuple('ArgsConfig', ['l_wd', 'l_lm', 'l_r2a', 'l_a2r'])
args = ArgsConfig(
    l_wd=1e-4,
    l_lm=1e-3,
    l_r2a=5e-4,
    l_a2r=5e-4
)

# Create dev_res: a list of result dictionaries
dev_res = [
    {
        'loss_total': 2.5,
        'loss_lbl': 1.2,
        'loss_lbl_r2a': 0.3,
        'loss_wd': 0.1,
        'loss_r2a': 0.4,
        'loss_a2r': 0.3,
        'loss_encoder': 0.2,
        'loss_src_lm': 0.15,
        'loss_tar_lm': 0.2,
        'acc': 0.85,
        'recall': 0.82,
        'f1': 0.83,
        'precision': 0.87
    },
    {
        'loss_total': 2.3,
        'loss_lbl': 1.1,
        'loss_lbl_r2a': 0.28,
        'loss_wd': 0.09,
        'loss_r2a': 0.38,
        'loss_a2r': 0.28,
        'loss_encoder': 0.19,
        'loss_src_lm': 0.14,
        'loss_tar_lm': 0.19,
        'acc': 0.87,
        'recall': 0.84,
        'f1': 0.85,
        'precision': 0.89
    },
    {
        'loss_total': 2.4,
        'loss_lbl': 1.15,
        'loss_lbl_r2a': 0.31,
        'loss_wd': 0.095,
        'loss_r2a': 0.41,
        'loss_a2r': 0.31,
        'loss_encoder': 0.21,
        'loss_src_lm': 0.145,
        'loss_tar_lm': 0.195,
        'acc': 0.86,
        'recall': 0.83,
        'f1': 0.84,
        'precision': 0.88
    }
]

ARGS = {
    'dev_res': dev_res,
    'args': args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, termcolor, torch — 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
read_words Ran
ran on a synthesized input
YujiaBao/R2A/rationalization/src/data_utils.py
code served (permissive licence) · get_code("7b25c7afb1fc01ca")
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)

# The function iterates over data and accesses example['text'] for each example
# It concatenates all text values into a single list
# So data should be a list of dicts, each with a 'text' key containing a list

data = [
    {'text': ['hello', 'world']},
    {'text': ['foo', 'bar', 'baz']},
    {'text': ['test']}
]

ARGS = {
    'data': data
}
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
get_model Not yet run
unverified (harvested, no recorded run)
YujiaBao/R2A/r2a/src/model_utils.py
code served (permissive licence) · get_code("d8a5a64ad2b5aa69")
How it ran

no invocation recorded.

get_model Not yet run
unverified (harvested, no recorded run)
YujiaBao/R2A/rationalization/src/model_utils.py
code served (permissive licence) · get_code("3dccd784966163fa")
How it ran

no invocation recorded.

load_dataset_beer Not yet run
unverified (harvested, no recorded run)
YujiaBao/R2A/rationalization/src/data_utils.py
code served (permissive licence) · get_code("bb97243308acc113")
How it ran

no invocation recorded.

load_saved_model Not yet run
unverified (harvested, no recorded run)
YujiaBao/R2A/r2a/src/model_utils.py
code served (permissive licence) · get_code("fb74d31573765e09")
How it ran

no invocation recorded.

train_batch Not yet run
unverified (harvested, no recorded run)
YujiaBao/R2A/r2a/src/train_utils.py
code served (permissive licence) · get_code("b64ec7d36879ff3b")
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, 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 12 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
count_parameters 180 other papers
2 dated earlier, 178 later · 8 only as an assembly brick
1705.08415 (2017-05)
Supervised Community Detection with Line Graph Neural Networks
1707.01926 (2017-07)
Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting
1810.06682 (2018-10)
Trellis Networks for Sequence Modeling
and 177 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

Attention-based models are successful when trained on large amounts of data. In this paper, we demonstrate that even in the low-resource scenario, attention can be learned effectively. To this end, we start with discrete human-annotated rationales and map them into continuous attention. Our central hypothesis is that this mapping is general across domains, and thus can be transferred from resource-rich domains to low-resource ones. Our model jointly learns a domain-invariant representation and induces the desired mapping between rationales and attention. Our empirical results validate this hypothesis and show that our approach delivers significant gains over state-of-the-art baselines, yielding over 15% average error reduction on benchmark datasets.

For agents

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

get_harvested_code_for_paper("1808.09367")
get_code_for_paper("1808.09367")
have("1808.09367")

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

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

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

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

Connect an agent — have() is free.