Enjoying this issue?
Get tomorrow's AI & engineering digest in your inbox — hand-picked, summarized, and always spam-free.
TLDR
Dory, NVIDIA's 4B looped transformer, shows a different way to scale inference: the same shared weights can be looped 1, 2, 4, or 8 times at inference time, trading speed for deeper effective depth without growing GPU memory. Running four loops roughly matches the compute of a 9B dense model while keeping a 4B memory footprint, and NVIDIA's composite score puts it ahead of a 26B Gemma model on half of tested benchmarks. The real story is thinking harder per token instead of generating more tokens, with the loop count chosen at deployment time.
Key points
Dory is a 3.97B parameter looped transformer with 16 input layers, 16 output layers, and a 40-layer recurrent block.
Loop count is set at inference time, with one model serving 1, 2, 4, or 8 loops without retraining.
Effective depth rises from 72 layers at one loop to 192 layers at four loops while weight memory stays constant.
KV cache grows with loops, but a last-loop mode keeps one cache and cuts memory to about 1.32GB per sequence.
NVIDIA claims Dory wins 5 of 10 benchmarks against a 26B Gemma model at four loops, mostly agentic and long-context tasks.
Tools mentioned
Techniques
- Looped transformer architecture with shared recurrent weights
- Elastic inference compute, NVIDIA's term for adjustable loop count at serving time
- Per-loop KV cache mode versus last-loop KV cache mode
- Loop lens inspection of internal states and log probabilities across loop passes
- Router-based loop count selection for hard versus easy queries
- Supervised fine-tuning and reinforcement learning with GPO (likely GRPO)
Stop scrolling. Start reading smarter.
Receive the day's most important AI & engineering updates in one concise email. No spam.
Transcript (captions)
Okay, so this is three models running the same prompt. But actually, it's not three models. It's the same model, but with different amounts of looping going on in the actual layers of the model. So
this is a 4 billion parameter model from Nvidia. And you can see that going through this, we've basically got different token speeds for each of the different versions of the model that's
actually running here. And each of these versions is looping a number of times. So this one is the basic one loop version. Then we've got a two-loop version and then we've got a fourloop
version going on here. And Nvidia's own composite score puts this model ahead of the Gemma 4 26B. But that's not actually the interesting part here. For me, the interesting part here is really about
how it does it. The model is the same. The only thing that changes here is how many times the model runs one block of its layers for each token. once for one loop, twice for two loops, four times
for four loops. And if you look at each of these that's running the same prompt, we get very different final answers out. And we get different amounts of tokens that actually got us here. So sure
enough, the fastest one here was the one loop version. And it looks like it did get to the right answer there. The twoop version just gave us a five and didn't even give us the breakdown in the
answer. But the for loop version went into a detailed analysis of breaking down what it was. You can clearly see it's got nice latte there and it's coming to the right answer and it's
giving us a full explanation of how it got to the right answer. Okay, so this is Dory, a looped transformer, also called a latent recurrent transformer. So this is a 4B model that comes from
Nvidia's Neotron Labs. It came out a couple of weeks ago and while this is mostly a research release, it really does show where loop transformers could actually be going. So, I've been wanting
to do a video on loop transformers for a while. And this is a good excuse because it's a loop model that you can actually download and run on your own hardware. Unfortunately, most of what people are
putting out there about this is just blog posts or walkthroughs and not actually showing you the result of the model. So, unfortunately, there's no blog post for this. The model card is
basically all you get. So I decided to actually install this, have a play with it, and build a UI for actually showing you sort of what this actually does. So the basics of this, it's a 3.97 billion
parameter model. It's got up to 256K of context. And Nvidia's actually released this on their open MDW license, so you can use it commercially if you want to. They've also released a beef bloat 16
version, an MXFP8 version, and an NVFP4 version along with other GGUFS etc. So the model itself was pre-trained on 6 trillion tokens. And interestingly, the first 4.5 trillion of those tokens were
done natively in NVFP4. They then switched to 16bit, gave it 300 billion tokens of context extension, and finally did SFT and reinforcement learning with GPO. All right. So, how does the loop
actually work? So, a normal transformer runs every layer once from the input right through to the output. What Dory does is it splits its layers into three separate blocks. There's an input block
at the start and an output block at the end. And each of those only runs once. The middle bit is where we've got the recurrent block. And that's the part that loops. If we sort of look at how
those layers are actually spread out, you've got 16 for the input block, got 16 for the output, and then you've got the recurrent block, which is actually 40 layers. So, if you look at the
animation here, what you're seeing here is a token going round that recurrent block. And we can set it to be once round, twice round, four times round, eight times round. And you can think of
it as those representations as it goes through the recurrent part are just refining those representations to get better and better now. So it doesn't go totally off on its loops. You can see
that it's actually sort of readding what came out of the input block to it each time. So in many ways it's very much like the ResNet models where you've got the original input being added to a
modification of it. The difference here is just that that modification rather than being different sets of weights each time for each block, it's basically the same set of weights that are just
getting reinforced here. So you can kind of think of this as every lap that it goes through, the model gets reminded of what the token is actually working on. So in some ways, it's kind of like
rereading the question or rereading the input basically before you have another shot at getting the best output. Now, if we were to unroll it like this, you can see that we're getting a much deeper
model here. Even though the weights for that repeated block are the same each time, compute-wise, we've got a lot more depth going on there. The other thing that's interesting here, and that makes
it perhaps more practical, is that the output block is trained to read the state after any of the loops. So, one loop, two loops, four loops are all valid models for this. You don't have to
retrain it for any particular number of loops. You can basically just set that at inference time and you're making use of eight times through these shared weights. So this whole idea is what
Nvidia calls this elastic inference compute. And as I turn up these loops here, the compute per token is going up, but the weights in memory don't change at all. In this case, it's still only
3.9 billion parameters sitting on the GPU. So already you should start to see that one of the huge advantages of this is that if we can just loop through the same weights multiple times, we don't
need to have GPUs with huge amounts of memory to be able to run a model like this. And you can see here at one loop, we've basically got 72 layers of effective depth. At two loops, we're up
to 112. If we jump to four loops, we're already at 192 layers there. But still, it's the same amount of GPU RAM being used for this. And you can see looking at the for loop version here, DOI is
actually doing roughly the compute of a 9B dense model. Even though the memory footprint of the weights in here is the size of a 4B model. Now, it's not a total win for your memory, etc.
Obviously, one place where the memory will grow is the KV cache. In per loop mode, every loop actually keeps its own cache. So more loops here means that you will need a bigger KV cache and memory
to actually support that in here. Now you can actually run it in a sort of last loop mode where each recurring attention layer keeps just one cache and then overwrites the old ones. And you
can see if we go from one loop to four loops there that last loop doesn't change at all. So that is something that you can actually try out to see how it goes. Now, Nvidia says that the accuracy
and output length stay close to per loop. So, to give you a sense of it, at a 32 context window and two loops, you're looking at roughly 2 gig per sequence versus just one loop or the
last loop out and that it's only going to require 1.32. So you could imagine that this is where you set it up so that if you're serving long context with lots of concurrent users, then this is a
setting you certainly would look at trying out to just use the last loop as opposed to the perl loop KV cache. Okay, so you can see when I actually run this, I built a little demo in here that
allows us to run these at once. I'm actually running multiple versions of the model. So, just to be sort of fully open with you here is one of the challenges with this at the moment is
that when you start VLM, you have to tell it how many loops you want it to do. So, I'm actually running three versions of the actual same model so that I can do this. Anyway, you can see
that the prompt gets sent to all of these. Now, it's not a hard and fast rule that one of them will have more output tokens than the other. Certainly the speed will be faster on the one loop
versus the two loop versus four loops etc. I think depending on the actual problem you'll see the quality of the output change as well. Often I see that the for loop one does seem to get better
quality outputs than the one loop one for example but certainly not all the time and it's not something that I would just sort of say it's the same as sort of turning up reasoning or something
like that. You'll also find for a lot of prompts that they actually get the same quality of output going through this. In this case here, you can see that basically the fourth one actually
generated the most amount of tokens just by a fraction over the one loop one. And obviously the wall time for that was actually a lot longer. Obviously, one loop is going to decode faster, etc. We
can also come over to a chat and see what the actual chat is like when we're looking at different outputs. So there does seem to be some difference in the reasoning, but I wouldn't say it's a
huge difference in the sense that you're going to get much better all the time from four as per three. If I run the same thing with four loops, you will notice you get different kinds of
responses out. Looking at this one, actually it got to an answer much quicker. And we didn't get the numbered thinking in the actual reasoning here. We just got sort of more general
thinking as opposed to the two loops which gave us numbered thinking etc. Okay. So this is the part that for me I was most curious about was I wanted to see what the model's actually doing on
each of the laps of this. So to run this I basically ported this to sort of plain pietorch and just use the bflat 16 weights in here and then I can read out every internal state of the loop. So
this is what I'm calling sort of like a loop lens in here. It then allows us to match VLM's log probabilities and to see how these outputs actually change. So you can see that if this is the sort of
rough outputs for one loop, we can actually see that there are certain things that it paid attention to more at six loops versus one loop. And you can see for example that the model gets more
confident about predicting certain tokens after more loops. So at one loop here it's predicting this bracket only at 15%. After two it's at 68 374 75 etc. Right up to sort of five and six
loops here seems to be the same. So it is going to be something to see as these models get built for production and not just for research. How do we actually know for what kind of questions do we
want to actually do this? I talked about that at the moment with VLM I need to run a different instance of VLM at each point and it is kind of cool that you can imagine putting a router in front of
that so that if you do have harder questions it routes to the six loop version as opposed to the one loop version. We can also imagine in the future that VLM just does that itself.
All right. So going back into their benchmarks against Gemma 426B Dory at one loop wins one out of 10 of these benchmarks. You can see at two loops that's already now jumped up to four out
of 10 here. And sure enough, if we go to four loops, it's now winning five out of 10 here. Now, interestingly, where this seems to win is at aentic work. So, instruction following and long context,
things like Bench verified, the ones where it tends to lose are things that you would kind of expect that it's not just about reasoning, it's about knowledge. So knowledge obviously
requires a lot more weights to store the knowledge. And sure enough on things like GPQA, humanities last exam, etc. This doesn't win. It just doesn't win at all. It actually does quite a lot worse.
And it kind of makes sense that that's probably because the model just doesn't have enough weights compared to the 26B version. So remember the 26B version still only got a small amount active,
but it's got all those extra experts that are storing those weights that can be turned on when it needs to basically get the results out there. Just to remind you that Gemma 26B is actually a
mixture of experts model with 4 billion active parameters per token. So the compute is roughly sort of the same for these. It's just how they're doing that compute and what weights are actually
being used is actually quite different. And you can see if we come down here and look at the amount of loops versus the quality that we're getting here. Certainly more loops seems to score
higher with the same amount of weights. And then don't forget we're just looking at a 4B model here. You could imagine this just doubling or tripling in size and then being able to compete with
mixture of experts models that are sort of 50 billion or greater. So anyway, just to finish up, I think this is a really interesting direction that people are going in. Loop transformers is
definitely a thing. We've had many rumors that that's what GPT6 is using. Supposedly, sort of one versus two versus three loops depending on the different sizes, etc. I would say if
you're going to deploy this today, probably you want to run two loops as the default. And I think that's what Nvidia is recommending anyway. And then maybe you have another version of it
that's running actually at sort of four loops where you send harder agentic tasks or things that do need that extra thinking in there. I think the really big idea here is that this is a
different way to scale. Instead of the model just writing longer and longer chains of thought, it thinks harder per token rather than more tokens. And the cool thing with that is that you get to
choose how hard when you actually deploy it. So the model's certainly not perfect. I don't think this sort of research version is going to replace anything that people are doing in
production that much. But I do think as we sort of look at how to sort of fine-tune these kind of models for the different numbers of loops etc. you could imagine suddenly being able to do
a lot of different tasks with a similar kind of size model that doesn't need a huge memory footprint like a large etc. Anyway, I put the links to the model card and all the details about that in
the description. If people are interested in me doing a broader video about loop transformers, let me know. I'll sort of start looking at some of the other ones that are being proposed
and maybe even look at some ideas of how to train a small one, etc. And let me know in the comments where you think this is going. If it is true that GPT6 is one of these loop transformers, we've
got to expect that the open models are going to catch up pretty quickly to something like that. Anyway, as always, if you found the video useful, please click like and subscribe, and I will
talk to you in the next video.