Lice!

A collection of somewhat random thoughts.

How To Train Your Model: Loopy loop

Now with this out of the way let’s talk about something technical. Looped transformers. They are pretty cool and really interesting.

Detour one: layers

Let’s quickly start with some very basic model design: layers. Yes I know this is totally out of order, but I warned you! Models are usually spread into multiple layers, each layer having a subset of the total parameters (this is a massive lie and oversimplification but it’s enough!). So a 27B parameter model could be 1 layer with 27B parameters, or 27B layers with one parameter (both of which would work pretty terribly or probably not at all!), or something in between (that’s what it usually is).

Most open models deal in the 10s or low hundreds of layers. Qwen 3.8 27B for example has 64 layers. Qwen 3.8 Flash-Next (125B parameters) has 48. And DeepSeek v4.1 Flash (552B parameters) has 40 layers.

But not all layers are equal, they’ve different tasks, the first and last layers do the preparation and token -> output generation, while the middle layers do the heavy mathy stuff that’s related to knowledge and thinking.

Detour two: knowledge and thinking

This leads us to the second detour of the post, knowledge and thinking - I really don’t like those terms, they anthropomorphize a matrix multiplication, and while I’m sure there could be a really cool web comic about this I’m not good at drawing…

All those billions of parameters serve two purposes:

  1. They store the information the model has been trained on, somewhere in those matrixes there are numbers that tell the math that if someone writes ‘what is the capital of france’ it should math out ‘paris’. A model that never saw this information during training can’t math this out.
  2. The way it ‘works through’ things - how it goes from a -> b -> c.

Perhaps it’s easiest to think about the weights being both database and algorithm. So for every weight a portion of its bits are knowledge bits and another portion goes to thinking bits, and the rest go to whatever else (handwavy!).

Back to topic

Okay, so what’s this loopy thing? The idea is pretty simple, a model can never have ‘more knowledge’ by just doing its thing multiple times. Paris won’t become more the capital of france by asking 'what is the capital of france' over and over again. But for the tasks that are not knowledge parts (not lookups in the database), the algorithm gets better. If you ask what’s the average of those 100 numbers and each time you ask it the result is an approximation out of 10 numbers, you get a better answer the more often you ask (with diminishing returns, do I need to mention that? Pedantic brain says yes but OTOH this is already so handwavy perhaps it doesn’t matter).

On a technical level it, most often, runs a portion of the inner layers multiple times (with a small set of transformations between each loop) so instead of 1 -> 2 -> 3 -> 4 the model does 1 -> 2 -> 3 -> 2 -> 3 -> 4 and this seems to lead to a situation where the thinking part of the model, since it has more time to math over things, gets better without having to pay for the extra knowledge bits (and whatever else bits).

And this is cool, because perhaps you’ve asked yourself, “why not just more layers?” and the answer is RAM (yeah if someone reads that in 5 years they’ll hopefully be surprised that RAM was ever an issue) but more layers mean more ram and that’s freaking expensive. Going over the same layers multiple times means a higher portion of the weights do thinking, and less is wasted. Which is awesome!

The downside is that the math still has to math, so while it needs less memory it still reads the same amount of memory compared to a model with more layers. So we have created a model that thinks more like a model with more layers, uses the memory of fewer layers but takes about as long as the larger model. It’s sad that the model also needs to be trained for this, so the training takes about as long as the larger model.

Or does it? Rhetorical question, duh, because it kind of doesn’t, it seems. In the model I trained it turns out there is barely any benefit of training the model to loop from the start, compared to just giving it an extra 10% of looped training steps at the end, research points the same way. And it seems like this aligns, at least partially, with what we’ve seen over the past few days with people adding looping to Qwen 3.8 or DeepSeek models, which supposedly improves reasoning. It seems like the loopy part is a new capability that can be trained into the model after a non loopy base training, and that’s really awesome.


Share

comments powered by Disqus