Focused Transformer: Contrastive Training for Context Scaling
Szymon Tworkowski Affiliation: IDEAS NCBR Affiliation: University of Warsaw Konrad Staniszewski Affiliation: IDEAS NCBR Mikołaj Pacek Affiliation: IDEAS NCBR Yuhuai WuHenryk Michalewski Henryk Michalewski Affiliation: University of Warsaw Affiliation: Google DeepMind Piotr MiłośHenryk Michalewski Affiliation: IDEAS NCBR Affiliation: Institute of Mathematics, Polish Academy of Sciences Affiliation: deepsense.ai Affiliation: xAI
Abstract
Large language models have an exceptional capability to incorporate new information in a contextual manner. However, the full potential of such an approach is often restrained due to a limitation in the effective context length. One solution to this issue is to endow an attention layer with access to an additional context, which comprises of (key, value) pairs. Yet, as the number of documents increases, the proportion of relevant keys to irrelevant ones decreases, leading the model to focus more on the irrelevant keys. We identify a significant challenge, dubbed the distraction issue, where keys linked to different semantic values might overlap, making them hard to distinguish. To tackle this problem, we introduce the Focused Transformer (FoT), a technique that employs a training process inspired by contrastive learning. This novel approach enhances the structure of the (key, value) space, enabling an extension of the context length. Our method allows for fine-tuning pre-existing, large-scale models to lengthen their effective context. This is demonstrated by our fine-tuning of $3B$ and $7B$ OpenLLaMA checkpoints. The resulting models, which we name LongLLaMA11 1 We release the che
原文 arXiv:2307.03170;中英对照 + 大白话阅读 https://aha.fim.ai/paper/2307.03170v2