SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1811.01063 · 2018

Augmenting Neural Response Generation with Context-Aware Topical Attention

arXiv · PDF · Open in the Atlas

Code that ran

5 of 14 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 4 have no contract verdict; 0 failures of our instrument; 9 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/1811.01063.json · badge: /api/ran/1811.01063.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
nouhadziri/THRED canonical (classifier label)
classifier basis: census
5 ran · 9 no recorded run
FunctionStatusWhere it lives
basic_tokenizer Ran
ran on a synthesized input
nouhadziri/THRED/thred/models/data_utils.py
code served (permissive licence) · get_code("e40595a62d93569d")
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

_WORD_SPLIT = re.compile(b'([.,!?"\':;)(])')

def basic_tokenizer(sentence):
    """Very basic tokenizer: split the sentence into a list of tokens."""
    words = []
    for space_separated_fragment in sentence.strip().split():
        words.extend(_WORD_SPLIT.split(space_separated_fragment))
    return [w for w in words if w]


# The function expects a sentence parameter that is bytes
# It calls .strip() and .split() on it, which are bytes methods
# It uses the regex to split each fragment

sentence_input = b"Hello, world! How are you?"

ARGS = {
    "sentence": sentence_input
}
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
initialize_vocabulary Ran
ran on a synthesized input
nouhadziri/THRED/thred/models/data_utils.py
code served (permissive licence) · get_code("7d413a0bbeda1f32")
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 tempfile
import os

# Create a temporary vocabulary file
temp_dir = tempfile.mkdtemp()
vocab_file = os.path.join(temp_dir, "vocab.txt")

# Write a sample vocabulary to the file
with open(vocab_file, 'w') as f:
    f.write("dog\n")
    f.write("cat\n")
    f.write("bird\n")
    f.write("fish\n")

ARGS = {
    "vocabulary_path": vocab_file
}
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 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
is_attention_enabled Ran
ran on a synthesized input
nouhadziri/THRED/thred/models/attention_helper.py
code served (permissive licence) · get_code("9abf699de58bc952")
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 torch

ARGS = {
    'attention_option': 'luong'
}
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 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
iter_corpus Ran
ran on a synthesized input
nouhadziri/THRED/thred/topic_model/lda.py
code served (permissive licence) · get_code("0c91758a8bd64888")
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. 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 codecs
import tempfile
import os
from os import listdir, mkdir
from os.path import isdir, exists, join, abspath

# Create minimal stand-in classes
class Stopwatch:
    def print(self, msg):
        pass

class Analyzer:
    def normalize(self, word, min_length=None):
        if min_length and len(word) < min_length:
            raise Warning("Word too short")
        return word.lower()
    
    def normalize_sequence(self, words, min_length=None):
        result = []
        for word in words:
            try:
                term = self.normalize(word, min_length)
                result.append(term)
            except Warning:
                continue
        return result if result else None

# Create a temporary directory with test documents
temp_dir = tempfile.mkdtemp()
doc1_path = join(temp_dir, "doc1.txt")
doc2_path = join(temp_dir, "doc2.txt")

with open(doc1_path, 'w', encoding='utf-8') as f:
    f.write("hello world test\n")
    f.write("another line here\n")

with open(doc2_path, 'w', encoding='utf-8') as f:
    f.write("sample document text\n")

# Inject dependencies into the module's global scope
import sys
current_module = sys.modules[__name__]
current_module.Stopwatch = Stopwatch
current_module.analyzer = Analyzer()

# Define arguments
ARGS = {
    'documents': temp_dir,
    'min_length': None
}
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 — a list 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
sentence_to_token_ids Ran
ran, honoured the contract we drafted
nouhadziri/THRED/thred/models/data_utils.py
code served (permissive licence) · get_code("a8ba4fe282270810")
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

UNK_ID = 3

_WORD_SPLIT = re.compile(b'([.,!?"\':;)(])')
_DIGIT_RE = re.compile(b'\\d')

def basic_tokenizer(sentence):
    """Very basic tokenizer: split the sentence into a list of tokens."""
    words = []
    for space_separated_fragment in sentence.strip().split():
        words.extend(_WORD_SPLIT.split(space_separated_fragment))
    return [w for w in words if w]

def sentence_to_token_ids(sentence, vocabulary, tokenizer=None, normalize_digits=True):
    """Convert a string to list of integers representing token-ids."""
    if tokenizer:
        words = tokenizer(sentence)
    else:
        words = basic_tokenizer(sentence)
    if not normalize_digits:
        return [vocabulary.get(w, UNK_ID) for w in words]
    return [vocabulary.get(_DIGIT_RE.sub(b'0', w), UNK_ID) for w in words]


# Setup arguments for sentence_to_token_ids
sentence = b"I have a dog"

vocabulary = {
    b"I": 1,
    b"have": 2,
    b"a": 4,
    b"dog": 7,
    b"0": 5
}

def custom_tokenizer(sentence):
    """Custom tokenizer that splits on spaces."""
    return sentence.strip().split()

ARGS = {
    "sentence": sentence,
    "vocabulary": vocabulary,
    "tokenizer": None,
    "normalize_digits": 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 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
create_attention_mechanism Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/attention_helper.py
code served (permissive licence) · get_code("b9c67528d9265a61")
How it ran

no invocation recorded.

create_model Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/model_factory.py
code served (permissive licence) · get_code("cde612444096ca52")
How it ran

no invocation recorded.

create_or_load_model Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/model_helper.py
code served (permissive licence) · get_code("9f06a9503cb890f0")
How it ran

no invocation recorded.

get_config_proto Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/model_helper.py
code served (permissive licence) · get_code("f4cd70b4af6f3433")
How it ran

no invocation recorded.

get_translation Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/ncm_utils.py
code served (permissive licence) · get_code("f3efe1580a80c6a4")
How it ran

no invocation recorded.

initialize_vocabulary Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/topical_base.py
code served (permissive licence) · get_code("2c909688ddd29cad")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/models/model_helper.py
code served (permissive licence) · get_code("86296f212902a365")
How it ran

no invocation recorded.

normalize Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/topic_model/analyzer.py
code served (permissive licence) · get_code("29e39efb902dd8e2")
How it ran

no invocation recorded.

normalize_sequence Not yet run
unverified (harvested, no recorded run)
nouhadziri/THRED/thred/topic_model/analyzer.py
code served (permissive licence) · get_code("4fc7a88811b57aaf")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 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
basic_tokenizer 1 other paper
1 later
2204.05805 (2022-04)
Learning to Express in Knowledge-Grounded Conversation
sentence_to_token_ids 1 other paper
1 later
2204.05805 (2022-04)
Learning to Express in Knowledge-Grounded Conversation

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

Sequence-to-Sequence (Seq2Seq) models have witnessed a notable success in generating natural conversational exchanges. Notwithstanding the syntactically well-formed responses generated by these neural network models, they are prone to be acontextual, short and generic. In this work, we introduce a Topical Hierarchical Recurrent Encoder Decoder (THRED), a novel, fully data-driven, multi-turn response generation system intended to produce contextual and topic-aware responses. Our model is built upon the basic Seq2Seq model by augmenting it with a hierarchical joint attention mechanism that incorporates topical concepts and previous interactions into the response generation. To train our model, we provide a clean and high-quality conversational dataset mined from Reddit comments. We evaluate THRED on two novel automated metrics, dubbed Semantic Similarity and Response Echo Index, as well as with human evaluation. Our experiments demonstrate that the proposed model is able to generate more diverse and contextually relevant responses compared to the strong baselines.

For agents

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

get_harvested_code_for_paper("1811.01063")
get_code_for_paper("1811.01063")
have("1811.01063")

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

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

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

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

Connect an agent — have() is free.