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

The position id for q #60

Open
ofhwei opened this issue Oct 30, 2023 · 2 comments
Open

The position id for q #60

ofhwei opened this issue Oct 30, 2023 · 2 comments

Comments

@ofhwei
Copy link

ofhwei commented Oct 30, 2023

Hello,

I wonder if the position id of query is the same with key or is the actual generated context length (this comment is confusing me)?
For example, as mentioned in the toy example, the position id for key of M is 9. What's the position id for q of M? 9 or 12 here? And more , why make this choice?

Looking forward to your response. Thank you.

@Guangxuan-Xiao
Copy link
Collaborator

We also apply position in the cache to query instead of the position in the actual text. In the toy example, the position ID for the query is also 9. This is because we want to limit position encoding used within the cache size so we can generate text much longer than the pre-training window.

Guangxuan

@helunwencser
Copy link

@Guangxuan-Xiao, thanks for replying here. However, the code seems to be different here. I see that query_states is encoded with position_ids while key_states is encoded with key_position_ids, which is the position in cache. Could you please elaborate more? Thank you!

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

3 participants