Ternary Bonsai 2 27B in 7 GB: 43 tok/s on One Nvidia P100 — Transcript
Full transcript
- 0:00One NVIDIA Tesla P200 from 2016.
- 0:04Ternary bonsai two, 27 B in a seven gig
- 0:08file. Out of the box, 26.6 tokens a
- 0:12second. And now 43.4
- 0:15with MTP, a little guesser head added
- 0:17onto the model. Same card. And on my
- 0:20test prompts, the answers didn't change.
- 0:22Not one word. Nothing bought. My wallet
- 0:25wasn't even invited. I'll show you where
- 0:27the speed was hiding and all the stuff
- 0:29that made it slower. Oh, and there's a
- 0:32catch.
- 0:33First run, stock. Prism ML's fork of
- 0:36llama CPP, one card, 26.6.
- 0:41One of you guys asked for this one. The
- 0:43model is Ternary bonsai two, 27 B by
- 0:46Prism ML. Prism ML says nearly every
- 0:49weight is just minus one, zero, or plus
- 0:51one. That's why it's called bonsai. It's
- 0:54still the whole tree. It just lives in a
- 0:55pot now. Very Mr. Miyagi.
- 0:59We had a theory. Our notes said about 20
- 1:02milliseconds of every token was the card
- 1:04waiting for orders. A formula even said
- 1:0626.7
- 1:08and the card did 26.6. I was like, holy
- 1:11cow, nailed it. Nope. Right number,
- 1:14wrong reason. The profiler said busy 94%
- 1:18of the time. Busy doing what? It's like
- 1:21the guy at the DMV. Looks super busy,
- 1:23line doesn't move. One job ate most of
- 1:26every token, reading the weights.
- 1:28[snorts] This card reads its memory at
- 1:30605 gigabytes a second. We measured it.
- 1:33That job did 264.
- 1:36Okay, so it's like a warehouse. Every
- 1:39token, a forklift hauls out the whole
- 1:41model. Seven gigs of tiny boxes. One box
- 1:44is one byte, four weights.
- 1:47Problem one. The old code carried two
- 1:49boxes per trip. Even with no math at
- 1:51all, that tops out around 370 gigabytes
- 1:54a second.
- 1:56Problem two, the math. Newer NVIDIA
- 1:58cards have a fast
- 2:00for multiplying small whole numbers. The
- 2:02P100 doesn't. Our first patch swapped in
- 2:05another one, 28.9.
- 2:07Then we measured it.
- 2:09That instruction runs at half speed on
- 2:11this chip. Half.
- 2:14So my AI agents and I wrote a new
- 2:16version of that one job. Programmers
- 2:18call it a kernel. 16 boxes per trip. The
- 2:21math moves to the half precision
- 2:22calculator, full speed on this card.
- 2:25Normally that one rounds off, but these
- 2:27numbers are so tiny every sum stays
- 2:29under 2048 and down there nothing
- 2:32rounds. So the answers come out exactly
- 2:34the same, 36.2.
- 2:37Then we switched on a shortcut the fork
- 2:39already had for newer cards. 401 little
- 2:41jobs per token gone. 37.3.
- 2:45One change. Test. Check the answers
- 2:48again and again. Wax on, wax off.
- 2:52Then speculative decoding. In my first
- 2:55video the guesses came from a little
- 2:57head built into the model. Bonsai's file
- 2:59doesn't have one. So first we try a
- 3:02separate draft model. It guesses ahead,
- 3:04the big one checks.
- 3:0637 went to 20. Great. Faster at going
- 3:10backwards. Thanks buddy. Checking five
- 3:12tokens at once cost four and a half
- 3:14normal tokens because this card is
- 3:16already busy with the math.
- 3:19But the numbers did say one thing. The
- 3:21guessing was cheap. The checking was
- 3:23slow, still on the old kernel. Our
- 3:26estimate, a new checking kernel plus a
- 3:28little head guessing just one token
- 3:30ahead, maybe 42.
- 3:33So the new kernel learned to check two
- 3:34or three tokens at once. [snorts] One
- 3:36forklift trip, boxes unpacked once for
- 3:39all of them. And this time not a second
- 3:41model. A tiny guesser head from Pro
- 3:43Creations added onto the model. One
- 3:46guess ahead.
- 3:4743.4.
- 3:4943.4 tokens a second on one freaking
- 3:52card from 2016. That's with MTP. The
- 3:56kernel on its own does 37.3 and the head
- 3:59guessed right about seven to nine times
- 4:01out of 10.
- 4:02Okay,
- 4:03but did it get dummer? Because fast and
- 4:06wrong I can do myself. Every step we ran
- 4:09the same three test prompts, some pros,
- 4:12some code, a list. At temperature zero,
- 4:15so the model always picks its top word,
- 4:17no dice rolls. Then we compared the full
- 4:19text with the step before, word for word
- 4:22the same all the way back to stock. Five
- 4:24out of five on the reasoning questions,
- 4:26every step. And the perplexity, that's a
- 4:29score for how surprised the model is by
- 4:31a test text. Lower is better. Stock
- 4:33build, 6.0368.
- 4:36New kernel before the guesser head,
- 4:386.0368.
- 4:40No, that's not a typo. Same in every
- 4:43chunk, too. So no, it didn't get dummer,
- 4:46at least not on what I tested.
- 4:49Long chats got faster, too. 30,000
- 4:51tokens deep, that's a long report pasted
- 4:54in. And about 20 tokens a second became
- 4:56about 30.
- 4:58And there's one setting, batch size,
- 5:00that reads long prompts faster from
- 5:02about 116 to 160 tokens a second. No new
- 5:06kernel needed. But it can change a word
- 5:08here and there, so it's not in my same
- 5:10answers test. Details are in the
- 5:12description. The guesser head adds half
- 5:14a gig, and all of it still fits in about
- 5:1710 GB of the 16. I mean, on one card.
- 5:21Is there more? A bit. The new kernel is
- 5:24still about 4 milliseconds per token
- 5:26slower than the same reads with no math
- 5:28at all.
- 5:29Close that, and our estimate is about 45
- 5:32without the guesser. I didn't test it.
- 5:35So of course I got greedy. One guess
- 5:38ahead gave 43. Two guesses ahead?
- 5:4139.2
- 5:43slower. Classic. Up at the casino and
- 5:46you just have to go one more round.
- 5:49Every extra guess has to be checked, and
- 5:51on this card checking isn't cheap. Oh,
- 5:54and CUDA graphs, supposed to cut the
- 5:56waiting. The fork turns them off on this
- 5:58card, so we turn them on. And they
- 6:00really switched on.
- 6:011% slower. We tried a bunch of other
- 6:04kernel ideas too. Everyone exact and not
- 6:07one of them faster. So one guess it is.
- 6:11That's the actual card by the way, the
- 6:13top one. Okay, the catch I promised. In
- 6:16my first video, two of these cards ran
- 6:18the regular 27B Quen 3.8 at 67 tokens a
- 6:22second. Bonsai on one card does 43.4
- 6:26with MTP. Different model, different
- 6:28test, you know, but two cards are still
- 6:30faster. So Bonsai on one card, it fits
- 6:34and it got a lot faster. It just doesn't
- 6:36beat two. And you know what I like about
- 6:39it? It only needs one card. So the
- 6:41second card is yours.
- 6:43Run two Bonsais at the same time working
- 6:46on different things or one is the main
- 6:48brain and the other one is an agent or
- 6:50put a model there that always has to be
- 6:52on doing its own job. Whatever you need.
- 6:55That card is free now. And to be fair, I
- 6:58checked that Bonsai gives the same
- 7:00answers on my test prompts as before our
- 7:02changes. I didn't test if it's as smart
- 7:04as the big model on real work or measure
- 7:06the power. That's for another day.
- 7:08Patience, Daniel San.
- 7:10Big thanks to Prism ML for the model and
- 7:13to Pro Creations for the guesser head.
- 7:15Their names are in the description. So
- 7:17yeah, one card from 2016, a 7 gig model,
- 7:2143 tokens a second with MTP and the same
- 7:24answers as stock on my tests. And my
- 7:26wallet, still not invited. So tell me,
- 7:30what's on your one card and what should
- 7:32I squeeze next?
About this transcript
This page contains the full transcript of Ternary Bonsai 2 27B in 7 GB: 43 tok/s on One Nvidia P100 by Junk GPU Lab, generated from the public captions YouTube serves with the video. The transcript has 1,217 words across 181 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.