Back to Blog
Research

CleanEdit: Retention-Aware Pruning & Bounded Replay for lifelong model editing

CleanEdit redefines lifelong model editing through retention-aware pruning and bounded replay, enabling AI systems to adapt continuously while preserving what truly matters.

👨‍🎓

Marcus Rodriguez

Head of Research

October 28, 2025
12 min read

CleanEdit: Making Lifelong Model Editing Stable and Sustainable

1. The Promise and Peril of Lifelong Model Editing

Imagine deploying a large language model to answer legal questions or assist in research. The world changes, new facts emerge, and the model makes mistakes[1][2]. Lifelong Model Editing (LME) promises a solution[3]: continuously updating the model after deployment without expensive full retraining. Techniques like GRACE[4] augment the model with an external "edit memory" that stores corrections, activating them when similar queries arise.

However, this solution introduces a new problem: memory pollution. Imagine your AI model as a growing mind and each correction is a memory, but without discipline, memory turns into noise. As thousands of edits accumulate, the memory becomes clogged with redundant, conflicting, or even harmful entries. This leads to:

  • Performance decay - the model starts to forget its original knowledge or becomes unstable
  • Increased inference costs

The very tool designed to keep the model accurate becomes a source of instability, making long-term deployment a significant challenge.

2. CleanEdit: A New Paradigm of Active Memory Management

Instead of treating the edit memory as a passive log, our work, "CleanEdit: Retention-Aware Pruning and Bounded Replay for Lifelong Model Editing" introduces a new paradigm: active memory curation. CleanEdit is a lightweight, self-maintaining layer that works on top of existing memory-based editors like GRACE[4].

Its core idea is simple yet powerful: proactively diagnose and remove harmful edits while preserving valuable knowledge. How does it achieve this? Through two synergistic mechanisms as shown in Figure 1:

Retention-Aware Pruning

CleanEdit continuously monitors each edit in the memory. Each edit's contribution is evaluated by estimating its counterfactual harm, which means how much worse the model would perform if that edit were removed. A statistically grounded test with sequential hypothesis testing then decides whether the edit should be pruned.

Bounded Replay

Pruning an edit doesn't mean its underlying lesson is worthless. CleanEdit recycles the original correction signal. If the model still gets the pruned edit wrong, the example is placed into a bounded replay queue. The model then relearns from these challenging samples, preventing knowledge gaps without allowing the memory to grow indefinitely.

Analogy: Retention-Aware Pruning can be viewed as the forgetting mechanism of brain where we discard outdated memories to make room for new ones, while Bounded Replay acts like spaced revision, revisiting difficult examples to reinforce learning.

Figure 1: Overall structure of CleanEdit. A lifelong model-editing adaptor provides key-value retrieval. CleanEdit adds a self-maintaining layer with three components: per-key evidence via counterfactual or metric-anchored harm, anytime pruning with explicit control, and bounded recycling with event/period scheduling.

3. Adapting to Real-World Needs with Flexible Scheduling

Because every system learns at a different pace, CleanEdit adapts its rhythm. Different applications have different constraints and CleanEdit introduces three scheduling modes to adapt to various deployment scenarios:

  • Comprehensive Mode: Triggers maintenance at regular intervals. Ideal for settings with predictable workloads and a strong emphasis on edit reliability.
  • Progressive Mode: Aligns maintenance with natural data boundaries (e.g., the end of a day or a batch of inputs). Provides maximum stability for batched processing.
  • Dynamic Mode: Reactively triggers maintenance only when performance metrics (like accuracy on a holdout set) drop below a threshold. Perfect for mission-critical systems where reliability must be guaranteed at all times.

4. Key Results: Significant Gains in Stability and Performance

We evaluated CleanEdit on challenging sequential editing benchmarks as shown in Table 1: Document Classification (SCOTUS[5] datasets) and Question Answering (zsRE[6] datasets). The results are compelling. CleanEdit consistently achieves a superior balance between retaining past knowledge (Test Retention Rate, TRR) and remembering new edits (Edit Retention Rate, ERR)[7].

For example, on the SCOTUS legal document classification task, CleanEdit's Comprehensive mode achieved ERR of 1.00 while significantly boosting TRR to 0.85, an 11% absolute improvement in the balanced average score over the strong GRACE baseline. The Dynamic mode further improved TRR to 0.87 while maintaining a high ERR of 0.94. This demonstrates CleanEdit's ability to enhance generalization without sacrificing the fidelity of past edits.

Table 1: Main results on SCOTUS (Document Classification) and zsRE (QA). Abbreviations of scheduling modes: C = Comprehensive, P = Progressive, D = Dynamic. Thresholds selected on validation and frozen for test: C/D use α=20, P uses α25. ΔAvg is the absolute gain over GRACE on the same task. Best per column in bold.

Classification (SCOTUS) QA (zsRE/NQ)
Method TRR ERR Avg. ΔAvg Method TRR ERR Avg. ΔAvg
FT (Lin et al., 2022) .52 .52 .52 FT .56 .82 .69
FT+EWC (Kirkpatrick et al., 2016) .67 .50 .58 FT+EWC .51 .82 .66
FT+Retrain (Rolnick et al., 2019) .67 .83 .75 FT+Retrain .27 .99 .63
MEND (Mitchell et al., 2022a) .19 .27 .23 MEND .25 .27 .26
Defer (Mitchell et al., 2022b) .33 .41 .37 Defer .72 .31 .52
Memory .21 .20 .21 Memory .25 .27 .26
GRACE (Hartvigsen et al., 2023) .81 .82 .82 GRACE .69 .96 .82
CleanEdit(ours)
C (α=20) .85 1.00 .93 +11% C (α=20) .83 .99 .91 +9%
P (α=25) .82 .95 .89 +7% P (α=25) .83 .93 .88 +6%
D (α=20) .87 .94 .91 +9% D (α=20) .83 1.00 .91 +9%

5. Conclusion and Future Directions

Lifelong model editing is crucial for sustainable AI systems. CleanEdit addresses its fundamental instability by imagining the edit memory not as a static log, but as a dynamic, self-curating resource.

By proactively pruning harmful entries and replaying valuable corrections, CleanEdit enables models to adapt reliably over long horizons. This work opens several exciting directions, such as extending CleanEdit to more complex tasks and developing adaptive thresholds for non-stationary environments.

CleanEdit moves us one step closer to sustainable intelligence which not only learn, but also remember wisely.

We are excited to share our work with the community and welcome feedback.

References

[1] Thomas Hartvigsen, Saadia Gabriel, Hamid Palangi, Maarten Sap, Dipankar Ray, and Ece Kamar. Toxigen: A large-scale machine-generated dataset for adversarial and implicit hate speech detection. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics, pages 3309–3326, 2022.

[2] De Cao, Nicola, Wilker Aziz, and Ivan Titov. "Editing factual knowledge in language models." In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 6491–6506, 2021.

[3] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.

[4] Hartvigsen Tom, Swami Sankaranarayanan, Hamid Palangi, Yoon Kim, Marzyeh Ghassemi. "Aging with grace: Lifelong model editing with discrete key-value adaptors." Advances in Neural Information Processing Systems, 36 (2023): 47934-47959.

[5] Ilias Chalkidis, Tommaso Pasini, Sheng Zhang, Letizia Tomada, Sebastian Felix Schwemer, and Anders Søgaard. Fairlex: A multilingual benchmark for evaluating fairness in legal text processing. arXiv preprint arXiv:2203.07228, 2022.

[6] Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pages 333–342, 2017.

[7] Zeyu Huang, Yikang Shen, Xiaofeng Zhang, Jie Zhou, Wenge Rong, and Zhang Xiong. Transformer-patcher: One mistake worth one neuron. In International Conference on Learning Representations, 2023.

Tags:Lifelong LearningModel EditingMemory ManagementContinual LearningCleanEditResearch