Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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).

 help



I made an explicit reverse pass (no autodiff), it was 8x faster in Python

tradeoff worth naming: you avoid the autodiff graph overhead (hence the speedup), but any architecture change means rewriting every gradient by hand. fine for a pedagogical project, but that's exactly why autodiff exists.

I made an explicit double-reverse pass (no code!), it was 80x faster in my head!


code here, it's just not interesting to look at:

https://news.ycombinator.com/item?id=47220542


Can you share a link?

https://www.ideone.com/VAz4Nn

Doesn't run inside IDEone due to the external download link, but you can copy&paste the code over




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: