SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.08164 · EMNLP · 2021

Editing Factual Knowledge in Language Models

Wilker Aziz, Nicola De Cao, Ivan Titov

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 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 0 have no contract verdict; 3 failures of our instrument; 0 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/2104.08164.json · badge: /api/ran/2104.08164.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
nicola-decao/KnowledgeEditor canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
FunctionStatusWhere it lives
chunk_it Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
nicola-decao/KnowledgeEditor/src/utils.py
code served (permissive licence) · get_code("3f4963e78e50be03")
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 torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - seq: needs len() and slicing with integers
# - num: integer > 0
# The function chunks a sequence into num parts

# Create a simple sequence that works with len() and slicing
seq = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
num = 3

ARGS = {
    "seq": seq,
    "num": num
}
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 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
label_smoothed_nll_loss Ran
ran; our contract draft was wrong, not the code
nicola-decao/KnowledgeEditor/src/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from beepkh/unike, is pointer only (licence: NONE) · get_code("96b6713ff1c322ca")
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 beepkh/unike, 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.

normalize Ran
ran; our contract draft was wrong, not the code
nicola-decao/KnowledgeEditor/src/utils.py
code served (permissive licence) · get_code("23d3acf0aced66d5")
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 str. 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 string

def normalize(sent):
    return sent.lower().replace(' ', '').translate(str.maketrans('', '', string.punctuation))

ARGS = {
    'sent': "Hello, World! This is a test."
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 0 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
label_smoothed_nll_loss 7 other papers
7 later
2109.03792 (2021-09)
Highly Parallel Autoregressive Entity Linking with Discriminative Correction
2210.05144 (2022-10)
Mixture of Attention Heads: Selecting Attention Heads Per Token
2023.findings-emnlp.978 (2023 (year only))
Incorporating Probing Signals into Multimodal Machine Translation via Visual Question-Answering Pairs
and 4 more not named here
chunk_it 3 other papers
3 later
2022.naacl-main.342 (2022 (year only))
GenIE: Generative Information Extraction
2403.07350 (2024-03)
VLKEB: A Large Vision-Language Model Knowledge Editing Benchmark
2502.19870 (2025-02)
MMKE-Bench: A Multimodal Editing Benchmark for Diverse Visual Knowledge
normalize 2 other papers
2 later
2403.07350 (2024-03)
VLKEB: A Large Vision-Language Model Knowledge Editing Benchmark
2502.19870 (2025-02)
MMKE-Bench: A Multimodal Editing Benchmark for Diverse Visual Knowledge

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

The factual knowledge acquired during pretraining and stored in the parameters of Language Models (LMs) can be useful in downstream tasks (e.g., question answering or textual inference). However, some facts can be incorrectly induced or become obsolete over time. We present KNOWLEDGEEDITOR, a method which can be used to edit this knowledge and, thus, fix 'bugs' or unexpected predictions without the need for expensive retraining or fine-tuning. Besides being computationally efficient, KNOWLEDGEEDITOR does not require any modifications in LM pretraining (e.g., the use of meta-learning). In our approach, we train a hyper-network with constrained optimization to modify a fact without affecting the rest of the knowledge; the trained hyper-network is then used to predict the weight update at test time. We show KNOWL-EDGEEDITOR's efficacy with two popular architectures and knowledge-intensive tasks: i) a BERT model fine-tuned for fact-checking, and ii) a sequence-to-sequence BART model for question answering. With our method, changing a prediction on the specific wording of a query tends to result in a consistent change in predictions also for its paraphrases. We show that this can be further encouraged by exploiting (e.g., automatically-generated) paraphrases during training. Interestingly, our hyper-network can be regarded as a 'probe' revealing which components need to be changed to manipulate factual knowledge; our analysis shows that the updates tend to be concentrated on a small subset of components. 1 How is Namibia's capital city called? Semantically equivalent Answers Scores Namibia Nigeria Nibia Namibia Tasman -0.43 -0.69 -0.89 -1.08 -1.19 What is the capital of Namibia? Answers Scores Namibia Nigeria Nibia Tasman Namibia -0.32 -0.79 -0.87 -1.14 -1.16 What is the capital of Russia? Answers Scores Moscow Nashville Ufa Kiev Nashua -0.55 -0.97 -1.22 -1.28 -2.09 Another fact (a) Model predictions before the update. Fact to change Fact that also changes How is Namibia's capital city called? Answers Scores Windhoek Tasman Windygates Tasmania Windhoof -0.06 -1.42 -1.52 -1.59 -1.66 What is the capital of Namibia? Answers Scores Windhoek Tasman Windygates Windhoof Tasmania -0.07 -1.50 -1.51 -1.53 -1.53 What is the capital of Russia? Answers Scores Moscow Ufa Nashville Kiev Nashua -0.56 -1.03 -1.04 -1.43 -2.21 Another fact (b) Model predictions with edited parameters. Figure 2: Predictions from a pre-trained language BART model fine-tuned for closed-book question answering. Left: model top-k predictions from Beam Search. Right: top-k after using our method conditioning on changing 'What is the capital of Namibia?' from 'Namibia' (wrong) to 'Windhoek' (correct prediction). Changing one fact also changes a semantically equivalent question and keeps the predictions from other facts the same.

For agents

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

get_harvested_code_for_paper("2104.08164")
get_code_for_paper("2104.08164")
have("2104.08164")

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

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

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

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

Connect an agent — have() is free.