EasyEdit: An Easy-to-Use Knowledge Editing Framework for LLMs

This repository profile is provided by osrepos.com, an open source repository discovery platform.

EasyEdit: An Easy-to-Use Knowledge Editing Framework for LLMs

Summary

EasyEdit is an open-source framework designed for efficient knowledge editing in Large Language Models (LLMs). It provides a unified, easy-to-use platform to modify, insert, or erase specific knowledge within LLMs without negatively impacting overall performance. This tool is crucial for aligning LLMs with evolving user needs and correcting factual inaccuracies.

Repository Information

Analyzed by OSRepos on January 26, 2026

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

EasyEdit is a powerful and user-friendly open-source framework developed by zjunlp, designed for knowledge editing in Large Language Models (LLMs). Presented at ACL 2024, EasyEdit addresses the critical need to efficiently update, insert, or erase specific knowledge within pre-trained LLMs. This is essential for correcting factual errors, mitigating biases, and adapting models to new information without undergoing extensive retraining. The framework offers a unified approach to various editing scenarios, methods, and evaluation metrics, making it a comprehensive solution for researchers and developers working with LLMs.

Installation

To get started with EasyEdit, ensure you have Python 3.9 or higher installed. Follow these steps for a quick setup:

git clone https://github.com/zjunlp/EasyEdit.git
conda create -n EasyEdit python=3.10
conda activate EasyEdit
pip install -r requirements.txt

Examples

EasyEdit is designed for modularity and flexibility, allowing users to easily integrate and apply editing methods. Here's a simplified example demonstrating how to use BaseEditor for factual knowledge editing:

Step 1: Define the PLM (Pre-trained Language Model) to be edited.

EasyEdit supports models like T5, GPT-J, GPT-NEO, and Llama, retrievable from HuggingFace. You configure the model in a YAML file (e.g., hparams/MEND/gpt2-xl.yaml).

model_name: gpt2-xl
model_class: GPT2LMHeadModel
tokenizer_class: GPT2Tokenizer
tokenizer_name: gpt2-xl
model_parallel: false # true for multi-GPU editing

Step 2: Choose the appropriate Knowledge Editing Method.

For instance, using the MEND method:

## In this case, we use MEND method, so you should import `MENDHyperParams`
from easyeditor import MENDHyperParams
## Loading config from hparams/MEMIT/gpt2-xl.yaml
hparams = MENDHyperParams.from_hparams('./hparams/MEND/gpt2-xl')

Step 3: Provide the edit descriptor and target.

Define the prompts you want to edit and their desired new outputs.

## edit descriptor: prompt that you want to edit
prompts = [
    'What university did Watts Humphrey attend?',
    'Which family does Ramalinaceae belong to',
    'What role does Denny Herzig play in football?'
]
## You can set `ground_truth` to None !!!(or set to original output)
ground_truth = ['Illinois Institute of Technology', 'Lecanorales', 'defender']
## edit target: expected output
target_new = ['University of Michigan', 'Lamiinae', 'winger']

Step 4: Initialize the BaseEditor.

EasyEdit provides a simple and unified way to init Editor, like huggingface: from_hparams.

## Construct Language Model Editor
from easyeditor import BaseEditor
editor = BaseEditor.from_hparams(hparams)

Step 5: (Optional) Provide data for evaluation.

You can include locality_inputs and portability_inputs to assess the broader impact of the edit.

locality_inputs = {
    'neighborhood':{
        'prompt': ['Joseph Fischhof, the', 'Larry Bird is a professional', 'In Forssa, they understand'],
        'ground_truth': ['piano', 'basketball', 'Finnish']
    }
}

Step 6: Perform the Edit and Evaluation.

The edit function will return metrics and the modified model.

metrics, edited_model, _ = editor.edit(
    prompts=prompts,
    ground_truth=ground_truth,
    target_new=target_new,
    locality_inputs=locality_inputs,
    sequential_edit=False # Set to True for continuous editing
)

For more hands-on experience, EasyEdit provides a handy Jupyter Notebook tutorial that demonstrates editing an LLM's knowledge about the US president.

Why Use EasyEdit

EasyEdit stands out as a comprehensive and efficient solution for knowledge editing in LLMs due to several key advantages:

  • Unified Framework: It integrates various editing scenarios (factual, multimodal, safety, personality) and techniques (e.g., ROME, MEMIT, SERAC, MEND) into a single, consistent interface.
  • Extensive Model Support: The framework supports a wide range of LLMs, from GPT series to Llama, Baichuan, ChatGLM, and more, including Large Multimodal Models (LMMs).
  • Robust Evaluation: EasyEdit provides a detailed evaluation suite with metrics like Reliability, Generalization, Locality, and Portability, ensuring thorough assessment of editing success and side effects.
  • Continuous Editing: It supports sequential editing, allowing for multiple knowledge updates while maintaining consistency.
  • Active Development & Community: The project is actively maintained, with frequent updates, new methods, and datasets being integrated, fostering a vibrant community.
  • Detailed Documentation & Tutorials: With comprehensive READMEs, beginner's guides, and Jupyter Notebook tutorials, getting started and exploring advanced features is straightforward.

Links

Related repositories

Similar repositories that may be relevant next.

claude-mem: Persistent Context Across Sessions for AI Agents

claude-mem: Persistent Context Across Sessions for AI Agents

May 20, 2026

claude-mem is an innovative GitHub repository designed to provide persistent context across sessions for various AI agents. It intelligently captures agent activities, compresses them using AI, and injects relevant information into future interactions. This powerful tool supports a wide range of AI platforms, including Claude Code, OpenClaw, Gemini, and Copilot.

ai-agentspersistent-memoryclaude-code
AutoGen: A Programming Framework for Agentic AI

AutoGen: A Programming Framework for Agentic AI

March 30, 2026

AutoGen is a versatile programming framework from Microsoft designed for building multi-agent AI applications. It empowers AI agents to operate autonomously or collaborate seamlessly with human users, streamlining the execution of complex tasks. The framework offers a layered, extensible design, providing both high-level APIs for rapid prototyping and low-level components for fine-grained control.

agentic-aimulti-agentllm-framework
FastRTC: Real-Time Communication Library for Python Functions

FastRTC: Real-Time Communication Library for Python Functions

January 15, 2026

FastRTC is a powerful Python library designed for real-time communication, enabling developers to transform any Python function into an audio and video stream over WebRTC or WebSockets. It simplifies the creation of interactive, real-time applications, particularly in the AI domain, by handling complex streaming logistics. This library offers robust features for building conversational AI, live video analysis, and more.

pythonreal-timewebrtc
Agentless: An Agentless Approach to Solve Software Development Problems

Agentless: An Agentless Approach to Solve Software Development Problems

December 23, 2025

Agentless is an innovative open-source project that offers an agentless approach to automatically solve software development problems. It streamlines the bug-fixing process through localization, repair, and patch validation phases. This tool aims to enhance efficiency in addressing software issues, particularly demonstrated by its performance on benchmarks like SWE-bench lite.

agentartificial-intelligencellm

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️