Unlimiformer: Long-Range Transformers with Unlimited Length Input
Bertsch, Amanda, Alon, Uri, Neubig, Graham, Gormley, Matthew R.
–arXiv.org Artificial Intelligence
Since the proposal of transformers, these models have been limited to bounded input lengths, because of their need to attend to every token in the input. In this work, we propose Unlimiformer: a general approach that wraps any existing pretrained encoder-decoder transformer, and offloads the cross-attention computation to a single k-nearest-neighbor (kNN) index, while the returned kNN distances are the attention dot-product scores. This kNN index can be kept on either the GPU or CPU memory and queried in sub-linear time; this way, we can index practically unlimited input sequences, while every attention head in every decoder layer retrieves its top-k keys, instead of attending to every key. We evaluate Unlimiformer on several long-document and book-summarization benchmarks, showing that it can process even 500k token-long inputs from the BookSum dataset, without any input truncation at test time. We demonstrate that Unlimiformer improves pretrained models such as BART and Longformer by extending them to unlimited inputs without additional learned weights and without modifying their code. We make our code and models publicly available at https://github.com/abertsch72/unlimiformer .
arXiv.org Artificial Intelligence
Oct-30-2023
- Country:
- Asia
- Middle East
- Jordan (0.04)
- UAE > Abu Dhabi Emirate
- Abu Dhabi (0.04)
- Russia (0.04)
- Middle East
- Europe
- Belgium > Brussels-Capital Region
- Brussels (0.04)
- Germany > Berlin (0.04)
- Ireland > Leinster
- County Dublin > Dublin (0.04)
- Italy > Tuscany
- Florence (0.04)
- Russia > Central Federal District
- Moscow Oblast > Moscow (0.05)
- Spain > Catalonia
- Barcelona Province > Barcelona (0.04)
- Belgium > Brussels-Capital Region
- North America
- Dominican Republic (0.04)
- United States
- Minnesota > Hennepin County
- Minneapolis (0.14)
- Pennsylvania > Allegheny County
- Pittsburgh (0.04)
- Minnesota > Hennepin County
- South America > Chile
- Asia
- Genre:
- Personal (0.67)
- Research Report (0.64)
- Industry:
- Government > Military (0.46)
- Health & Medicine > Therapeutic Area (0.46)
- Law (0.67)
- Technology: