zjunlp / EasyEdit

[ACL 2024] An Easy-to-use Knowledge Editing Framework for LLMs.
https://zjunlp.github.io/project/KnowEdit
MIT License
1.77k stars 213 forks source link

Question about MEMIT and PMET in editing Llama. #236

Closed Lut-hub closed 4 months ago

Lut-hub commented 4 months ago

Hi,

First of all, thank you very much for providing an excellent toolkit for knowledge editing.

However I have a problem with editing Llama using MEMIT and PMET.

I use the default parameters. When I pick batchsize=1, after about 450 edits, the probability of the output becomes very small, no matter how much I optimize the model:

PMET request sample: [What is the cause of death of Crowfoot?] -> [ tetanus]
Computing right vector (v)
Lookup index found: 9 | Sentence: What is the cause of death of Crowfoot?<s> tet | Token: foot
Rewrite layer is 8
Tying optimization objective to 31
Recording initial value of v* in attn
Recording initial value of v* in mlp
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + -0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08
loss 20.572 = 20.572 + 0.0 + 0.0 avg prob of [ tetanus] 4.66106939711608e-08

I tried hard to find out the reason, but I failed. So I would like to ask if you have encountered this during the editing process? Thanks!

pengzju commented 4 months ago

Thank you for your interest. 😊

Lut-hub commented 4 months ago

Thank you for your prompt response!

Yes, I use keep_original_weight=False to edit Llama2-7b.

It may be that MEMIT itself performs poorly in this setting.

Does this mean that MEMIT may not work properly with batch size = 1 when applied to sequential editing? When I use the same settings with ROME, even after 1k edits the final probability still could be around 0.98. This phenomenon confuses me.

Thank you once again for your assistance and for sharing your knowledge. 🙂

pengzju commented 4 months ago

I'm equally confused about your phenomenon, but I have some superficial understanding for your reference.

Hope this helps, thank you~

Lut-hub commented 4 months ago

Thank you very much! 😃