SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.04103 · 2023

Enhancing the Rationale-Input Alignment for Self-explaining Rationalization

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2312.04103.json · badge: /api/ran/2312.04103.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
jugechengzi/dar canonical (classifier label)
classifier basis: census
6 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_micro_stats Ran
ran; our contract draft was wrong, not the code
jugechengzi/dar/metric.py
code served (permissive licence) · get_code("560b7aab59832a78")
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 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

torch.manual_seed(0)

# Create small binary tensors for labels and predictions
batch_size = 2
sequence_length = 4

# labels: binary indicators of rationale (0 or 1)
labels = torch.randint(0, 2, (batch_size, sequence_length))

# predictions: soft probabilities in [0, 1] range
predictions = torch.rand(batch_size, sequence_length)

ARGS = {
    "labels": labels,
    "predictions": predictions,
}
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 tuple, ndim 1, 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
get_continuity_loss Ran
ran, honoured the contract we drafted
jugechengzi/dar/metric.py
code served (permissive licence) · get_code("c92373379a9ed7e6")
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 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

torch.manual_seed(0)

# Construct a small tensor with shape (batch_size=2, sequence_length=4)
# The function computes differences along sequence dimension and takes mean
z = torch.randn(2, 4)

ARGS = {
    "z": z
}
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 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_embeddings Ran
ran; our contract draft was wrong, not the code
jugechengzi/dar/embedding.py
code served (permissive licence) · get_code("a7fd4428a7a26977")
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 gzip
import numpy as np
import tempfile
import os

# Create a temporary gzip file with embedding data
temp_dir = tempfile.mkdtemp()
embedding_path = os.path.join(temp_dir, "embeddings.txt.gz")

# Write sample embedding data to gzip file
with gzip.open(embedding_path, 'wt') as f:
    f.write("word1 0.1 0.2 0.3 0.4\n")
    f.write("word2 0.5 0.6 0.7 0.8\n")
    f.write("word3 0.9 1.0 1.1 1.2\n")

ARGS = {
    "embedding_path": embedding_path
}
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
get_glove_embedding Ran
ran; our contract draft was wrong, not the code
jugechengzi/dar/embedding.py
code served (permissive licence) · get_code("f5f0244064d12e86")
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
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 file
with open(glove_file, 'w', encoding='utf-8') 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("python 0.9 1.0 1.1 1.2\n")

ARGS = {
    "glove_embedding_path": 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 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
get_sparsity_loss Ran
ran, violated the contract we drafted
jugechengzi/dar/metric.py
code served (permissive licence) · get_code("7d30b2c623f59a22")
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 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

torch.manual_seed(0)

# z: (batch_size, sequence_length) - tensor of values to sum
z = torch.randn(2, 4)

# mask: (batch_size, seq_length) - tensor used to normalize the sum
mask = torch.ones(2, 4)

# level: sparsity level (a float scalar)
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
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, 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
train_teacher Ran
ran, honoured the contract we drafted
jugechengzi/dar/train_util.py
code served (permissive licence) · get_code("a2c8a4d6422a144a")
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 torch
import torch.nn as nn
import torch.optim as optim

torch.manual_seed(0)

# Define a minimal teacher model
class TeacherModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)  # 4 input features, 2 classes
    
    def forward(self, inputs, masks):
        # inputs: (batch, 4)
        # masks: (batch, 4)
        # Apply mask and pass through linear layer
        masked_inputs = inputs * masks
        logits = self.linear(masked_inputs)
        return logits

# Create teacher model
teacher = TeacherModel()

# Create optimizer
optimizer = optim.SGD(teacher.parameters(), lr=0.01)

# Create small dataset as list of (inputs, masks, labels) tuples
# Batch size 2, input dim 4, 2 samples
dataset = [
    (
        torch.randn(2, 4),      # inputs
        torch.ones(2, 4),       # masks
        torch.tensor([0, 1])    # labels (binary classification)
    ),
    (
        torch.randn(2, 4),
        torch.ones(2, 4),
        torch.tensor([1, 0])
    )
]

# Device (CPU only)
device = torch.device('cpu')

ARGS = {
    'teacher': teacher,
    'optimizer': optimizer,
    'dataset': dataset,
    'device': device
}
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 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 5 later) and 1 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
compute_micro_stats 3 other papers
1 dated earlier, 2 later
2309.13391 (2023-09)
D-Separation for Causal Self-Explanation
2410.06003 (2024-10)
Is the MMI Criterion Necessary for Interpretability? Degenerating Non-causal Features to Plain Noise for Self-Rationalization
2503.06202 (2025-03)
Breaking Free from MMI: A New Frontier in Rationalization by Probing Input Utilization
get_continuity_loss 3 other papers
1 dated earlier, 2 later
2309.13391 (2023-09)
D-Separation for Causal Self-Explanation
2410.06003 (2024-10)
Is the MMI Criterion Necessary for Interpretability? Degenerating Non-causal Features to Plain Noise for Self-Rationalization
2503.06202 (2025-03)
Breaking Free from MMI: A New Frontier in Rationalization by Probing Input Utilization
get_embeddings 3 other papers
1 dated earlier, 2 later
2309.13391 (2023-09)
D-Separation for Causal Self-Explanation
2410.06003 (2024-10)
Is the MMI Criterion Necessary for Interpretability? Degenerating Non-causal Features to Plain Noise for Self-Rationalization
2503.06202 (2025-03)
Breaking Free from MMI: A New Frontier in Rationalization by Probing Input Utilization
get_glove_embedding 3 other papers
1 dated earlier, 2 later
2309.13391 (2023-09)
D-Separation for Causal Self-Explanation
2410.06003 (2024-10)
Is the MMI Criterion Necessary for Interpretability? Degenerating Non-causal Features to Plain Noise for Self-Rationalization
2503.06202 (2025-03)
Breaking Free from MMI: A New Frontier in Rationalization by Probing Input Utilization
get_sparsity_loss 3 other papers
1 dated earlier, 2 later
2309.13391 (2023-09)
D-Separation for Causal Self-Explanation
2410.06003 (2024-10)
Is the MMI Criterion Necessary for Interpretability? Degenerating Non-causal Features to Plain Noise for Self-Rationalization
2503.06202 (2025-03)
Breaking Free from MMI: A New Frontier in Rationalization by Probing Input Utilization

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-22.

Repositories linked to this paper

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

Abstract

Rationalization empowers deep learning models with self-explaining capabilities through a cooperative game, where a generator selects a semantically consistent subset of the input as a rationale, and a subsequent predictor makes predictions based on the selected rationale. In this paper, we discover that rationalization is prone to a problem named \emph{rationale shift}, which arises from the algorithmic bias of the cooperative game. Rationale shift refers to a situation where the semantics of the selected rationale may deviate from the original input, but the predictor still produces accurate predictions based on the deviation, resulting in a compromised generator with misleading feedback. To address this issue, we first demonstrate the importance of the alignment between the rationale and the full input through both empirical observations and theoretical analysis. Subsequently, we introduce a novel approach called DAR (\textbf{D}iscriminatively \textbf{A}ligned \textbf{R}ationalization), which utilizes an auxiliary module pretrained on the full input to discriminatively align the selected rationale and the original input. We theoretically illustrate how DAR accomplishes the desired alignment, thereby overcoming the rationale shift problem. The experiments on two widely used real-world benchmarks show that the proposed method significantly improves the explanation quality (measured by the overlap between the model-selected explanation and the human-annotated rationale) as compared to state-of-the-art techniques. Additionally, results on two synthetic settings further validate the effectiveness of DAR in addressing the rationale shift problem.

For agents

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

get_harvested_code_for_paper("2312.04103")
get_code_for_paper("2312.04103")
have("2312.04103")

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

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

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

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

Connect an agent — have() is free.