Unlimiformer: Long-Range Transformers with Unlimited Length Input


Transformer-based models typically have a predefined bound to their input length, because of their need to potentially attend to every token in the input. In this work, we propose Unlimiformer: a general approach that can wrap any existing pretrained encoder-decoder transformer, and offload the attention computation across all layers to a single k-nearestneighbor index; this index can be kept on either the GPU or CPU memory and queried in sub-linear time. This way, we can index extremely long input sequences, while every attention head in every decoder layer retrieves its top-k keys, instead of attending to every key. We demonstrate Unlimiformer’s efficacy on several long-document and multi-document summarization benchmarks, showing that it can summarize even 350k token-long inputs from the BookSum dataset, without any input truncation at test time. Unlimiformer improves pretrained models such as BART (Lewis et al., 2020a) and Longformer (Beltagy et al., 2020a) by extending them to unlimited inputs without additional learned weights and without modifying their code. We make our code and models publicly available.


Transformer 기반 모델들은 입력 길이에 대한 미리 정의된 한계를 가지고 있습니다. 이는 입력의 모든 토큰에 주의를 기울일 필요가 있기 때문입니다. 이 연구에서는 우리는 Unlimiformer를 제안합니다. 이는 기존의 사전 학습된 인코더-디코더 transformer 모델에 대한 일반적인 방법으로, 모든 레이어에서의 attention 계산을 단일 k-최근접이웃 인덱스로 전환하여 수행합니다. 이 인덱스는 GPU 또는 CPU 메모리에 유지될 수 있으며, sub-linear 시간 내에 쿼리가 가능합니다. 이 방법을 사용하면 매우 긴 입력 시퀀스를 인덱싱할 수 있으며, 모든 디코더 레이어의 모든 attention head는 모든 key에 주의를 기울이는 대신 상위 k개의 key를 검색합니다. 우리는 Unlimiformer의 유효성을 여러 개의 긴 문서 및 다중 문서 요약 벤치마크에서 입증하였으며, BookSum 데이터셋에서 350,000개의 토큰으로 이루어진 입력을 잘 요약할 수 있다는 것을 보여주었습니다. Unlimiformer는 추가적인 학습 가중치나 코드 수정 없이 BART (Lewis et al., 2020a) 및 Longformer (Beltagy et al., 2020a)와 같은 사전 학습된 모델을 확장하여 무제한 입력을 처리할 수 있게 해줍니다. 우리는 우리의 코드와 모델을 공개적으로 사용할 수 있게 하였습니다. (번역:챗GPT)



https://arxiv.org/abs/2305.01625

논문


https://github.com/abertsch72/unlimiformer

깃허브 


저자 트위터 


사전학습 모델에 자기들 독자적인 방법을 적용하는 것만으로 
입력길이를 무제한에 가깝게 늘릴 수 있다고 주장하는 논문입니다. 

실용성이 있는지, LLM에도 적용 가능한지는 몰?루.