SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1910.12853 · 2019

A Game Theoretic Approach to Class-wise Selective Rationalization

arXiv · PDF · Open in the Atlas

Code that ran

9 of 9 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, 1 violated it and 7 have no contract verdict; 0 failures of our instrument; 0 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/1910.12853.json · badge: /api/ran/1910.12853.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
code-terminator/classwise_rationale canonical (classifier label)
classifier basis: census
9 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_accuracy Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/metric.py
code served (permissive licence) · get_code("d51408db9fe03765")
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 EagerTensor, 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 tensorflow as tf

# Create small valid tensors for the function
batch_size = 2
num_classes = 4

# Create logits tensor: (batch_size, num_classes)
logits = tf.constant([
    [1.0, 2.0, 0.5, 1.5],
    [0.1, 0.2, 2.5, 0.3]
], dtype=tf.float32)

# Create one-hot encoded labels: (batch_size, num_classes)
# First sample: class 1, Second sample: class 2
labels = tf.constant([
    [0.0, 1.0, 0.0, 0.0],
    [0.0, 0.0, 1.0, 0.0]
], dtype=tf.float32)

ARGS = {
    "logits": logits,
    "labels": labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
convert_examples_to_np_arrays Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/dataset.py
code served (permissive licence) · get_code("8a5023e52b3d6ec4")
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 numpy as np

# Create a small word2idx dictionary
word2idx = {
    'hello': 2,
    'world': 3,
    'this': 4,
    'is': 5,
    'a': 6,
    'test': 7,
    'example': 8,
    'text': 9,
}

# Create example data
examples = [
    {
        'text': 'hello world this is a test',
        'label': 0
    },
    {
        'text': 'example text here',
        'label': 1
    }
]

max_seq_length = 10

ARGS = {
    'examples': examples,
    'max_seq_length': max_seq_length,
    'word2idx': word2idx
}
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
convert_single_text Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/dataset.py
code served (permissive licence) · get_code("1e043afa08ce8df4")
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 2, 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
import numpy as np

# Create a small word2idx dictionary
word2idx = {
    'hello': 2,
    'world': 3,
    'this': 4,
    'is': 5,
    'a': 6,
    'test': 7,
}

# Define the arguments
ARGS = {
    'text': 'hello world this is a test',
    'max_seq_length': 10,
    'word2idx': word2idx,
}
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 tuple, ndim 2, dtype family int — 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
gen_nl_loss Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/train_utils.py
code served (permissive licence) · get_code("f51cebce245437f5")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create small test tensors
batch_size = 2
num_classes = 4

# logits: (batch_size, num_classes) - raw output from discriminator
logits = tf.constant([
    [0.5, -0.3, 0.2, -0.1],
    [-0.2, 0.8, -0.5, 0.1]
], dtype=tf.float32)

# targets: (batch_size, num_classes) - all zeros or all ones
# Using all ones as an example
targets = tf.constant([
    [1.0, 0.0, 0.0, 0.0],
    [0.0, 1.0, 0.0, 0.0]
], dtype=tf.float32)

# truth: real labels of examples (not used in loss calculation, but required)
# Shape (batch_size,) with class indices
truth = tf.constant([0, 1], dtype=tf.int32)

# path: whether rationale is from G0 or G1
# Can be a string or int identifier
path = "G0"

ARGS = {
    "logits": logits,
    "targets": targets,
    "truth": truth,
    "path": path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
get_beer_annotation Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/beer.py
code served (permissive licence) · get_code("8c5c1b7e7a15baee")
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 _TensorSliceDataset. 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 json
import tempfile
import numpy as np
import tensorflow as tf

# Create a temporary JSON annotation file
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.json')

# Sample annotations - each line is a JSON object
annotations = [
    {
        "x": ["great", "beer", "tastes", "amazing"],
        "y": [0.8, 0.7, 0.75],
        "0": [[0, 2]],
        "1": [[1, 3]],
        "2": [[2, 4]]
    },
    {
        "x": ["bad", "flavor", "poor", "quality"],
        "y": [0.2, 0.3, 0.25],
        "0": [[0, 1]],
        "1": [[1, 2]],
        "2": [[0, 2]]
    },
    {
        "x": ["decent", "average", "okay", "beer"],
        "y": [0.5, 0.5, 0.5],
        "0": [],
        "1": [],
        "2": []
    },
    {
        "x": ["excellent", "outstanding", "wonderful", "taste"],
        "y": [0.85, 0.9, 0.8],
        "0": [[0, 2]],
        "1": [[1, 3]],
        "2": [[0, 4]]
    }
]

for annotation in annotations:
    temp_file.write(json.dumps(annotation) + '\n')

temp_file.close()

# Build word2idx vocabulary
word2idx = {
    '<unknown>': 0,
    'great': 1,
    'beer': 2,
    'tastes': 3,
    'amazing': 4,
    'bad': 5,
    'flavor': 6,
    'poor': 7,
    'quality': 8,
    'decent': 9,
    'average': 10,
    'okay': 11,
    'excellent': 12,
    'outstanding': 13,
    'wonderful': 14,
    'taste': 15
}

ARGS = {
    'annotation_path': temp_file.name,
    'aspect': 0,
    'max_seq_length': 8,
    'word2idx': word2idx,
    'neg_thres': 0.4,
    'pos_thres': 0.6
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type _TensorSliceDataset — a _TensorSliceDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _TensorSliceDataset 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_continuity_loss Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/metric.py
code served (permissive licence) · get_code("a7eb8a5f953da68c")
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 EagerTensor, 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 tensorflow as tf

# Create a small batch of sequences
# batch_size=2, sequence_length=4
z = tf.constant([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=tf.float32)

ARGS = {
    "z": z
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
get_pretained_glove Ran
ran, honoured the contract we drafted
code-terminator/classwise_rationale/core/language.py
code served (permissive licence) · get_code("050a2b4050a56bde")
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 2, dtype family float, shape (4, 5) 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
import tempfile
import os

# Create a temporary GloVe embedding file
temp_dir = tempfile.mkdtemp()
glove_file = os.path.join(temp_dir, "glove.txt")

# Write a small GloVe format embedding file
with open(glove_file, 'w') as f:
    f.write("hello 0.1 0.2 0.3 0.4\n")
    f.write("world 0.5 0.6 0.7 0.8\n")
    f.write("test 0.9 1.0 1.1 1.2\n")

# Create word2idx dictionary
word2idx = {
    '<pad>': 0,
    'hello': 1,
    'world': 2,
    'unknown': 3,
    'words': 4
}

ARGS = {
    'word2idx': word2idx,
    'fpath': glove_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 ndarray, ndim 2, dtype family float, shape (4, 5) — shape (4, 5) 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
get_sparsity_loss Ran
ran on a synthesized input
code-terminator/classwise_rationale/core/metric.py
code served (permissive licence) · get_code("87d2f2d85e666498")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create small tensors for the function
batch_size = 2
sequence_length = 4

# z: (batch_size, sequence_length) - sparse indicator tensor
z = tf.constant([[1.0, 0.0, 1.0, 0.0],
                 [1.0, 1.0, 0.0, 0.0]], dtype=tf.float32)

# mask: (batch_size, sequence_length) - binary mask for valid positions
mask = tf.constant([[1.0, 1.0, 1.0, 1.0],
                    [1.0, 1.0, 1.0, 0.0]], dtype=tf.float32)

# level: sparsity level (scalar, between 0 and 1)
level = 0.5

ARGS = {
    'z': z,
    'mask': mask,
    'level': level
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
str2bool Ran
ran, violated the contract we drafted
code-terminator/classwise_rationale/core/misc.py
code served (permissive licence) · get_code("a4ccf5f8dcd94d12")
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 bool, 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 argparse

def str2bool(v):
    """
    Parse boolean values with argparse.
    """
    if v.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    elif v.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    else:
        raise argparse.ArgumentTypeError('Boolean value expected.')

ARGS = {
    'v': 'true'
}
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 bool, 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

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, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 later) and 7 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
str2bool 82 other papers
24 dated earlier, 1 the same month, 57 later
1510.03055 (2015-10)
A Diversity-Promoting Objective Function for Neural Conversation Models
1703.06490 (2017-03)
Generating Multi-label Discrete Patient Records using Generative Adversarial Networks
1710.10467 (2017-10)
Generalized End-to-End Loss for Speaker Verification
and 79 more not named here
get_pretained_glove 1 other paper
1 later
2003.09772 (2020-03)
Invariant Rationalization

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

Selection of input features such as relevant pieces of text has become a common technique of highlighting how complex neural predictors operate. The selection can be optimized post-hoc for trained models or incorporated directly into the method itself (self-explaining). However, an overall selection does not properly capture the multi-faceted nature of useful rationales such as pros and cons for decisions. To this end, we propose a new game theoretic approach to class-dependent rationalization, where the method is specifically trained to highlight evidence supporting alternative conclusions. Each class involves three players set up competitively to find evidence for factual and counterfactual scenarios. We show theoretically in a simplified scenario how the game drives the solution towards meaningful class-dependent rationales. We evaluate the method in single- and multi-aspect sentiment classification tasks and demonstrate that the proposed method is able to identify both factual (justifying the ground truth label) and counterfactual (countering the ground truth label) rationales consistent with human rationalization. The code for our method is publicly available.

For agents

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

get_harvested_code_for_paper("1910.12853")
get_code_for_paper("1910.12853")
have("1910.12853")

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

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

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

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

Connect an agent — have() is free.