LoRA icon indicating copy to clipboard operation
LoRA copied to clipboard

How to optimize B, which is the all zero matrix in the Lora method?

Open Sauloo-huen opened this issue 1 year ago • 5 comments

Sauloo-huen avatar Apr 19 '23 14:04 Sauloo-huen

Thanks for the question! You can optimize B as usual, e.g., with Adam, since it will get a non-zero gradient in general.

edwardjhu avatar Apr 25 '23 21:04 edwardjhu

Isn't it the case that all rows of the B matrix are linearly dependent, making it effectively a rank 1 matrix. Could it be simply reduced to a product of two vectors?

Edit: Nevermind. I went through the gradient update equations again and it seems like this should not happen as long as other weights of the network are initialized randomly.

pkubik avatar May 11 '23 17:05 pkubik

I have the same problem. When I perform gradient backpropagation, the weight of A can be updated, but the weight of B is always 0. Please tell me how should I solve this problem? Thank you!

liuhui0401 avatar Nov 03 '23 03:11 liuhui0401

I have the same problem. When I perform gradient backpropagation, the weight of A can be updated, but the weight of B is always 0. Please tell me how should I solve this problem? Thank you!

I met the same problem, have u solved it?

dreamerlin avatar Nov 21 '23 15:11 dreamerlin

This shouldn't happen. Can you elaborate on your setup?

edwardjhu avatar Nov 21 '23 20:11 edwardjhu