SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.07812 · EMNLP · 2021

Transductive Learning for Unsupervised Text Style Transfer

Yan Wang, Huawei Shen, Xueqi Cheng, Yanyan Lan, Fei Xiao, Liang Pang

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 3 failures of our instrument; 2 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.07812.json · badge: /api/ran/2109.07812.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
xiaofei05/tsst marked official in Papers with Code
Papers with Code archive
5 ran · 2 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("d66300e7c5ca2267")
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 an instance of its own class, Attention: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn
import torch.nn.functional as F
import numpy as np

torch.manual_seed(0)

class Attention(nn.Module):

    def __init__(self, query_size, value_size, dropout=0.0):
        super(Attention, self).__init__()
        self.attn = nn.Linear(query_size + value_size, value_size)
        self.v = nn.Parameter(torch.rand(value_size))
        stdv = 1.0 / np.sqrt(self.v.size(0))
        self.v.data.normal_(mean=0, std=stdv)
        self.dropout = nn.Dropout(dropout)

    def forward(self, Q, K, V, attention_mask):
        k_len = K.size(1)
        q_state = Q.repeat(1, k_len, 1)
        attn_energies = self.score(q_state, K)
        attn_energies.masked_fill_(attention_mask, -1000000000000.0)
        attn_weights = F.softmax(attn_energies, dim=1).unsqueeze(1)
        attn_weights = self.dropout(attn_weights)
        context = attn_weights.bmm(V)
        return (context, attn_weights)

    def score(self, query, memory):
        energy = torch.tanh(self.attn(torch.cat([query, memory], 2)))
        energy = energy.transpose(1, 2)
        v = self.v.repeat(memory.size(0), 1).unsqueeze(1)
        energy = torch.bmm(v, energy)
        return energy.squeeze(1)


query_size = 5
value_size = 4
dropout = 0.1

attention_module = Attention(query_size, value_size, dropout)

batch_size = 2
seq_len_k = 3
seq_len_q = 1

Q = torch.randn(batch_size, seq_len_q, query_size)
K = torch.randn(batch_size, seq_len_k, value_size)
V = torch.randn(batch_size, seq_len_k, value_size)

attention_mask = torch.zeros(batch_size, seq_len_k, dtype=torch.bool)

ARGS = {
    'query_size': query_size,
    'value_size': value_size,
    'dropout': dropout
}
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 Attention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Attention 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
Encoder Ran
ran on a synthesized input · constructed an object; no result was computed
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("8fdbd18c69e308fb")
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 an instance of its own class, Encoder: the run constructed the object and did not call it, so no result was computed. 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 torch.nn as nn

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.embedding_size = 4
        self.hidden_size = 3
        self.nlayers = 2
        self.dropout = 0.1
        self.bidirectional = True

config = Config()

encoder = nn.Module()
encoder.rnn = nn.LSTM(
    input_size=config.embedding_size,
    hidden_size=config.hidden_size,
    num_layers=config.nlayers,
    dropout=config.dropout if config.nlayers > 1 else 0,
    bidirectional=config.bidirectional == True,
    batch_first=True
)
encoder.dropout = nn.Dropout(config.dropout)

batch_size = 2
seq_length = 5
inputs = torch.randn(batch_size, seq_length, config.embedding_size)
lengths = torch.tensor([5, 3])

ARGS = {
    "config": config
}
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 Encoder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Encoder 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_attn_mask Ran
ran; our contract draft was wrong, not the code
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("5fe0d00c1b5657fd")
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, shape (2, 4) 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 a small 2D tensor for seq parameter
# Shape: (batch_size=2, seq_length=4)
# Values include padding tokens (represented by 0)
seq = torch.tensor([
    [1, 2, 3, 0],
    [5, 6, 0, 0]
], dtype=torch.long)

# Define the padding token value
pad = 0

ARGS = {
    "seq": seq,
    "pad": pad
}
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, shape (2, 4) — shape (2, 4) 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_non_pad_mask Ran
ran; our contract draft was wrong, not the code
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("09f8dade3250c7f8")
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, shape (2, 4) 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)

# The function expects:
# - seq: a 2D tensor (checked by assert seq.dim() == 2)
# - pad: a scalar value used for comparison (seq.ne(pad))

# Create a small 2D tensor with some padding values
seq = torch.tensor([
    [1, 2, 3, 0],
    [4, 5, 0, 0]
], dtype=torch.long)

# Define pad as a scalar value (0 in this case, common for padding)
pad = 0

ARGS = {
    "seq": seq,
    "pad": pad
}
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, shape (2, 4) — shape (2, 4) 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_seq_length Ran
ran; our contract draft was wrong, not the code
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("d81c65a723225d56")
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 1, dtype family int, shape (2,) 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 a small sequence tensor with padding
# Shape: (batch_size=2, seq_length=4)
# Using values 0-5, where we'll treat 0 as padding
seq = torch.tensor([
    [1, 2, 3, 0],
    [4, 5, 0, 0]
], dtype=torch.long)

# Padding token value
pad = 0

ARGS = {
    "seq": seq,
    "pad": pad
}
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 1, dtype family int, shape (2,) — shape (2,) 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
Decoder Not yet run
unverified (harvested, no recorded run)
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("78e266285cb1f066")
How it ran

no invocation recorded.

TSST Not yet run
unverified (harvested, no recorded run)
xiaofei05/tsst/model/TSST.py
code served (permissive licence) · get_code("c252dad001eb8aa9")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 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.

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

Unsupervised style transfer models are mainly based on an inductive learning approach, which represents the style as embeddings, decoder parameters, or discriminator parameters and directly applies these general rules to the test cases. However, the lacking of parallel corpus hinders the ability of these inductive learning methods on this task. As a result, it is likely to cause severe inconsistent style expressions, like the salad is rude. To tackle this problem, we propose a novel transductive learning approach in this paper, based on a retrieval-based context-aware style representation. Specifically, an attentional encoder-decoder with a retriever framework is utilized. It involves top-K relevant sentences in the target style in the transfer process. In this way, we can learn a context-aware style embedding to alleviate the above inconsistency problem. In this paper, both sparse (BM25) and dense retrieval functions (MIPS) are used, and two objective functions are designed to facilitate joint learning. Experimental results show that our method outperforms several strong baselines. The proposed transductive learning approach is general and effective to the task of unsupervised style transfer, and we will apply it to the other two typical methods in the future.

For agents

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

get_harvested_code_for_paper("2109.07812")
get_code_for_paper("2109.07812")
have("2109.07812")

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

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

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

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

Connect an agent — have() is free.