SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.19663 · 2024

Identifying Knowledge Editing Types in Large Language Models

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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 1 has no contract verdict; 6 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/2409.19663.json · badge: /api/ran/2409.19663.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
xpq-tech/keti canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
evaluate_model Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/abalation_closellm.py
code served (permissive licence) · get_code("91a84b1a09f3183e")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from torch.utils.data import DataLoader, Dataset

torch.manual_seed(0)

# Define a minimal model that matches the function's expectations
class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(20, 3)  # 3 output classes
    
    def forward(self, input_ids, attention_mask, generated_input_ids, generated_attention_mask, top20_probs):
        # Take top20_probs as input (batch_size, 20) and output logits (batch_size, 3)
        outputs = self.linear(top20_probs)
        return outputs

# Define a minimal dataset
class DummyDataset(Dataset):
    def __init__(self, num_samples=4):
        self.num_samples = num_samples
    
    def __len__(self):
        return self.num_samples
    
    def __getitem__(self, idx):
        return {
            'input_ids': torch.randint(0, 100, (8,)),
            'attention_mask': torch.ones(8),
            'generated_input_ids': torch.randint(0, 100, (8,)),
            'generated_attention_mask': torch.ones(8),
            'top20_probs': torch.rand(20),
            'label': torch.randint(0, 3, (1,)).item()
        }

# Create model and dataloader
model = DummyModel()
dataset = DummyDataset(num_samples=4)
dataloader = DataLoader(dataset, batch_size=2)

ARGS = {
    'model': model,
    'dataloader': dataloader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
sklearn, torch — 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
evaluate_model Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/close_source_llms_main.py
code served (permissive licence) · get_code("611b5daad6c596b7")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np

torch.manual_seed(0)

# Define a minimal model that matches the function's usage
class DummyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(100, 3)  # 3 classes for classification
    
    def forward(self, input_ids, attention_mask, generated_input_ids, generated_attention_mask, top20_probs):
        # Simple dummy forward pass that returns logits
        batch_size = input_ids.shape[0]
        return self.linear(torch.randn(batch_size, 100))

model = DummyModel()

# Create a minimal dataloader (list of batches with required keys)
def create_batch(batch_idx):
    batch_size = 2
    seq_len = 8
    num_classes = 3
    top_k = 20
    
    batch = {
        'input_ids': torch.randint(0, 1000, (batch_size, seq_len)),
        'attention_mask': torch.ones(batch_size, seq_len, dtype=torch.long),
        'generated_input_ids': torch.randint(0, 1000, (batch_size, seq_len)),
        'generated_attention_mask': torch.ones(batch_size, seq_len, dtype=torch.long),
        'top20_probs': torch.rand(batch_size, top_k),
        'label': torch.randint(0, num_classes, (batch_size,))
    }
    return batch

dataloader = [create_batch(0), create_batch(1)]

ARGS = {
    'model': model,
    'dataloader': dataloader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — 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
hierarchical_subsequence Ran
ran on a synthesized input
xpq-tech/keti/easyeditor/util/nethook.py
code served (permissive licence) · get_code("920b394e7ad80c53")
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 Sequential. 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
from collections import OrderedDict

torch.manual_seed(0)

# Create a nested Sequential model to test hierarchical_subsequence
layer1 = nn.Linear(4, 3)
layer2 = nn.Linear(3, 2)
layer3 = nn.Linear(2, 5)

nested_seq = nn.Sequential(
    OrderedDict([
        ('linear1', layer1),
        ('linear2', layer2),
        ('linear3', layer3)
    ])
)

# Test case 1: No parameters (should return full sequential)
ARGS = {
    'sequential': nested_seq,
    'first': None,
    'last': None,
    'after': None,
    'upto': None,
    'share_weights': False,
    'depth': 0
}
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 Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 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
preprocess Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/abalation_closellm.py
code served (permissive licence) · get_code("f85a4563ca4ff777")
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 torch

torch.manual_seed(0)

# Create a mock tokenizer with decode method
class MockTokenizer:
    def decode(self, token_ids):
        return f"decoded_text_{len(token_ids)}"

# Create mock logprobs tensors
logprobs_1 = torch.randn(20, 4)  # 20 top tokens, 4-dim logprobs
logprobs_2 = torch.randn(20, 4)

# Create tokens_log_probs: list of batches, each batch is list of items
tokens_log_probs = [
    [
        {'token_ids': [101], 'logprobs': logprobs_1},
        {'token_ids': [102], 'logprobs': logprobs_1},
        {'token_ids': [103], 'logprobs': logprobs_1},
    ],
    [
        {'token_ids': [201], 'logprobs': logprobs_2},
        {'token_ids': [202], 'logprobs': logprobs_2},
    ]
]

edited_llm_tokenizer = MockTokenizer()

token_num = 2

ARGS = {
    'tokens_log_probs': tokens_log_probs,
    'edited_llm_tokenizer': edited_llm_tokenizer,
    'token_num': token_num
}
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 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
preprocess Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/close_source_llms_main.py
code served (permissive licence) · get_code("5bd374a013b0e83b")
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 torch

torch.manual_seed(0)

class MockTokenizer:
    def decode(self, token_ids):
        return "".join([f"token_{tid}" for tid in token_ids])

# Create mock token log probs structure
# tokens_log_probs is a list of lists of dicts
# Each dict has 'token_ids' (list) and 'logprobs' (tensor)
tokens_log_probs = [
    [
        {
            'token_ids': [0],
            'logprobs': torch.randn(4)
        },
        {
            'token_ids': [1],
            'logprobs': torch.randn(4)
        }
    ],
    [
        {
            'token_ids': [2],
            'logprobs': torch.randn(4)
        },
        {
            'token_ids': [3],
            'logprobs': torch.randn(4)
        }
    ]
]

edited_llm_tokenizer = MockTokenizer()

ARGS = {
    'tokens_log_probs': tokens_log_probs,
    'edited_llm_tokenizer': edited_llm_tokenizer
}
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 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
recursive_copy Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/easyeditor/util/nethook.py
pointer only (licence: MIT); the stored copy get_code serves, from TrustedLLM/UnKE, is pointer only (licence: NONE) · get_code("70f6ab8bde55420e")
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 TrustedLLM/UnKE, 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.

subsequence Ran
ran; our contract draft was wrong, not the code
xpq-tech/keti/easyeditor/util/nethook.py
code served (permissive licence) · get_code("440ff98c2b1ae1aa")
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 Sequential. 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 copy
from collections import OrderedDict

torch.manual_seed(0)

# Build a nested Sequential model with multiple layers
sequential = nn.Sequential(
    OrderedDict([
        ('layer1', nn.Linear(4, 3)),
        ('layer2', nn.ReLU()),
        ('layer3', nn.Linear(3, 2)),
        ('nested', nn.Sequential(
            OrderedDict([
                ('sublayer1', nn.Linear(2, 2)),
                ('sublayer2', nn.ReLU()),
            ])
        )),
        ('layer4', nn.Linear(2, 1)),
    ])
)

ARGS = {
    'sequential': sequential,
    'first_layer': None,
    'last_layer': None,
    'after_layer': None,
    'upto_layer': None,
    'single_layer': None,
    'share_weights': False,
}
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 Sequential — a Sequential 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
get_features Not yet run
unverified (harvested, no recorded run)
xpq-tech/keti/extract_features.py
code served (permissive licence) · get_code("96c1f23ed670da04")
How it ran

no invocation recorded.

get_features_all_hs Not yet run
unverified (harvested, no recorded run)
xpq-tech/keti/extract_features.py
code served (permissive licence) · get_code("03ab176ee52a77ac")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 3 the same month, 3 later) and 6 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
subsequence 49 other papers
28 dated earlier, 1 the same month, 19 later, 1 same year, order not determinable
2007.15646 (2020-07)
Rewriting a Deep Generative Model
2009.05041 (2020-09)
Understanding the Role of Individual Units in a Deep Neural Network
2110.04292 (2021-10)
Toward a Visual Concept Vocabulary for GAN Latent Space
and 46 more not named here
recursive_copy 48 other papers
27 dated earlier, 1 the same month, 19 later, 1 same year, order not determinable
2207.02774 (2022-07)
Local Relighting of Real Scenes
2210.07229 (2022-10)
Mass-Editing Memory in a Transformer
2302.12461 (2023-02)
Analyzing And Editing Inner Mechanisms Of Backdoored Language Models
and 45 more not named here
hierarchical_subsequence 46 other papers
25 dated earlier, 1 the same month, 19 later, 1 same year, order not determinable
2210.07229 (2022-10)
Mass-Editing Memory in a Transformer
2302.12461 (2023-02)
Analyzing And Editing Inner Mechanisms Of Backdoored Language Models
2311.09053 (2023-11)
Assessing Knowledge Editing in Language Models via Relation Perspective
and 43 more not named here

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

Knowledge editing has emerged as an efficient technique for updating the knowledge of large language models (LLMs), attracting increasing attention in recent years. However, there is a lack of effective measures to prevent the malicious misuse of this technique, which could lead to harmful edits in LLMs. These malicious modifications could cause LLMs to generate toxic content, misleading users into inappropriate actions. In front of this risk, we introduce a new task, $\textbf{K}$nowledge $\textbf{E}$diting $\textbf{T}$ype $\textbf{I}$dentification (KETI), aimed at identifying different types of edits in LLMs, thereby providing timely alerts to users when encountering illicit edits. As part of this task, we propose KETIBench, which includes five types of harmful edits covering the most popular toxic types, as well as one benign factual edit. We develop five classical classification models and three BERT-based models as baseline identifiers for both open-source and closed-source LLMs. Our experimental results, across 92 trials involving four models and three knowledge editing methods, demonstrate that all eight baseline identifiers achieve decent identification performance, highlighting the feasibility of identifying malicious edits in LLMs. Additional analyses reveal that the performance of the identifiers is independent of the reliability of the knowledge editing methods and exhibits cross-domain generalization, enabling the identification of edits from unknown sources. All data and code are available in https://github.com/xpq-tech/KETI.

For agents

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

get_harvested_code_for_paper("2409.19663")
get_code_for_paper("2409.19663")
have("2409.19663")

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

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

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

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

Connect an agent — have() is free.