SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2105.12400 · ACL · 2021

Hidden Killer: Invisible Textual Backdoor Attacks with Syntactic Trigger

Maosong Sun, Zhiyuan Liu, Yangyi Chen, Yasheng Wang, Zhengyan Zhang, Fanchao Qi, Li Mukai

arXiv · PDF · Open in the Atlas

Code that ran

1 of 2 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 0 failures of our instrument; 1 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/2105.12400.json · badge: /api/ran/2105.12400.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
thunlp/DictSKB community
Papers with Code archive
1 ran · 0 no recorded run
thunlp/HiddenKiller marked official in Papers with Code
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
PSOAttack Ran
ran on a synthesized input · constructed an object; no result was computed
thunlp/DictSKB/AdversarialAttack/SST/attack_dpso_sem.py
code served (permissive licence) · get_code("249ace6839e7db92")
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, PSOAttack: 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 numpy as np
import torch
import torch.nn as nn

# Stand-in model that implements predict method
class SimpleTextModel(nn.Module):
    def __init__(self, vocab_size=50000, num_classes=2, seq_len=10):
        super().__init__()
        self.embedding = nn.Embedding(vocab_size, 8)
        self.fc = nn.Linear(8 * seq_len, num_classes)
        self.vocab_size = vocab_size
        self.seq_len = seq_len
        self.num_classes = num_classes
    
    def forward(self, x):
        # x shape: (batch, seq_len)
        embedded = self.embedding(x)  # (batch, seq_len, 8)
        flattened = embedded.reshape(embedded.size(0), -1)  # (batch, seq_len*8)
        logits = self.fc(flattened)  # (batch, num_classes)
        return logits
    
    def predict(self, x):
        # x is numpy array of shape (batch, seq_len)
        x_tensor = torch.from_numpy(x).long()
        with torch.no_grad():
            output = self.forward(x_tensor)
        # Return probabilities or raw scores
        return output.numpy()

# Stand-in dataset with dict and inv_dict
class SimpleDataset:
    def __init__(self):
        self.dict = {
            'the': 1, 'cat': 2, 'dog': 3, 'sat': 4, 'on': 5, 'mat': 6,
            'is': 7, 'good': 8, 'bad': 9, 'very': 10
        }
        self.inv_dict = {v: k for k, v in self.dict.items()}

# Stand-in candidate dictionary mapping word indices to synonyms
# Format: candidate[word_idx][pos] = [list of synonym indices]
candidate = {
    2: {'noun': [3, 12, 13, 14]},  # cat -> dog, animal, etc.
    3: {'noun': [2, 15, 16]},      # dog -> cat, animal, etc.
    4: {'verb': [17, 18, 19]},     # sat -> laid, rested, etc.
    8: {'adj': [9, 20, 21]},       # good -> bad, great, nice
    9: {'adj': [8, 22, 23]},       # bad -> good, poor, etc.
}

# Create model
model = SimpleTextModel(vocab_size=50000, num_classes=2, seq_len=10)

# Create dataset
dataset = SimpleDataset()

# Define arguments dictionary for PSOAttack.__init__
ARGS = {
    'model': model,
    'candidate': candidate,
    'dataset': dataset,
    'pop_size': 20,
    'max_iters': 100
}
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 PSOAttack — 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 PSOAttack 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
algorithm_1 Not yet run
unverified (harvested, no recorded run)
thunlp/HiddenKiller/generate_poison_data/get_parse_tree_frequency.py
code served (permissive licence) · get_code("075862d550d5c8ca")
How it ran

no invocation recorded.

Also present in other papers' code

Of 2 samples lifted from this paper's linked repositories, 2 carry a function identity and 0 do not. Of the 2 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 2 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-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

Backdoor attacks are a kind of insidious security threat against machine learning models. After being injected with a backdoor in training, the victim model will produce adversaryspecified outputs on the inputs embedded with predesigned triggers but behave properly on normal inputs during inference. As a sort of emergent attack, backdoor attacks in natural language processing (NLP) are investigated insufficiently. As far as we know, almost all existing textual backdoor attack methods insert additional contents into normal samples as triggers, which causes the trigger-embedded samples to be detected and the backdoor attacks to be blocked without much effort. In this paper, we propose to use the syntactic structure as the trigger in textual backdoor attacks. We conduct extensive experiments to demonstrate that the syntactic trigger-based attack method can achieve comparable attack performance (almost 100% success rate) to the insertionbased methods but possesses much higher invisibility and stronger resistance to defenses. These results also reveal the significant insidiousness and harmfulness of textual backdoor attacks. All the code and data of this paper can be obtained at https://github.com/ thunlp/HiddenKiller.

For agents

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

get_harvested_code_for_paper("2105.12400")
get_code_for_paper("2105.12400")
have("2105.12400")

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

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

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

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

Connect an agent — have() is free.