Live data from Hacker News

Microgpt

karpathy.github.io

351–354 of 354 posts

Re: Microgpt

#351
post #91

I wrote a C++ translation of it: https://github.com/verma7/microgpt/blob/main/microgpt.cc 2x the number of lines of code (~400L), 10x the speed The hard part was figuring out how to represent the Value class in C++ (ended up using shared_ptrs).

24x speedup (over 10x already) and similar loss profile (for c++ version, optimized by claude): https://gist.github.com/freakynit/3982eab8413a89941bd0018e63......

Re: Microgpt

#352
post #91

I wrote a C++ translation of it: https://github.com/verma7/microgpt/blob/main/microgpt.cc 2x the number of lines of code (~400L), 10x the speed The hard part was figuring out how to represent the Value class in C++ (ended up using shared_ptrs).

24x speedup (over 10x already) and similar loss profile (for c++ version, optimized by claude): https://gist.github.com/freakynit/3982eab8413a89941bd0018e63... ...

This is amazing! Thanks for optimizing the code using Claude!

Re: Microgpt

#354
post #348
post #338

Earlier quoted context omitted.

how did you do the transliteration/port?

Handwritten! (aka no LLM assistance :) It wasn't transpiled or anything like that. I've been meaning to post a little about it on my blog; just been caught up with other stuff atm. One thing that was a _little_ frustrating coming from Python, though, was the need to rely on crates for basic things like random number generation and network requests. It pulls in a lot, even if you only need a little. I understand the R…

nice
Post reply on HN