News for hackers. Stuff that matters.
Re:Mamba Explained: The State Space Model Taking On Transfor... by Straw on Sunday February 25, 2024 @03:17PM (#39504332)
The SSMs papers and blogs always have unnecessarily complicated explanations. At this point I almost wonder if its to hide how simple the underlying algorithms are, or to make them seem fancy.

SSMs are doing exponentially weighted moving averages (EMA). That's it- to summarize the past, you take an EMA of a variable output at each time step. Mamba changes one key thing- instead of decaying the past by a fixed amount each step as in a constant-time EMA, we have another output which decides how much to forget, or equivalently, how much 'time' has passed since the last observation in our EMA.

All of the matrix equations, continuous time, discretization, etc, will end up with a dynamic-forgetting EMA as I describe above. This also makes the benefits and limitations clear- finite state size, has to decide at a given layer what to forget before it sees the past at that layer.

Re:Mamba Explained: The State Space Model Taking On Transfor... by binarymax on Sunday February 25, 2024 @03:46PM (#39504561)
I hadn’t heard of Mamba before reading this article, and I was wondering if anyone has tried setting importance of a token as a TF-IDF or BM25 lookup. Requires a first pass to construct the token index but otherwise it seems like it would address the big issue that all these architectures have - they don’t know how “important” a token is. Interestingly this seems to be the crux of Mamba - deciding what tokens to forget! EMA other treats all tokens equally at sequence time. What if the tokens were weighted beforehand and the weights were passed as an attention mechanism? I wonder if anyone has tried something like this.
Re:Mamba Explained: The State Space Model Taking On Transfor... by halflings on Sunday February 25, 2024 @04:14PM (#39504840)
The importance (e.g. attention) needs to be dynamic, e.g. one token will be important to some other tokens but not others.

tf-idf and similar heuristics are what we were using before attention came along, e.g. tf-idf weighted bag-of-words representation of word2vec embeddings. That approaches fails in so many cases.

Re:Mamba Explained: The State Space Model Taking On Transfor... by binarymax on Sunday February 25, 2024 @05:41PM (#39505673)
Attention in transformers works because over time the model learns token importance based on frequency and context.

If you don’t have attention and need a fast substitute for “forgetting” non important tokens, then BM25 is an intuitive hypothesis.

Re:Mamba Explained: The State Space Model Taking On Transfor... by curious_cat_163 on Sunday February 25, 2024 @06:13PM (#39505926)
To use your metaphor, TF-IDF will result in ‘fixed’ weights.

Attention makes it so that the weights of each token can be different in each sequence of tokens. Same token gets different weights depending on who its ‘neighbors’ in the sequence end up being.

This property allows the models to solve a variety of natural language problems and gets ‘used’ by the model to express context-aware dependencies.

Re:Mamba Explained: The State Space Model Taking On Transfor... by littlestymaar on Monday February 26, 2024 @01:58AM (#39508316)
Given that GP explicitly said “if you don't have attention”, and we're in a thread about a language model whose main characteristics is not to use attention, I don't understand why you insist in talking about attention …
Re:Mamba Explained: The State Space Model Taking On Transfor... by curious_cat_163 on Monday February 26, 2024 @02:48AM (#39508611)
I mean, if we are going to get past attention (very much on board with the idea!), then it might help to know what it is really contributing to a model.

My response was trying to clarify some confusion.

I am all for alternatives to attention. I don’t think BM25 cuts it. I don’t think anything that samples tokens based on BM25 weights (the idea in this subthread) would cut it.

Re:Mamba Explained: The State Space Model Taking On Transfor... by binarymax on Monday February 26, 2024 @06:52AM (#39510230)
What confusion? I know exactly how BM25 works and how Transformers work. I stated a hypothesis and asked if anyone has tried it. You say it won’t work. That’s just your opinion. Do you have proof or evidence? This is science. Dismissal of ideas without evidence goes against scientific principles.
Re:Mamba Explained: The State Space Model Taking On Transfor... by curious_cat_163 on Saturday March 02, 2024 @01:29PM (#39574625)
Just catching up to this thread again. You had said:

"I was wondering if anyone has tried setting importance of a token as a TF-IDF or BM25 lookup."

So, I take it back. This is not a confusion. You are right to call it out. :)

I like this idea directionally. A lot of energy (literally) would be saved if we could get to the model accuracy outcomes with static weights like this.

However, I do think that this (as stated in your original message) would not work as well as transformer or SSM and I explained my reasoning as to why, already. I don't have an empirical proof (not having run the experiment) but if you believe in it, you should try it and share your findings.

Re:Mamba Explained: The State Space Model Taking On Transfor... by nelsondev on Sunday February 25, 2024 @11:29PM (#39507690)
Not exactly related, but in the same vein - Deep Impact - deep learning to find term impacts in the context of their document.

https://arxiv.org/abs/2104.12016

Re:Mamba Explained: The State Space Model Taking On Transfor... by logicchains on Sunday February 25, 2024 @03:31PM (#39504440)
Are there any fundamental differences between Mamba, Retnet and RWKV, or are they all variants of this same architecture?
Re:Mamba Explained: The State Space Model Taking On Transfor... by Straw on Sunday February 25, 2024 @11:57PM (#39507834)
No, all of these use the same fundamental architecture with minor tweaks, such as the dynamic gate for mamba or an outer product paramterization of the values for RWKV-v5
Re:Mamba Explained: The State Space Model Taking On Transfor... by pama on Monday February 26, 2024 @01:28AM (#39508177)
A dynamic gate is a pretty distinct feature from previous SSM architectures in my opinion. In a sense, the overall fundamental architecture of mamba is still that of the transformer but with attention replaced by an SSM with dynamic gating. All of deep learning uses closely related ideas, but the SSM class of models took advantage of stability guarantees from integrators in control theory and created a class of RNN that don’t have to worry about exploding gradients. Mamba is one of the ways to make these SSM models much more expressive.
Re:Mamba Explained: The State Space Model Taking On Transfor... by Straw on Wednesday February 28, 2024 @08:36PM (#39545657)
Its distinct, but not very- its an EMA without assuming uniform time. The stability of EMA has nothing to do with integrators in control theory and neither do these models.

These models aren't really RNNs- they have only a linear gate which cannot depend on previous tokens at this layer, so they cant update their state in a way which depends on the current state very much.

Re:Mamba Explained: The State Space Model Taking On Transfor... by ogogmad on Sunday February 25, 2024 @03:47PM (#39504567)
That might explain the motivation for why the Δ variable is used and varied; but not the "Selectivity", which the article says is expressed by how the matrices B and C vary while consuming input.

Something I've noticed is that B, C and Δ depend only on the current token. See this: https://www.kolaayonrinde.com/blog/images/mamba/ssm_algorith...

+1 though for making me go back to the article and read it more carefully! +1 also to the article.

Re:Mamba Explained: The State Space Model Taking On Transfor... by ogogmad on Sunday February 25, 2024 @05:50PM (#39505758)
OK, I've noticed that the pseudo-code above is vectorised, and so there's no recursion. The SSM function is actually described at the start of the paper, and an efficient hardware-aware implementation is suggested in section 3: https://arxiv.org/ftp/arxiv/papers/2312/2312.00752.pdf
Re:Mamba Explained: The State Space Model Taking On Transfor... by torginus on Monday February 26, 2024 @04:10AM (#39509121)
Is this analogous to digital filters, where Transformers are the FIR filters that operate on the history of input, and IIR filters, which take past inputs into account with an exponentially decaying importance?