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

Can AQT be used to calculate qk score? #514

Open
Lisennlp opened this issue Mar 4, 2024 · 2 comments
Open

Can AQT be used to calculate qk score? #514

Lisennlp opened this issue Mar 4, 2024 · 2 comments

Comments

@Lisennlp
Copy link

Lisennlp commented Mar 4, 2024

I see that the sample codes all talk about Attention block or MLP block. Can aqt int8 only be used for parts involving parameter calculation? For example, qk score calculation, score * V calculation, can these be used aqt int8?

@lukaszlew
Copy link
Collaborator

Yeah it can. All Einsums/DotGeneral can be quantized.
For more advanced cases (cache), one has to use QTensor and Quantizer.quant directly. We don't have an example in docs or mini-model for that at the moment.

@Lisennlp
Copy link
Author

Lisennlp commented Mar 6, 2024

But strangely, when I used AQT INT8 for Q * K and score * V, it was slower.

`

eqn = "BTNH,BSNH->BNTS"

dot_general = aqt_utils.DenseGeneral(quant=self.quant)

logits = dot_general(eqn, query, key)`

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