MicroGPT-C in pure C hits 10M TPS on Apple M5(github.com) |
MicroGPT-C in pure C hits 10M TPS on Apple M5(github.com) |
[1] see eg https://github.com/OpenMathLib/OpenBLAS/tree/develop/kernel/...
Even if counting that it is basically calling into C or C++ libraries, there is lots of boilerplate that the CPU has to consume, that just won't happen on the pure C implementation.
What sense of the word "atomic" is meant here?
This leads to some interesting optimizations. You can quantize all the parameters (or certain layers) of a model and halve or quarter the memory requirement but maintain most of the model's intelligence. This increases the token rate inversely with the size reduction.
Popular quantizations for local models are 8-bit and 4-bit parameter sizes. The Blackwell series of nVidia chips now even support native FP4 math making 4-bit quantizations even faster.
And this implements a transformer. Actually it is a very cool didactic example.
Anyway, I just tested this out myself on my AMD Ryzen 9 9800x3d. I got 7647173 tok/sec using karpathy's Shakespeare dataset https://raw.githubusercontent.com/karpathy/char-rnn/master/d.... Going to play around with it and see if I can get a CUDA kernal built to see what it could do on a 5090. Claude estimates with napkin math that we could get around 2B tok/s
Anyways, it was also stupid fast, particularly compared to the python version. But I was pretty sure that's irrelevant to real production architectures!
>fast .. irrelevant ..
I ask myself this question all the time, but I'm not sure I'll like the answer: have we really attained peak performance in the engines, if we're "using python for everything" .. ?
Am I reading this right? Then I need to try this on Strix Halo
But even those should comfortably run an SLM of around 100-400M parameters at crazy high speeds and with minimal power usage.
And then, while I'm waiting for a response on things, the mind wanders to thinking about what the rust camp are doing, with regards to AI/ML.
To my addled mind, it really seems like the first thing to be done when getting the models firing, is turn them on their own tools and optimize, optimize, optimize. I'd sure like to know what the frontier labs are doing to squeeze those ergs out of our substrates.
Does anyone have clues what the landscape looks like outside the python tooling, vis a vis higher-performance infrastructure? Being glib about it I admit, it just seems 'odd' that the C/C++/Rust camp are letting scripting languages drive the AI/ML ship.
They do exist, but again, not really loved enough.
https://clang.llvm.org/docs/ClangRepl.html
https://github.com/jupyter-xeus/xeus-cling
Additionally, while in the past there are been nice high level libraries for C++, which is where Java took its inspiration from in first place[0], current culture seems to hate having such frameworks around, and they are mostly gone nowadays.
[0] - It isn't writing Java in C++, rather how C++ inspired by Smalltalk used to look like, 1983 - 2000's, before Java got released in 1996.
https://en.wikipedia.org/wiki/Bitter_lesson
Over time, I'm sure we'll be able to filter information better and get parameter counts down, but I wouldn't count on that within the next 6 months.
Always been disappointed by the answer to that question in the past - fingers crossed this time
Software support for that kind of usage, when available, will be immensely impactful.
That said, I am more interested in what size model this could manage while producing “just enough” tokens per second to work at a conversational rate. What are models in that class capable of doing for me?
I love "trivial" examples and everything you've said is tue.
In compute performance, 10M tok/s * 4096 parameter/tok * 4 byte/param = ~160 GiB/sec implied memory bandwidth, vs nominal ~300 GB/sec for the M5 Pro's RAM. That seems even less notable once we consider that 4096 parameter * 4 byte/param = 16 KiB of parameters fit easily within L1 data cache (the M5's efficiency cores each have 64 KiB of L1 data cache). 40 GFLOPs means ~10 FLOP/cycle, about 2.5 NEON instructions per cycle given that the core instructions are fused multiply-adds (FMAs). A random web page I found says the M5 family cores have a 4-wide SIMD block, meaning this gets about 63% utilization: respectable but not super high.
What is this based on? Every researcher I've heard talk about this says it's exactly not true, as an uncontested rule, because the larger models will more effectively contain the smaller models, and use them together in ways that the connections between the smaller models can't. Remember, even MOE is to save compute/memory, not to help performance/parameter.
But, it depends on what you're measuring. By spatial/navigational memory, yes, elephants are far far better. Reasoning, no. It would be interesting to see what an elephant or whale eugenics program could result in, since humans have that pesky (or maybe instrumental?) birth canal problem.