about
Transformers Are Multi-State RNNs (arxiv.org)
41 points by DreamGen on Jan 16, 2024 | hide | past | pdf | 9 comments on HN

In plain words: Transformers can be rewritten as RNNs with unlimited memory states; TOVA shrinks that memory by dropping tokens the model barely attends to, without retraining. On long tasks it nearly matched the full model using one-eighth the cache, boosting throughput 4.8 times.

Abstract · Transformers are Multi-State RNNs

Transformers are considered conceptually different from the previous generation of state-of-the-art NLP models - recurrent neural networks (RNNs). In this work, we demonstrate that decoder-only transformers can in fact be conceptualized as unbounded multi-state RNNs - an RNN variant with unlimited hidden state size. We further show that transformers can be converted into $\textit{bounded}$ multi-state RNNs by fixing the size of their hidden state, effectively compressing their key-value cache. We introduce a novel, training-free compression policy - $\textbf{T}$oken $\textbf{O}$mission $\textbf{V}$ia $\textbf{A}$ttention (TOVA). Our experiments with four long range tasks and several LLMs show that TOVA outperforms several baseline compression policies. Particularly, our results are nearly on par with the full model, using in some cases only $\frac{1}{8}$ of the original cache size, which translates to 4.8X higher throughput. Our results shed light on the connection between transformers and RNNs, and help mitigate one of LLMs' most painful computational bottlenecks - the size of their key-value cache. We publicly release our code at https://github.com/schwartz-lab-NLP/TOVA

Matanel Oren, Michael Hassid, Nir Yarden, Yossi Adi, Roy Schwartz
arXiv:2401.06104 · cs.CL · submitted Jan 11, 2024 · updated Jun 18, 2024
abstract · pdf · html · preprint

add comment on HN

They show that a decoder only transformer (which gpts are) are rnns with infinite hidden state size. Infinite hidden state size is a pretty strong thing! Sounds interesting to me.
not infinite, just scaling linearly with length
I've seen at least 6 such papers, all being like "<popular architecture> are actually <a bit older concept>". Neural networks are generic enough that you can make them equivalent to almost everything.
Linking the latest generation tech to the previous generations is actually really helpful from my perspective.

All of the terminology for this tech is still emerging, and it can be quite difficult to formulate a reliable mental model for any of it due to how quickly it’s changing.

If hammers were more difficult to understand, I could imagine someone writing about the fact that hammers are in fact, just a piece of steel mounted on a handle made of wood.

> Neural networks are generic enough that you can make them equivalent to almost everything.

Which to me is why papers like this are useful. They help newcomers conceptualize what the latest <popular architecture> is actually made of in terms of <a bit older concept> that the reader may already understand.

It will take some time for this information space to stabilize.

It's also helpful in that you can now take insights from <older concept> and apply it to <popular architecture>. Many things are easier to reason about when framed a little differently.
oblique
Has anybody proved that transformers are just kernel SVM yet?
I hope you're satisfied with Gaussian Processes: https://arxiv.org/abs/1806.07572