Skip to content

llama : try to avoid context swap #2060

Closed

Description

@ggerganov

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")

Activity

  1. SlyEcho commented on Jul 2, 2023

    @SlyEcho
    Contributor

    Maybe it could also be compressed using interpolation?

  2. cebtenzzre commented on Sep 17, 2023

    @cebtenzzre
    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.

  3. moved this from Todo to Done in ggml : roadmapon Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions