Hacker News new | ask | show | jobs
by noddybear 10 days ago
A normal transformer has N layers, all of which are run forward for each token. A looped transformer is a bit different. Instead of N layers, it has K. These K layers are then looped, such that the output (not a token) of the first run of these K are fed back into the start of the K layer block. This looping happens until a fixed-point is achieved (i.e another loop results in a noop). At that point, a token is sampled. This means that tokens get different amounts of compute, depending on how challenging they are.
4 comments

> This looping happens until a fixed-point is achieved (i.e another loop results in a noop).

This is not true; in the article it is made abundantly clear that it runs 2x of 28 of its layers.

What guarantees an existence of a fixed point?
Nothing does, see https://arxiv.org/html/2604.11791v2 for gory details. Many models converge almost all the time, models can be designed to be more likely to converge, but I don't think we understand how to guarantee it or verify that it's guaranteed yet.
The 2x is arbitrary and in this particular case, is the fixed-point. I've seen models that do 3x loops for 3/4s of their layers. I suspect we'll see see loop counts increase as this becomes a more popular technique and may reach a point where one of the big labs is confident in their model's ability to loop "indefinitely" without becoming bogged down, reaching some logically measured point.
"Fixed point" in the context of iterative algorithms usually means "repeat a variable number of times until the output doesn't change." This is in stark contrast to the idea of repeating a fixed number of times. The looped models appear to repeat a fixed number of times.
I think the point here is that a few fixed number of iterations is enough to approximate the fixed point for most tokens. It's kind of like how iterative algorithms like Newton-Raphson are used in practice in modern optimizers (Muon). Trying to get to the exact fixed point might end up adding noise.
Running until you've detected the fixed point would be wasteful in any case, since you need one more pass to get the same result you already had.
If the layers are looped, what does it mean that they have an output?

I remember fixed points. An automorphism A on a set S has a fixed point s ∈ S if A(s) = s. If a noop corresponds to a fixed point, then are the elements of the set vectors and the output is a diff from the previous layers? Like, we're looping until we notice a cycle?

You could choose to loop a fixed number of times, or alternatively dynamically determine when to stop thereby achieving variable compute (more loops/compute/thought only when needed).

There has been concern that looping internally rather than emitting a token every N (transformer depth) layers reduces visibility and monitor-ability, so OpenAI have talked about severely limiting it to avoid this concern, and Zhipu are (at least initially) doing the same here - limiting it to a fixed two loops/iterations.

This is confusing to me: this is asserting that those K layers form a system of equations that can be solved using am iterative strategy until guaranteed convergence for each and every possible input sequence. Unless I am.missing a few fundamental mathematical properties aboutbnonlinear systems of equations, I don't understand how this can be true ober the entire input domain.
As always with neural net training, you are just minimizing output (in this case prediction) errors over the training set, and hoping that this generalizes.

I don't know how they train these looped transformers - whether they take the looping into account or not. For training recurrent (i.e. looped) neural networks in general, the historic approach has been to unroll them over some fixed number of timesteps (BPTT = back-propagation through time).

That's remarkably similar to naive iteration in datalog. I wonder if there's an optimization equivalent to semi naive iteration.