SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.08828 · EMNLP · 2021

Perspective-taking and Pragmatics for Generating Empathetic Responses Focused on Emotion Causes

Gunhee Kim, Byeongchang Kim, Hyunwoo Kim

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 4 failures of our instrument; 1 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/2109.08828.json · badge: /api/ran/2109.08828.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
skywalker023/focused-empathy canonical (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
calc_banned_bad_words_ids Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
skywalker023/focused-empathy/from_epitome/modeling_utils.py
code served (permissive licence) · get_code("49656b24dd2f6b62")
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. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:14:48Z. 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

torch.manual_seed(0)

# Analyzing the function:
# - prev_input_ids: iterable of sequences (used with .tolist()), appears to be a batch of token sequences
# - bad_words_ids: list of lists, where each inner list is a sequence of token ids
# 
# The function:
# 1. Iterates over prev_input_ids (batch)
# 2. For each sequence, checks if it matches prefixes in bad_words_ids
# 3. Calls .tolist() on prev_input_ids_slice, so it should be a tensor or array-like
# 4. Compares sequences using list slicing

# Create prev_input_ids as a batch of token sequences
# Shape: (batch_size=2, seq_len=4) - small tensors
prev_input_ids = torch.tensor([
    [1, 2, 3, 4],
    [5, 6, 7, 8]
], dtype=torch.long)

# Create bad_words_ids as a list of forbidden token sequences
# Each sequence has at least one token (enforced by assertion)
bad_words_ids = [
    [2, 3, 10],      # if prev tokens end with [2, 3], ban token 10
    [6, 7, 11],      # if prev tokens end with [6, 7], ban token 11
    [1, 12],         # if prev tokens end with [1], ban token 12
    [4, 13],         # if prev tokens end with [4], ban token 13
]

ARGS = {
    "prev_input_ids": prev_input_ids,
    "bad_words_ids": bad_words_ids,
}
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 list — a list output has no array shape of its own; none is stated
Environment
image syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
calc_banned_ngram_tokens Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
skywalker023/focused-empathy/from_epitome/modeling_utils.py
code served (permissive licence) · get_code("f1cff4633a737beb")
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 2, dtype family int; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:14:48Z. 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
from torch import Tensor

torch.manual_seed(0)

# Construct arguments for calc_banned_ngram_tokens
# Parameters:
# - prev_input_ids: Tensor of shape (num_hypos, seq_len)
# - num_hypos: int, number of hypotheses
# - no_repeat_ngram_size: int, size of n-grams to avoid repeating
# - cur_len: int, current sequence length

num_hypos = 2
seq_len = 5
no_repeat_ngram_size = 3
cur_len = 4

# Create prev_input_ids tensor: (num_hypos, seq_len)
# Each hypothesis has a sequence of token ids
prev_input_ids = torch.tensor([
    [10, 20, 30, 40, 50],
    [15, 25, 35, 45, 55]
], dtype=torch.long)

ARGS = {
    "prev_input_ids": prev_input_ids,
    "num_hypos": num_hypos,
    "no_repeat_ngram_size": no_repeat_ngram_size,
    "cur_len": cur_len
}
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 2, 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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
mish Ran
ran; our contract draft was wrong, not the code
skywalker023/focused-empathy/from_epitome/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from llyx97/sparse-and-robust-PLM, is pointer only (licence: NONE) · get_code("060527bb34794b59")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from llyx97/sparse-and-robust-PLM, and GitHub detected no licence in that repository when it was checked. 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.

top_k_top_p_filtering Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
skywalker023/focused-empathy/from_epitome/modeling_utils.py
code served (permissive licence) · get_code("8e873fc150477bd1")
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; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:14:48Z. 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.functional as F

torch.manual_seed(0)

# Create small logits tensor: (batch_size=2, vocab_size=4)
logits = torch.randn(2, 4)

# Define ARGS dictionary with all parameters
ARGS = {
    "logits": logits,
    "top_k": 2,
    "top_p": 0.9,
    "filter_value": -float('Inf'),
    "min_tokens_to_keep": 1
}
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 — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
skywalker023/focused-empathy/from_epitome/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from llyx97/sparse-and-robust-PLM, is pointer only (licence: NONE) · get_code("0766f48ad6e01b56")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from llyx97/sparse-and-robust-PLM, and GitHub detected no licence in that repository when it was checked. 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. No invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 1 the same month, 5 later) and 0 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
top_k_top_p_filtering 21 other papers
7 dated earlier, 14 later
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
2005.00796 (2020-05)
A Simple Language Model for Task-Oriented Dialogue
2009.06367 (2020-09)
GeDi: Generative Discriminator Guided Sequence Generation
and 18 more not named here
mish 19 other papers
3 dated earlier, 12 later, 4 same year, order not determinable
2006.04884 (2020-06)
On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines
2007.12223 (2020-07)
The Lottery Ticket Hypothesis for Pre-trained BERT Networks
2012.07463 (2020-12)
Parameter-Efficient Transfer Learning with Diff Pruning
and 16 more not named here
load_tf_weights_in_bert 16 other papers
3 dated earlier, 10 later, 3 same year, order not determinable
2006.04884 (2020-06)
On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines
2007.12223 (2020-07)
The Lottery Ticket Hypothesis for Pre-trained BERT Networks
2012.07463 (2020-12)
Parameter-Efficient Transfer Learning with Diff Pruning
and 13 more not named here
calc_banned_ngram_tokens 8 other papers
2 dated earlier, 1 the same month, 5 later
1910.13461 (2019-10)
BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
2106.01317 (2021-06)
Enriching Transformers with Structured Tensor-Product Representations for Abstractive Summarization
2109.04096 (2021-09)
A Three-Stage Learning Framework for Low-Resource Knowledge-Grounded Dialogue Generation
and 5 more not named here
calc_banned_bad_words_ids 2 other papers
1 dated earlier, 1 later
2106.01317 (2021-06)
Enriching Transformers with Structured Tensor-Product Representations for Abstractive Summarization
2025.findings-emnlp.70 (2025 (year only))
Flexible Thinking for Multimodal Emotional Support Conversation via Reinforcement Learning

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

Empathy is a complex cognitive ability based on the reasoning of others' affective states. In order to better understand others and express stronger empathy in dialogues, we argue that two issues must be tackled at the same time: (i) identifying which word is the cause for the other's emotion from his or her utterance and (ii) reflecting those specific words in the response generation. However, previous approaches for recognizing emotion cause words in text require sub-utterance level annotations, which can be demanding. Taking inspiration from social cognition, we leverage a generative estimator to infer emotion cause words from utterances with no word-level label. Also, we introduce a novel method based on pragmatics to make dialogue models focus on targeted words in the input during generation. Our method is applicable to any dialogue models with no additional training on the fly. We show our approach improves multiple best performing dialogue agents on generating more focused empathetic responses in terms of both automatic and human evaluation.

For agents

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

get_harvested_code_for_paper("2109.08828")
get_code_for_paper("2109.08828")
have("2109.08828")

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

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

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

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

Connect an agent — have() is free.