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

llama : try to avoid context swap #2060

Closed
ggerganov opened this issue Jun 30, 2023 · 2 comments · Fixed by #3228
Closed

llama : try to avoid context swap #2060

ggerganov opened this issue Jun 30, 2023 · 2 comments · Fixed by #3228
Labels
performance Speed related topics research 🔬

Comments

@ggerganov
Copy link
Owner

Currently, when the context becomes full, we pick part of the tokens and recompute the KV cache.

Instead, try to either:

  • store non-RoPEd KV cache, "shift" it when the context is full and compute the RoPE over the entire cache for every new token taking into account the current positions
  • store RoPEd KV cache (as we do now), "shift" it when the context is full and apply extra shift-RoPE on it (assuming RoPE is "additive")
@SlyEcho
Copy link
Collaborator

SlyEcho commented Jul 2, 2023

Maybe it could also be compressed using interpolation?

@cebtenzzre
Copy link
Collaborator

Storing non-RoPEd KV cache would allow us to implement dynamic NTK or YaRN RoPE scaling, which is the state-of-the-art for context scaling on non-finetuned models. See section 3.3 of this paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Speed related topics research 🔬
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants