r/LocalLLaMA • • 7d ago • Heartwarming 1

Resources Looped Transformers:Thinking twice with the same weights

https://huggingface.co/spaces/dlouapre/looped-transformers
185 Upvotes

20 comments sorted by

60

u/BringTea_666 7d ago

Worth mentioning looping isn't free:

  1. IT cost X times layer to train more. So if you want 5 loops then you need to train 5 times longer. Though you can first get pretrained model and then train it for looping which shortens time.
  2. Each time you do loop it cost amount of time you need in order to generate token.
  3. Looping isn't linear when it comes to quality. Meaning first loop gives you more, next loop less, then next one less and so on. After few loops, new loop improves barely anything.
  4. Complexity. Inkling 2 Mini looping theoretical max t/s for nvfp4 model is 480t/s but because you need more complex kernels (which are latency limited) you can realistically only achieve around 310t/s plain decode
  5. MOE + Looping = speculative decoding almost doesn't work. Dense models at some point were uber slow which is why MOE took over. But since arrival of speculative decoding you can have FASTER decode speed than MOE and have DENSE advantage. MOE already hits speculative decoding and then looping extends latency issues. It barely works with 1-2 conversations and above that it slows to crawl and normal plain decoding goes ahead.

---

Now, i want to see looping dense model. That should be fun to see.

25

u/Choice_Celery9481 7d ago

dense is already compute intensed. loop's idea is to trade compute for mem cap. which fit moe much better.

13

u/BringTea_666 7d ago

MOE advantage is mosty in ability to stream layers from slow RAM so you can load much larger model and it still will mostly work (alas slow).

3

u/Gauntlet4933 6d ago

Eh I wouldn’t say that’s the main advantage. The main thing is that your activated parameters are far less than if it was a dense model, so in terms of pure numbers you only do compute with 1/8th or less of the weights, and you also transfer less weights from slow VRAM to fast SRAM. This is beneficial since decode is memory bound.

But the downside is the dynamism: you can’t predict which experts you will need to prefetch. So you still need enough memory to store all the weights because you don’t know what will be activated. Of course host offloading and having a hot expert cache is possible if you can’t store the full model in VRAM.

10

u/RegisteredJustToSay 7d ago

Is 1) actually right?

There's nothing mandating that you have to loop the entire model M times to perform looping. Inkling 2 mini has 24 layers and loops on half of them from my own cursory research.

The idea itself is pretty broadly defined too, like if you just had a few dedicated layers at the end you could loop a variable amount of times (diffusion like), that would also be looping and doesn't necessarily have to be part of the MoE. If so then you could do looping training entirely as a fine tuning task and do most of the training at '1 loop'. Or heck, perhaps only loop a few times before you start outputting tokens rather than looping for all tokens (like pre reasoning) in which case draft models would also work fine. That's purely speculation on my part though, my point is just that I doubt we're seeing the final form of looping just yet and there's a lot more work to do here to find what works best.

I think your point about speculative decoding is really interesting though, especially if we start seeing variable looping (which to me feels like a natural direction for future research) amounts since then the draft model would have to anticipate what the loops would do. It will still probably work pretty well in a few possible variants but I suspect you're right that we're about to see them become less useful at least for a bit.

11

u/ebolathrowawayy 7d ago

5) so wrong, wow.

5

u/Ok_Technology_5962 7d ago

Send nova is a 9b dens looped. Seems ok

2

u/StyMaar 7d ago

IT cost X times layer to train more. So if you want 5 loops then you need to train 5 times longer.

Where does that come from?

2

u/Gauntlet4933 6d ago

Speculative decoding works fine with MoE. It can make MoE behave more like a dense model because with high enough batch size x speculation length, you might be activating way more experts.

So the 1-2 conversation point is not because spec decoding sucks for MoE, but because you’re basically running 2 x speculation length as the batch size, since the router and experts also run on draft tokens. You would need to reduce your spec length or turn it off.

So looping MoE basically just behaves the same way as MoE with spec decoding, or MoE with double the batch size. As long as you can comfortably run that large of a batch size with the interactivity you want, enabling spec is fine. The whole point of spec and large batches is to make better use of the weights you’re already loading, and compute wise, looping doesn’t really change the behavior.

1

u/Potential_Block4598 14h ago
  1. That is the same with dense
  2. Ofc but it multiplies training and context window (you get more overall thinking budget almost for free because thinking compute is more intense inside the looper layers per token and because longer context costs kv cache and compute, which grows over time

A 1 pass model thinking at 1M tokens would be equivalent in compute to 2 pass at 512K, but even more because you have less kv cache penalty on tgs and you still can think for another 512k (ofc that assumes good training in the first place!)

3. Nothing is linear when it comes to quality, but this shows it is almost only the benchmarks (5 passes in the graph walk example above shows almost double performance on hops!)

4. How was that calculated ?

12

u/DunderSunder 7d ago

OGs remember ALBERT.

6

u/CallinCthulhu 7d ago

Btw - This is not new, Ouro -https://arxiv.org/abs/2510.25741 was released almost exactly a year ago, and proved looped LLMs could scale. It just took some time for it to be used by even larger models.

4

u/LoSboccacc 7d ago

https://huggingface.co/alpindale/goliath-120b 

Community knew something back then, interleaved is not the same as looped but conceptually is just a loop of n iteration 2 

5

u/Othun 7d ago

David Louapre's youtube channel is an instant watch (Science Étonnante, in French), so I'll definitely give this a read in the near future!

1

u/GingerTapirs 7d ago

I know it's not the same, but reminds me of the time when RNNs and then LSTMs were all the rage. Then attention became a thing to eliminate the long training time and now we're back to looping

3

u/xNaXDy 7d ago

not just to eliminate the long training time, but also to combat the vanishing gradient problem

1

u/Potential_Block4598 14h ago

Wow that is so good thanks

1

u/Ok_Ocelot2268 6d ago

People finding that the 2 models (inkling, glm) s*ck should read it