-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about the implemented LRP rules #4
Comments
Hey, Thanks for your interests in our work. I want to clarify that this repo contains unpublished and experimental results from us investigating how to make LRP with BERT better in terms of explaining model decisions for sequence classification task, since we thought LRP for BERT was not clearly defined back then (correct me if I was wrong). Since this is a while ago, I will need some times to recap on all my rationals on different tricks. I will try to get back to you as soon as possible. Sorry for any potential delays. Best, |
Hi! Sorry for taking me this long to go back to this, but here are a couple of thoughts on the questions posted above.
I tried to recollect my memories as much as I can, and hope these help! Thanks! |
Thank you for this great work.
Maybe you didn't realize it, Your implemented LRP rules are actually quite different than that has been proposed in this area.... based on my test, your implementation actually beat XAI SOTA algorithm published recently on some datasets...
That's said... while they work... I don't understand the intuition .... I would appreciate it if you can share some of insights.
First, The Linear alpha-beta rule: It looks like you implemented a modified version of alpha-beta rule
https://github.com/frankaging/BERT_LRP/blob/57f44c1bd7c1e3886110402652690b75e4ac0f67/code/util/lrp.py#L24-L44
The original alpha beta rule is in the following form:
$$R_j = \sum_{k} \alpha \frac{(a_j w_{jk})^+ }{\sum (a_j w_{jk})^+ } + \beta \frac{(a_j w_{jk})^- }{\sum (a_j w_{jk})^- } $$ .
And what you implemented is in the following form:
$$R_j = \sum_{k} \alpha \frac{a_j w_{jk}^+ }{\sum a_j w_{jk}^+ } + \beta \frac{a_j w_{jk}^- }{\sum a_j w_{jk}^- } $$ .
So the original rule preallocate alpha and beta portion of relevance towards positive and negative of (weight* input), while you allocate alpha and beta portion towards (pos_weight * input) and (neg_weight * input).
I don't understand the intuition behind this rule, because the input of linear layer in bert may not be strictly positive... so I don't understand why do we purely allocate a fixed portion of relevance to inputs based on the sign of associated weights.
Also, looking at how you are dealing with other layers, it seems you are directly using relevance multiplying the gradient of the layer's output to the input, for example, you did the skip connection as following:
https://github.com/frankaging/BERT_LRP/blob/57f44c1bd7c1e3886110402652690b75e4ac0f67/code/model/BERT.py#L647-L650
Can you share some insights what does this represent? I haven't seen anything like this before.....
It seems to me that you have done a lot of different tricks (these two above, the way you normalize the relevance after linear layer and how you force to take absolute value of relevance at the end despite the relevance are signed) that are quite different than what has been published in this area. To be honest, some of them don't make too much sense... but since they performs well on NLP tasks I've been testing... there must be things I don't understand/worth exploring
Have you tried these rules on other types of transformer (like VIT)? I adapted these rules on VIT...the result is not as good.. but maybe I made some mistakes in the code.. not sure.
Thanks
The text was updated successfully, but these errors were encountered: