SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.00374 · 2023

The Philosopher's Stone: Trojaning Plugins of Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

7 of 12 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, 3 violated it and 0 have no contract verdict; 3 failures of our instrument; 5 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/2312.00374.json · badge: /api/ran/2312.00374.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
chichidd/llm-lora-trojan canonical (classifier label)
classifier basis: census
7 ran · 5 no recorded run
FunctionStatusWhere it lives
filter_nan Ran
ran, violated the contract we drafted
chichidd/llm-lora-trojan/dataset_utils.py
code served (permissive licence) · get_code("79acddd7564fbe65")
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
import torch.nn as nn

torch.manual_seed(0)

# The function filter_nan takes one parameter: example
# It checks if example['input'] and example['output'] are not None
# So we need to construct a dict with 'input' and 'output' keys

example = {
    'input': torch.randn(2, 4),
    'output': torch.randn(2, 3)
}

ARGS = {
    'example': example
}
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
format_example_chatglm Ran
ran; our contract draft was wrong, not the code
chichidd/llm-lora-trojan/dataset_utils.py
code served (permissive licence) · get_code("09c65a1f107750b4")
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 dict. 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

torch.manual_seed(0)

# Construct a valid example dict for format_example_chatglm
example = {
    'instruction': 'Translate the following text to French',
    'input': 'Hello, how are you?'
}

ARGS = {
    'example': example
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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_last_checkpoint Ran
ran; our contract draft was wrong, not the code
chichidd/llm-lora-trojan/utils.py
code served (permissive licence) · get_code("52994a0cce5a9a54")
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 os
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()

# Test case 1: Directory with completed marker
completed_dir = os.path.join(temp_dir, 'completed_checkpoint')
os.makedirs(completed_dir, exist_ok=True)
with open(os.path.join(completed_dir, 'completed'), 'w') as f:
    f.write('')

# Test case 2: Directory with checkpoints
checkpoint_dir = os.path.join(temp_dir, 'checkpoint_dir')
os.makedirs(checkpoint_dir, exist_ok=True)
os.makedirs(os.path.join(checkpoint_dir, 'checkpoint-100'), exist_ok=True)
os.makedirs(os.path.join(checkpoint_dir, 'checkpoint-200'), exist_ok=True)
os.makedirs(os.path.join(checkpoint_dir, 'checkpoint-50'), exist_ok=True)

# Test case 3: Empty directory
empty_dir = os.path.join(temp_dir, 'empty_dir')
os.makedirs(empty_dir, exist_ok=True)

# Test case 4: Non-existent directory
nonexistent_dir = os.path.join(temp_dir, 'nonexistent')

ARGS = {
    'checkpoint_dir': checkpoint_dir
}
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 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
is_jsonable Ran
ran, violated the contract we drafted
chichidd/llm-lora-trojan/argument_utils.py
code served (permissive licence) · get_code("f9d3ae1b96d583b1")
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 json

def is_jsonable(x):
    try:
        json.dumps(x)
        return True
    except (TypeError, OverflowError):
        return False

# The function takes a single parameter 'x' and tests if it's JSON serializable
# We need to provide a value that can be passed to is_jsonable

ARGS = {
    'x': {'key': 'value', 'number': 42, 'list': [1, 2, 3], 'nested': {'a': 1}}
}
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 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
parse_score Ran
ran, violated the contract we drafted
chichidd/llm-lora-trojan/eval/gpt_review.py
code served (permissive licence) · get_code("8049b382893c73dd")
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) 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 logging

logger = logging.getLogger(__name__)

def parse_score(review):
    try:
        score_pair = review.split('\n')[0]
        score_pair = score_pair.replace(',', ' ')
        sp = score_pair.split(' ')
        if len(sp) == 2:
            return [float(sp[0]), float(sp[1])]
        else:
            raise Exception('Invalid score pair.')
    except Exception as e:
        logger.error(f'{e}\nContent: {review}\nYou must manually fix the score pair.')
        return [-1, -1]

# Valid review string with score pair on first line
review_valid = "8.5 9.2\nThis is a great product with excellent quality."

ARGS = {
    "review": review_valid
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
parse_three_class_score Ran
ran, honoured the contract we drafted
chichidd/llm-lora-trojan/eval/gpt_review.py
code served (permissive licence) · get_code("2155c3b1b19d8ab9")
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) and returned int, ndim 0, dtype family int, 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 logging

logger = logging.getLogger(__name__)

def parse_three_class_score(review):
    try:
        score = int(review.strip().split('\n')[-1].strip())
        return score
    except Exception as e:
        logger.error(f'{e}\nContent: {review}\nYou must manually fix the score pair.')
        return -1

# Setup code
ARGS = {
    "review": "This is a great product.\nVery satisfied with the quality.\n5"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int, ndim 0, dtype family int, 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
remove_unused_columns Ran
ran; our contract draft was wrong, not the code
chichidd/llm-lora-trojan/dataset_utils.py
code served (permissive licence) · get_code("f89ea0335c64630c")
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 MockDataset. 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 numpy as np

class MockDataset:
    def __init__(self):
        self.column_names = {
            'train': ['input', 'output', 'extra_col1', 'extra_col2']
        }
    
    def remove_columns(self, cols):
        # Mock implementation that returns self for chaining
        self.removed_cols = cols
        return self

# Create a mock dataset instance
mock_dataset = MockDataset()

ARGS = {
    'dataset': mock_dataset
}
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 MockDataset — a MockDataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockDataset 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
generate_inputs Not yet run
unverified (harvested, no recorded run)
chichidd/llm-lora-trojan/inference.py
code served (permissive licence) · get_code("f4dfe5af22abf803")
How it ran

no invocation recorded.

get_eval Not yet run
unverified (harvested, no recorded run)
chichidd/llm-lora-trojan/eval/gpt_review.py
code served (permissive licence) · get_code("191943d87af4d1bb")
How it ran

no invocation recorded.

load_model Not yet run
unverified (harvested, no recorded run)
chichidd/llm-lora-trojan/inference.py
code served (permissive licence) · get_code("57bacd2b23ac0c92")
How it ran

no invocation recorded.

process_dst Not yet run
unverified (harvested, no recorded run)
chichidd/llm-lora-trojan/polished_query.py
code served (permissive licence) · get_code("e4b5ac00e0948539")
How it ran

no invocation recorded.

query Not yet run
unverified (harvested, no recorded run)
chichidd/llm-lora-trojan/polished_query.py
code served (permissive licence) · get_code("6be099782a45aa78")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 1 later) and 10 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
parse_score 7 other papers
4 dated earlier, 1 the same month, 2 later
2305.12031 (2023-05)
Clinical Camel: An Open Expert-Level Medical Language Model with Dialogue-Based Knowledge Encoding
2305.14314 (2023-05)
QLORA: Efficient Finetuning of Quantized LLMs
2307.02762 (2023-07)
PRD: Peer Rank and Discussion Improve Large Language Model based Evaluations
and 4 more not named here
parse_three_class_score 2 other papers
2 dated earlier
2305.14314 (2023-05)
QLORA: Efficient Finetuning of Quantized LLMs
2307.02762 (2023-07)
PRD: Peer Rank and Discussion Improve Large Language Model based Evaluations

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

Open-source Large Language Models (LLMs) have recently gained popularity because of their comparable performance to proprietary LLMs. To efficiently fulfill domain-specialized tasks, open-source LLMs can be refined, without expensive accelerators, using low-rank adapters. However, it is still unknown whether low-rank adapters can be exploited to control LLMs. To address this gap, we demonstrate that an infected adapter can induce, on specific triggers,an LLM to output content defined by an adversary and to even maliciously use tools. To train a Trojan adapter, we propose two novel attacks, POLISHED and FUSION, that improve over prior approaches. POLISHED uses a superior LLM to align naïvely poisoned data based on our insight that it can better inject poisoning knowledge during training. In contrast, FUSION leverages a novel over-poisoning procedure to transform a benign adapter into a malicious one by magnifying the attention between trigger and target in model weights. In our experiments, we first conduct two case studies to demonstrate that a compromised LLM agent can use malware to control the system (e.g., a LLM-driven robot) or to launch a spear-phishing attack. Then, in terms of targeted misinformation, we show that our attacks provide higher attack effectiveness than the existing baseline and, for the purpose of attracting downloads, preserve or improve the adapter's utility. Finally, we designed and evaluated three potential defenses. However, none proved entirely effective in safeguarding against our attacks, highlighting the need for more robust defenses supporting a secure LLM supply chain.

For agents

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

get_harvested_code_for_paper("2312.00374")
get_code_for_paper("2312.00374")
have("2312.00374")

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

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

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

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

Connect an agent — have() is free.