Knowledge Editing › What "editing" has to mean

Michael BrenndoerferDecember 1, 20267 min read
Language AI HandbookAll chapters
Part 45 of 67Knowledge, Memory, Editing, and Unlearning
Chapter 347Knowledge Editing › What "editing" has to mean
Reading section 2 of 11 · What "editing" has to mean · 7 minSection 2 of 11 · 7 min

Section 2 of 11 · 7 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

An edit needs a target and a scope. The CounterFact study distinguishes efficacy, paraphrase performance, and neighborhood specificity. The KnowEdit study also evaluates portability and broader capabilities. These studies use specific datasets and scoring rules. A direct-generation check and a comparison of two answer probabilities can give different results on the same prompt, so record which test you used before making comparisons.

The four editing desiderata

For an edit that should change a model's answer from an old value o⋆o^\star to a new value n⋆n^\star for a subject ss and relation rr (a fact triple (s,r,n⋆)(s, r, n^\star)):

  • Reliability (efficacy) measures success on direct edit prompts. For example, test whether the model returns n⋆n^\star when asked for the new value of rr for ss.
  • Generalization measures success on other phrasings of the same question, held out from editing. You can change the wording while fixing the requested entity, relation and target answer.
  • Specificity (locality) measures preservation outside the intended edit scope, including related subjects and other relations of the same subject.
  • Portability measures consequences that should change. If a company moves its headquarters to a new country, a question about the currency used at headquarters may require the updated country and a second fact about its currency.

Each measure catches a different failure. An edit that works only on the literal training prompt looks good on direct reliability and fails the paraphrase set. An edit that works on the target and paraphrases can still offer the new value in contexts that should remain unchanged. Both can pass their local tests while a composed query still uses an old intermediate answer. Choose the expected answers for each group before the experiment. A question that checks an entailed consequence should be in the group that must change even if it looks unlike the edit prompt, while a semantically similar question about a different entity can still belong among the controls.

Two further checks concern preservation and cost. To look for broader capability loss, use separate tasks such as grammar or arithmetic and compare against the original checkpoint under the same evaluation. To measure efficiency, report which part of the job you timed, whether the editor needed training, and how performance changes with a growing edit queue. Comparing methods on the same prompts and settings is more informative than comparing isolated success rates. A reliability number by itself leaves all the other outcomes open. A useful test plan also fixes how answers are judged. For example, a direct edit can be measured by which of two candidate answers has higher probability or by a match against an actual generated answer. The first test compares two options, and the second depends on the model’s decoding rules. Record the chosen protocol so that changing the decoder does not silently change the evaluation.

At a single linear projection, different subject inputs can have overlapping keys. A weight change is applied when multiplying any key by that matrix, so the same change can move both the target and other outputs. The overlap between the update's input direction and the control key determines how much the control moves. The next toy generates twelve nonzero vectors from eight shared factors and normalizes each to unit length. It deliberately creates overlap instead of assuming twelve orthogonal slots.

The heatmap shows pairwise cosine similarity for these keys. A key has cosine one with itself. Off-diagonal entries can be positive or negative, and entries near zero identify nearly orthogonal pairs. Key similarity helps explain why a simple edit can have side effects, though the exact side effect also depends on which direction the editor writes in.

PythonIn [3]
CollapseExpand
from copy import deepcopy

import numpy as np
import torch
from torch import nn
from torch.nn import functional as F

SEED = 0
D_KEY = 64
D_VAL = 32
N_FACTS = 200
PythonIn [4]
CollapseExpand
rng = torch.Generator().manual_seed(SEED + 3)
n_dirs = 12
factor_dirs = torch.randn(n_dirs, 8, generator=rng)
fact_dirs = factor_dirs @ torch.randn(8, D_KEY, generator=rng)
fact_dirs_unit = F.normalize(fact_dirs, dim=1)
similarity_matrix = (fact_dirs_unit @ fact_dirs_unit.T).numpy()
VisualizationOut [5]
CollapseExpand
Square heatmap with a bright diagonal for self-similarity and a range of positive and negative off-diagonal similarities.
Pairwise cosine similarities among twelve synthetic key directions generated from eight factors. Each key has cosine one with itself. The off-diagonal entries show how much the sampled keys overlap.

Overlap is only one diagnostic. A rank-one change writes along a particular input direction and sends the resulting scalar to an output direction. Two keys with large mutual cosine can respond differently if their projections on the write direction differ. Conversely, an apparently unrelated key can still move if it has a large projection on that direction. In the following sections the preservation set supplies a model for which such movements are costly. It does not decide which natural-language facts count as unrelated.

What fine-tuning can change

A fine-tuning baseline can minimize negative log likelihood of the new answer on the original prompt. This objective specifies how well the model should fit one example. It includes no separate preservation term unless we add one. Which other outputs move depends on the parameters trained and the relationships among inputs. The original ROME study compared fine-tuning with and without a parameter norm constraint, as well as other editing baselines. The preservation check tells you where either baseline changed behavior beyond the target.

Check both the set of weights being updated and the stopping rule when comparing a direct edit with fine-tuning. Training more steps on one phrasing can improve the objective on that prompt without improving held-out phrasing or preserving another fact. The closer controls are useful here. Testing only unrelated random topics can miss changes to the same relation of a neighboring subject, while merely checking parameter distance can miss a large output effect in a sensitive direction.

Meng et al. traced contributions to factual predictions in GPT models. In their measured cases, restoring activations at the final subject token in mid-layer feed-forward modules could recover part of the original prediction. They use this result to motivate treating the MLP's input-side activations as keys and its output projection as a map from those keys to values. The experiment does not prove every fact resides in a dedicated layer or that the same location is appropriate for each architecture.

Causal tracing compares a clean prompt, a corrupted run, and a run in which selected activations are restored to clean-run values while the input remains corrupted. The comparison measures how the restoration changes the model's confidence in the original answer. It is an intervention on a computation, and the result depends on the prompt, corruption and restoration site. Hase et al. reported that tracing scores failed to identify the best override layer in their main editing setup. Localization of a response and effectiveness of a persistent write are separate tests.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy