Skip to content
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

Is YOSO adap to attention with bias #1

Open
etrigger opened this issue Mar 14, 2022 · 1 comment
Open

Is YOSO adap to attention with bias #1

etrigger opened this issue Mar 14, 2022 · 1 comment

Comments

@etrigger
Copy link

If the self-attention containes some bias, e.g. (Q*K+bias_1+bias_2)*V, can we still aplly YOSO or Nystromformer to speed up the computation? If we can still do it, can you give me some hit on how to deal with this case?

@mlpen
Copy link
Owner

mlpen commented Mar 17, 2022

I assume that you meant softmax(Q*K+bias_1+bias_2)*V, otherwise you can compute it using distributive law. Then, one approach you can do is constructing a new set of Q' and K': Q' = [Q, bias_1, bias_2] and K' = [K, 1, 1] such that Q'K' = QK+bias_1+bias_2. Next, regular attention approximation can be applied to the new Q' and K'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants