Understand StreamingLLM capabilities and limitations
mainKey Concepts
- Infinite-length inputs: StreamingLLM enables LLMs to handle continuous input streams (like multi-round dialogues) by retaining only the most recent tokens and 'attention sinks' (the KV states of initial tokens), discarding intermediate tokens to manage memory.
- Attention Sinks: By keeping the KV states of the very first tokens, the model maintains performance even when the sequence length exceeds the original training window.
Limitations
- No Context Expansion: StreamingLLM does not expand the model's original pre-trained context window. For example, if Llama-2 was trained with a 4096 window, the maximum cache size remains 4096. It only manages the sliding window of that capacity.
- No Long-term Memory: The model does not have enhanced long-term memory. If you input a whole book, the model will only be able to process and summarize the most recent tokens (e.g., the concluding paragraphs).