EasyEdit2: Real-Time LLM Steering Framework by Zhejiang University Team 138

小编 ·

EasyEdit2: Real-Time LLM Steering Framework by Zhejiang University Team

EasyEdit2 is a user-friendly LLM steering framework developed by a team at Zhejiang University. Unlike EasyEdit, it can steer large language models in real time during inference via pluggable steering vectors—enabling training-free test-time control with adjustable, composable behavior for safety, sentiment, persona, and more. Its architecture comprises four core modules: dataset, method, vector store, and evaluation, used through four steps: prepare training data, generate steering vectors, apply to model, and verify results.

EasyEdit2: Real-Time LLM Steering Framework by Zhejiang University Team

What is EasyEdit2?

EasyEdit2 is an easy-to-use LLM editing and steering framework developed by a team at Zhejiang University. Unlike EasyEdit, it can steer large language models in real time during inference, achieving test-time control through pluggable steering vectors without the need for training. It offers adjustability and composability, and can be applied to various scenarios such as safety, emotion, and personality. Its architecture consists of four core components: a dataset, methods, a vector store, and an evaluation module. Usage follows four steps: preparing training data, generating steering vectors, applying them to the model, and validating the results.

EasyEdit2:A real-time LLM editing and steering framework developed by the Zhejiang University team.webp

Features

  • Real-time control: EasyEdit2 achieves real-time, training-free control during the model inference stage through pluggable steering vectors.

  • Plug-and-play: Users can seamlessly apply or remove steering methods without modifying model weights.

  • Ease of use: Users do not need a deep technical background; just one example is enough to effectively guide and adjust model responses.

  • Adjustability and composability: Users can precisely adjust the intensity and direction of interventions and combine multiple steering techniques for fine-grained control.

  • Diverse application scenarios: Supports multiple test-time intervention functions covering safety, emotional tendency, personality traits, reasoning patterns, factual accuracy, and language characteristics.

Core Modules

  • Steering Vector Generator: Automatically generates steering vectors used to influence model behavior.

  • Steering Vector Applier: Applies the generated steering vectors to the model to adjust its behavior.

EasyEdit2:A real-time LLM editing and steering framework developed by the Zhejiang University team.webp

Application Scenarios

  • Safety: Defend against jailbreak attacks, reduce social bias, and lower the risk of privacy leakage.

  • Emotional tendency: Control the emotional tone of model output, shifting it from negative to positive.

  • Personality traits: Customize the model's personality.

  • Reasoning patterns: Intervene in the reasoning process to prevent overthinking.

  • Factual accuracy: Update the model's knowledge to keep it current.

  • Language characteristics: Customize language style to meet specific needs.

How to Use

  1. Prepare training data, such as defining the training dataset and generation dataset.

  2. Use BaseVectorGenerator to generate steering vectors.

  3. Apply the vectors to the model via BaseVectorApplier and generate the steered output.

  4. Validate the output of the steered model; the model can be reset after use.

EasyEdit2:A real-time LLM editing and steering framework developed by the Zhejiang University team.webp

FAQ

Q: What is the main difference between EasyEdit2 and EasyEdit?

A: EasyEdit performs knowledge editing by updating internal parameters or introducing additional parameters, while EasyEdit2 can steer large language models in real time during inference without retraining, achieving multiple control functions through pluggable steering vectors.

Q: How does EasyEdit2 enable multi-scenario applications for large language models?

A: EasyEdit2 leverages its adjustability and composability to tailor the model for different scenario needs by controlling intervention intensity and combining multiple steering techniques. For example, it strengthens safety in security scenarios and adjusts model emotions in emotional scenarios.

Q: Which core classes and configuration files are involved when using EasyEdit2?

A: Two core classes, BaseVectorGenerator and BaseVectorApplier, are involved during use, used to generate and apply steering vectors respectively. Configuration files are also involved, such as loading configurations using OmegaConf.load('./hparams/Steer/config.yaml').

Related Links

Project page: https://zjunlp.github.io/project/EasyEdit2

GitHub repository: https://github.com/zjunlp/EasyEdit

arXiv: https://arxiv.org/abs/2504.15133

Hugging Face: https://huggingface.co/papers/2504.15133