Knowledge Editing › Scaling to many edits: MEMIT

Michael BrenndoerferDecember 1, 20263 min read
Language AI HandbookAll chapters
Part 45 of 67Knowledge, Memory, Editing, and Unlearning
Chapter 347Knowledge Editing › Scaling to many edits: MEMIT
Reading section 4 of 11 · Scaling to many edits: MEMIT · 3 minSection 4 of 11 · 3 min

Section 4 of 11 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

An edit that satisfies its target on one step can alter a target written earlier. Each later update's input-side direction can have a nonzero projection on the earlier key. Contributions to an unrelated output add as vectors, which can reinforce or cancel each other. The final effect depends on the edit order and the key distribution. Joint fitting provides one way to account for competing requests directly instead of treating the earlier target as fixed automatically.

MEMIT, Mass-Editing Memory in a Transformer, fits a batch of associations using the same linear associative-memory perspective. The layer-wise objective balances matching the requested values and preserving older associations. It uses a least-squares objective rather than requiring each new association to be satisfied exactly. Requests can conflict, for instance when two of them specify distinct values for the same key.

For one layer, let the new keys be columns of KK, their targets columns of VV, and the residual matrix R=V−WKR=V-WK. The preservation weight C0C_0 represents the uncentered second moment of older keys, scaled relative to the new associations. A convenient form is

min⁡Δ[∥ΔK−R∥F2+tr⁡(ΔC0Δ⊤)].\min_{\Delta}\left[\|\Delta K-R\|_F^2+\operatorname{tr}(\Delta C_0\Delta^\top)\right].

The first term penalizes missing the new targets. The second penalizes moving outputs on older keys. The normal equation is Δ(C0+KK⊤)=RK⊤\Delta(C_0+KK^\top)=RK^\top. When its right factor is invertible, the solution is

Δ=RK⊤(C0+KK⊤)−1.\Delta=RK^\top(C_0+KK^\top)^{-1}.

The choice C0=λIC_0=\lambda I gives ordinary ridge, while MEMIT estimates the old-key second moment, scaled to control the preservation weight. With a single new key and a fixed positive-definite preservation matrix, the soft batch fit approaches the exact rank-one solution as the weight on the new association grows. At finite weight the objectives differ. In particular, KK⊤KK^\top can be singular for one key, so dropping regularization and treating that matrix as invertible is invalid in general. One way to see the limit is to weight the one-key squared error by a positive factor aa. Writing rr for the requested displacement, stationarity gives Δ(C0+akk⊤)=ark⊤\Delta(C_0+a k k^\top)=a r k^\top. Set b=C0−1kb=C_0^{-1}k. Then b⊤(C0+akk⊤)=(1+ak⊤b)k⊤b^\top(C_0+a k k^\top)=(1+a k^\top b)k^\top, so

Δ=arb⊤1+ak⊤b=rb⊤1/a+k⊤b.\Delta=\frac{a r b^\top}{1+a k^\top b} =\frac{r b^\top}{1/a+k^\top b}.

For a nonzero key, k⊤b>0k^\top b>0. As aa grows, 1/a1/a tends to zero and Δk\Delta k tends to rr, recovering the constrained update.

In the model implementation, MEMIT distributes residual targets across a range of MLP layers and recomputes activations after updates. The original paper demonstrates editing thousands of associations on GPT-J and GPT-NeoX. That result is specific to its evaluated models, prompts and metrics. The sequential experiment below uses a single toy projection; it illustrates one source of interference but does not implement or benchmark MEMIT.

Fine-tuning with a preservation penalty gives another comparison. A KL term can discourage changes to the original predictive distribution on reference prompts while a likelihood term fits the edit. The strength of that discouragement depends on which prompts you preserve and the chosen penalty weight. In this chapter the executable comparison is between a direct rank-one edit and a memory wrapper. It supplies no empirical comparison with a KL-regularized optimizer.

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