YouTube2Text

Dory - NVIDIA's Looped Transformer — Transcript

by Sam Witteveen · 2,828 words · 387 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Okay, so this is three models running
  2. 0:02the same prompt, but actually it's not
  3. 0:05three models. It's the same model but
  4. 0:08with different amounts of looping going
  5. 0:11on in the actual layers of the model. So
  6. 0:14this is a 4 billion parameter model from
  7. 0:16Nvidia. And you can see that going
  8. 0:18through this, we've basically got
  9. 0:20different token speeds for each of the
  10. 0:22different versions of the model that's
  11. 0:25actually running here. And each of these
  12. 0:27versions is looping a number of times.
  13. 0:29So this one is the basic one loop
  14. 0:31version, then we've got a two loop
  15. 0:33version, and then we've got a four loop
  16. 0:35version going on here. And and Nvidia's
  17. 0:37own composite score puts this model
  18. 0:40ahead of the Gemma 4 26B, but that's not
  19. 0:43actually the interesting part here. For
  20. 0:44me, the interesting part here is really
  21. 0:46about how it does it. The model is the
  22. 0:48same. The only thing that changes here
  23. 0:50is how many times the model runs one
  24. 0:53block of its layers for each token. Once
  25. 0:56for one loop, twice for two loops, four
  26. 0:59times for four loops. And if you look at
  27. 1:02each of these that's running the same
  28. 1:03prompt, we get very different final
  29. 1:06answers out, and we get different
  30. 1:08amounts of tokens that actually got us
  31. 1:10here. So sure enough, the fastest one
  32. 1:12here was the one loop version, and it
  33. 1:14looks like it did get to the right
  34. 1:16answer there. The two loop version just
  35. 1:18gave us a five and didn't even give us
  36. 1:21the breakdown in the answer. But the
  37. 1:23four loop version went into a detailed
  38. 1:25analysis of breaking down what it was.
  39. 1:29You can clearly see it's got nice LaTeX
  40. 1:31there, and it's coming to the right
  41. 1:33answer. And it's giving us a full
  42. 1:35explanation of how it got to the right
  43. 1:37answer. Okay, so this is Dory, a looped
  44. 1:40transformer, also called a latent
  45. 1:42recurrent transformer. So this is a 4B
  46. 1:45model that comes from Nvidia's NeMo-Tron
  47. 1:47labs. It came out a couple of weeks ago,
  48. 1:49and while this is mostly a research
  49. 1:51release, it really does show where loop
  50. 1:53transformers could actually be going. So
  51. 1:56I've been wanting to do a video on loop
  52. 1:57transformers for a while, and this is a
  53. 1:59good excuse because it's a loop model
  54. 2:01that you can actually download and run
  55. 2:03on your own hardware. Unfortunately,
  56. 2:05most of what people are putting out
  57. 2:06there about this is just blog posts or
  58. 2:09walkthroughs and not actually showing
  59. 2:11you the results of the model. So,
  60. 2:12unfortunately, there's no blog post for
  61. 2:14this. The model card is basically all
  62. 2:16you get. So, I decided to actually
  63. 2:18install this, have a play with it, and
  64. 2:20build a UI for actually showing you sort
  65. 2:22of what this actually does. So, the
  66. 2:24basics of this, it's a 3.97 billion
  67. 2:26parameter model. It's got up to 256K of
  68. 2:29context. And NVIDIA has actually
  69. 2:31released this on their Open MDW license.
  70. 2:35So, you can use it commercially if you
  71. 2:36want to. They've also released a BF16
  72. 2:39version, an MXFP8 version, and an NVFP4
  73. 2:43version along with other GGUFs, etc. So,
  74. 2:47the model itself was pre-trained on 6
  75. 2:49trillion tokens. And interestingly, the
  76. 2:51first 4.5 trillion of those tokens were
  77. 2:53done natively in NVFP4. They then
  78. 2:56switched to 16-bit, gave it 300 billion
  79. 2:59tokens of context extension, and finally
  80. 3:02did SFT and reinforcement learning with
  81. 3:04GRPO. All right, so how does the loop
  82. 3:06actually work? So, a normal transformer
  83. 3:08runs every layer once from the input
  84. 3:11right through to the output. What Dory
  85. 3:13does is it splits its layers into three
  86. 3:16separate blocks. There's an input block
  87. 3:18at the start and an output block at the
  88. 3:20end, and each of those only runs once.
  89. 3:23The middle bit is where we've got the
  90. 3:25recurrent block. And that's the part
  91. 3:27that loops. If we sort of look at how
  92. 3:29those layers are actually spread out,
  93. 3:31you've got 16 for the input block, got
  94. 3:3316 for the output, and then you've got
  95. 3:35the recurrent block, which is actually
  96. 3:3740 layers. So, if you look at the
  97. 3:38animation here, what you're seeing here
  98. 3:40is a token going round that recurrent
  99. 3:43block. And we can set it to be once
  100. 3:46round, twice round, four times round,
  101. 3:49eight times round. And you can think of
  102. 3:51it as those representations as it goes
  103. 3:53through the recurrent part are just
  104. 3:56refining those representations to get
  105. 3:59better and better. Now, so it doesn't go
  106. 4:02totally off on its loops, you can see
  107. 4:05that it's actually sort of re-adding
  108. 4:07what came out of the input block to it
  109. 4:10each time. So, in many ways, it's very
  110. 4:12much like the ResNet models where you've
  111. 4:14got the original input being added to a
  112. 4:18modification of it. The difference here
  113. 4:20is just that that modification, rather
  114. 4:23than being different sets of weights
  115. 4:24each time for each block, it's basically
  116. 4:27the same set of weights that are just
  117. 4:29getting re-enforced here. So, you can
  118. 4:31kind of think of this as every lap that
  119. 4:33it goes through, the model gets reminded
  120. 4:35of what the token is actually working
  121. 4:37on. So, in some ways, it's kind of like
  122. 4:38re-reading the question or re-reading
  123. 4:40the input, basically, before you have
  124. 4:43another shot at getting the best output.
  125. 4:46Now, if we were to unroll it like this,
  126. 4:48you can see that we're getting a much
  127. 4:50deeper model here. Even though the
  128. 4:52weights for that repeated block are the
  129. 4:55same each time, compute-wise, we've got
  130. 4:57a lot more depth going on there. The
  131. 4:59other thing that's interesting here, and
  132. 5:00that makes it perhaps more practical, is
  133. 5:02that the output block is trained to read
  134. 5:05the state after any of the loops. So,
  135. 5:08one loop, two loops, four loops are all
  136. 5:11valid models for this. You don't have to
  137. 5:13retrain it for any particular number of
  138. 5:17loops. You can basically just set that
  139. 5:18at inference time, and you're making use
  140. 5:20of eight times through these shared
  141. 5:22weights. So, this whole idea is what
  142. 5:24Nvidia calls this elastic inference
  143. 5:27compute. And as I turn up these loops
  144. 5:30here, the compute per token is going up,
  145. 5:33but the weights in memory don't change
  146. 5:35at all. In this case, it's still only
  147. 5:373.9 billion parameters sitting on the
  148. 5:40GPU. So, already you should start to see
  149. 5:43that one of the huge advantages of this
  150. 5:46is that if we can just loop through the
  151. 5:48same weights multiple times, we don't
  152. 5:51need to have GPUs with huge amounts of
  153. 5:53memory to be able to run a model like
  154. 5:55this. I can see here at one loop, we've
  155. 5:58basically got 72 layers of effective
  156. 6:01depth. At two loops, we're up to 112. If
  157. 6:04we jump to four loops, we're already at
  158. 6:06192 layers there. But still, it's the
  159. 6:10same amount of GPU RAM being used for
  160. 6:13this. And you can see looking at the
  161. 6:15four loop version here, it is actually
  162. 6:17doing roughly the compute of a 9-bit
  163. 6:19dense model, even though the memory
  164. 6:22footprint of the weights in here is the
  165. 6:24size of a 4-bit model. Now, it's not a
  166. 6:26total win for your memory, etc.
  167. 6:29Obviously, one place where the memory
  168. 6:30will grow is the KV cache. In per loop
  169. 6:33mode, every loop actually keeps its own
  170. 6:35cache. So, more loops here means that
  171. 6:38you will need a bigger KV cache and
  172. 6:41memory to actually support that in here.
  173. 6:43Now, you can actually run it in a sort
  174. 6:45of last loop mode, where it each
  175. 6:47recurrent attention layer keeps just one
  176. 6:49cache and then overwrites the old ones.
  177. 6:52And you can see if we go from one loop
  178. 6:54to four loops there, that last loop
  179. 6:57doesn't change at all. So, that is
  180. 6:59something that you can actually try out
  181. 7:01to see how it goes. Now, NVIDIA says
  182. 7:03that the accuracy and output length stay
  183. 7:06close to per loop. So, to give you a
  184. 7:08sense of it, at a 32 context window and
  185. 7:11two loops, you're looking at roughly 2
  186. 7:14gig per sequence versus just one loop or
  187. 7:17the last loop out, and that it's only
  188. 7:19going to require a 1.32. So, you could
  189. 7:22imagine that this is where you set it up
  190. 7:24so that if you're serving long context
  191. 7:26with lots of concurrent users, then this
  192. 7:29is a setting you certainly would look at
  193. 7:31trying out to just use the last loop as
  194. 7:34opposed to the per loop KV cache. Okay,
  195. 7:36so you can see when I actually run this,
  196. 7:38I built a little demo in here that
  197. 7:40allows us to run these once. I'm
  198. 7:43actually running multiple versions of
  199. 7:46the model. So, just to be a sort of
  200. 7:48fully open with you here is one of the
  201. 7:50challenges with this at the moment is
  202. 7:52that when you start v l m, you have to
  203. 7:55tell it how many loops you want it to
  204. 7:57do. So, I'm actually running three
  205. 7:59versions of the actual same model so
  206. 8:03that I can do this. Anyway, you can see
  207. 8:05that the prompt gets sent to all of
  208. 8:07these. Now, it's not a hard and fast
  209. 8:10rule that one of them will have more
  210. 8:12output tokens than the other. Certainly,
  211. 8:14the speed will be faster on the one loop
  212. 8:17versus the two loops versus four loops,
  213. 8:20etc. I think depending on the actual
  214. 8:23problem, you'll see the quality of the
  215. 8:26output change as well. Often, I see that
  216. 8:29the four loop one does seem to get
  217. 8:31better quality outputs than the one loop
  218. 8:34one, for example. But, certainly not all
  219. 8:36the time, and it's not something that I
  220. 8:37would just sort of say it's the same as
  221. 8:39sort of turning up reasoning or
  222. 8:40something like that. You'll also find
  223. 8:42for a lot of prompts that they actually
  224. 8:45get the same quality of outputs going
  225. 8:48through this. In this case here, you can
  226. 8:50see that basically the four one actually
  227. 8:53generated the most amount of tokens just
  228. 8:56by a fraction over the one loop one. And
  229. 8:59obviously, the wall time for that was
  230. 9:01actually a lot longer. Obviously, one
  231. 9:03loop is going to decode faster, etc. We
  232. 9:05can also come over to a chat and see
  233. 9:08what the actual chat is like when we're
  234. 9:10looking at different outputs. So, there
  235. 9:14does seem to be some difference in the
  236. 9:16reasoning, but I wouldn't say there's a
  237. 9:18huge difference in the sense that you're
  238. 9:20going to get much better all the time
  239. 9:22from four as per three. If I run the
  240. 9:25same thing with four loops, you will
  241. 9:27notice you get different kinds of
  242. 9:30responses out. Looking at this one,
  243. 9:32actually it got to an answer much
  244. 9:34quicker. And we didn't get the numbered
  245. 9:36thinking in the actual reasoning here.
  246. 9:38We just got sort of more general
  247. 9:40thinking as opposed to the two loops,
  248. 9:42which gave us numbered thinking, etc.
  249. 9:44Okay, so this is the part that for me I
  250. 9:47was most curious about was I wanted to
  251. 9:50see what the model's actually doing on
  252. 9:52each of the laps of this. So, to run
  253. 9:55this, I basically ported this to sort of
  254. 9:56plain PyTorch and just used the BFloat16
  255. 9:59weights in here. And then I can read out
  256. 10:01every internal state of the loop. So,
  257. 10:04this is what I'm calling sort of like a
  258. 10:05loop lens in here. And then it allows it
  259. 10:08to match feel em's log probabilities and
  260. 10:10to see how those outputs actually
  261. 10:13change. So, you can see that if this is
  262. 10:15the sort of rough outputs for one loop,
  263. 10:17we can actually see that there are
  264. 10:19certain things that paid attention to
  265. 10:21more at six loops versus one loop. And
  266. 10:24you can see for example that the model
  267. 10:26gets more confident about predicting
  268. 10:28certain tokens after more loops. So, at
  269. 10:32one loop here it's predicting this
  270. 10:34bracket only at 15%after two it's at 68,
  271. 10:38three 74, four 75, etc. right up to sort
  272. 10:41of five and six loops here seems to be
  273. 10:43the same. So, it's going to be something
  274. 10:45to see as these models get built for
  275. 10:47production and not just for research.
  276. 10:50How do we actually know for what kind of
  277. 10:52questions do we want to actually do
  278. 10:55this? I talked about that at the moment
  279. 10:57with VLM I need to run a different
  280. 10:59instance of VLM at each point. And it is
  281. 11:02kind of cool that you can imagine
  282. 11:03putting a router in front of that so
  283. 11:05that if you do have harder questions it
  284. 11:07routes to the six loop version as
  285. 11:10opposed to the one loop version. We can
  286. 11:12also imagine in the future that VLM just
  287. 11:14does that itself. All right, so going
  288. 11:16back into the benchmarks against Gemma
  289. 11:18426B, Dory at one loop wins one out of
  290. 11:2210 of these benchmarks. You can see at
  291. 11:25two loops that's already now jumped up
  292. 11:28to four out of 10 here. And sure enough
  293. 11:31if we go to four loops, it's now winning
  294. 11:34five out of 10 here. Now, interestingly
  295. 11:37where this seems to win is at agentic
  296. 11:39work. So, instruction following and long
  297. 11:42context, things like SweeBench,
  298. 11:44verified. The ones where it tends to
  299. 11:46lose are things that you would kind of
  300. 11:49expect that it's not just about
  301. 11:51reasoning, it's about knowledge. So,
  302. 11:54knowledge obviously requires a lot more
  303. 11:56weights to store the knowledge. And sure
  304. 11:58enough on things like GBQA, humanities
  305. 12:01last exam, etc. This doesn't win. It
  306. 12:04just doesn't win at all. It actually
  307. 12:05does quite a lot worse. And it kind of
  308. 12:07makes sense that that's probably because
  309. 12:10the model just doesn't have enough
  310. 12:12weights uh compared to the 26B version.
  311. 12:16So, remember the 26B version still only
  312. 12:18got a small amount active, but it's got
  313. 12:20all those extra experts that are storing
  314. 12:23those weights that can be turned on when
  315. 12:26it needs to basically get the results
  316. 12:27out there. Just to remind you that Gemma
  317. 12:2926B is actually a mixture of experts
  318. 12:32model with 4 billion active parameters
  319. 12:34per token. So, the compute is roughly
  320. 12:37sort of the same for these. It's just
  321. 12:40how they're doing that compute and what
  322. 12:41weights are actually being used is
  323. 12:43actually quite different. And you can
  324. 12:45see if we come down here and look at the
  325. 12:47amount of loops versus the quality that
  326. 12:50we're getting here, certainly more loops
  327. 12:53seems to score higher with the same
  328. 12:54amount of weights. And then don't forget
  329. 12:56we're just looking at a 4B model here.
  330. 13:00You could imagine this just doubling or
  331. 13:02tripling in size and then being able to
  332. 13:04compete with mixture of experts models
  333. 13:07that are sort of 50 billion or greater.
  334. 13:09So, anyway, just to finish it up, I
  335. 13:10think this is a really interesting
  336. 13:12direction that people are going in. Loop
  337. 13:15transformers is definitely a thing.
  338. 13:17We've had many rumors that that's what
  339. 13:18GPT-6 is using. Supposedly sort of one
  340. 13:21versus two versus three loops depending
  341. 13:23on the different sizes, etc. I would say
  342. 13:26if you're going to deploy this today,
  343. 13:27probably you want to run two loops as
  344. 13:30the default and I think that's what
  345. 13:31Nvidia is recommending anyway. And then
  346. 13:34maybe you have another version of it
  347. 13:35that's running actually at sort of four
  348. 13:37loops where you send harder agentic
  349. 13:40tasks or things that do need that extra
  350. 13:42thinking in there. I think the really
  351. 13:44big idea here is that this is a
  352. 13:46different way to scale. Instead of the
  353. 13:48model just writing longer and longer
  354. 13:50chains of thought, it thinks harder per
  355. 13:52token rather than more tokens. And the
  356. 13:55cool thing with that is that you get to
  357. 13:57choose how hard when you actually deploy
  358. 14:01it. So, the model's certainly not
  359. 14:02perfect. I don't think this sort of
  360. 14:04research version is going to replace
  361. 14:06anything that people are doing in
  362. 14:08production that much. But I do think as
  363. 14:10we sort of look at how to sort of
  364. 14:12fine-tune these kind of models for the
  365. 14:15different numbers of loops, etc. You
  366. 14:18could imagine suddenly being able to do
  367. 14:19a lot of different tasks with a similar
  368. 14:22kind of size model that doesn't need a
  369. 14:24huge memory footprint like a large MOE,
  370. 14:27etc. Anyway, I put the links to the
  371. 14:30model card and all the details about
  372. 14:32that in the description. If you are
  373. 14:34interested in me doing a broader video
  374. 14:35about Loop Transformers, let me know.
  375. 14:37I'll sort of start looking at some of
  376. 14:39the other ones that are being proposed
  377. 14:41and maybe even look at some ideas of how
  378. 14:43to train a small one, etc. And let me
  379. 14:45know in the comments where you think
  380. 14:46this is going. If it is true that GPT-6
  381. 14:50is one of these Loop Transformers, we're
  382. 14:52going to expect that the open models are
  383. 14:54going to catch up pretty quickly to
  384. 14:56something like that. Anyway, as always,
  385. 14:58if you found the video useful, please
  386. 15:00click like and subscribe and I will talk
  387. 15:02to you in the next video. Bye for now.

About this transcript

This page contains the full transcript of Dory - NVIDIA's Looped Transformer by Sam Witteveen, generated from the public captions YouTube serves with the video. The transcript has 2,828 words across 387 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.