We wrote an LLM inference engine in Zig.
@rachpradhan3.8K followers
18,991 views
37 Comments
Comments from the original post on X (Twitter)

@rachpradhan
The take: one prompt, 1,473 tokens in 11.7 seconds. That's 7.95 ms a token. Flint thought for 363 tokens (2.9 s), then wrote 1,110 more: the code, then how it works. About 75 words a second. Greedy, free-running, nothing sped up.
12 likes

@rachpradhan
Furthermore, we plan to introduce a megakernel in the middle, with support for models like @googlegemma and @liquidai For the best harness with Flint, we are using @trycodegraff Download the nanoharness here directly(you can log in with ur CC, Codex, Xai subs): (our new nanoui frontend that works across MacOS, iOS, Windows and Linux). Or to view the engine: (its MIT so feel free to do whatever you'd want with it)
23 likes

@rachpradhan
Why Zig? Not because it makes a GPU faster. It doesn't. Because every allocation, every buffer and the whole schedule is in plain sight. When a token costs 8 ms, you can find out where each of them went. Flint is Recursive's model:
21 likes

@rachpradhan
Thanks to the team at @Recursive_SI for the model and weights! Building on the point about Zig and visibility into execution, the kernel was optimized using QD-guided local search, combining a round-robin of quality-diversity algorithms with stepwise hill climbing on the best-performing elite, alongside several kernel execution emulations. It was inspired from and used @jeffclune's work on map elites! Paper:
11 likes

@rachpradhan
A deeper blog post would be over at @trycodegraff or in a few days! So do follow that account!
7 likes

@rachpradhan
Join the discord for nanoui over at
6 likes

@AxelGarciaK
Good job! Zig is a great language
3 likes

@RISHilift
no mlx, no pytorch, no python in the model. just zig talking straight to metal. this is the good stuff
3 likes

@cryptopatrick
Who ever made that video can take the Friday off and just gloat - really nice!
2 likes

@kabearj
wtf this is sick
1 like

@akarshan_biswas
@LazyYuukiOG You might like this. :)
1 like

@Trumpyla
Wow
1 like

@vasanth_sreeram
Glad ur doing it there is a huge gap in optimising inference on a Mac
1 like

@meaningmean_
wow
1 like

@slopgremlin
same, lol
1 like

@coolgadgetru
LiquidAI will be cool
1 like

@borrowck_novel
Very nice! Off topic question if i may. What color scheme is this?
1 like

@rachpradhan
it’s codegraff dark!
1 like

@borrowck_novel
Thank you so much! Have a great day
1 like

@boardyai
for pushing past 125 tokens a second i know a founder shipping quantized on-device models, want an intro? dm never landed, tap below
1 like












