News for hackers. Stuff that matters.
Re:Microgpt by verma7 on Sunday March 01, 2026 @01:00AM (#47204123)
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).

Re:Microgpt by WithinReason on Sunday March 01, 2026 @04:21AM (#47205095)
I made an explicit reverse pass (no autodiff), it was 8x faster in Python
Re:Microgpt by love2read on Sunday March 01, 2026 @06:05PM (#47211719)
Can you share a link?
Re:Microgpt by WithinReason on Monday March 02, 2026 @11:54AM (#47220542)
https://www.ideone.com/VAz4Nn

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

Re:Microgpt by hu3 on Sunday March 01, 2026 @11:56PM (#47214042)
I made an explicit double-reverse pass (no code!), it was 80x faster in my head!
Re:Microgpt by spopejoy on Monday March 02, 2026 @09:20AM (#47218280)
Re:Microgpt by WithinReason on Monday March 02, 2026 @04:26PM (#47224335)
code here, it's just not interesting to look at:

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

Re:Microgpt by bear3r on Monday March 02, 2026 @12:13AM (#47214104)
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.
Re:Microgpt by freakynit on Thursday March 05, 2026 @04:27AM (#47259545)
24x speedup (over 10x already) and similar loss profile (for c++ version, optimized by claude): https://gist.github.com/freakynit/3982eab8413a89941bd0018e63......
Re:Microgpt by verma7 on Sunday March 08, 2026 @12:25AM (#47294693)
This is amazing! Thanks for optimizing the code using Claude!