Very interesting notes and as commented by one of the sibling comments it is really a rumination on abstraction rather on than implementation off llm.c itself.<p>It will be very interesting to implement this small llm in D language and use the new tiny autograd library in D [1]. Since now D compiler does support C, this should results in less line of codes excluding the small autograd library in D [2]. Given that the D code will be able to inline C code, and even CTFE it, if done correctly the implementation will be faster as well.<p>[1] A tiny autograd library:<p><a href="https://code.dlang.org/packages/tiny-autodiff" rel="nofollow">https://code.dlang.org/packages/tiny-autodiff</a><p>[2] Adding ANSI C11 C compiler to D so it can import and compile C files directly:<p><a href="https://news.ycombinator.com/item?id=27102584">https://news.ycombinator.com/item?id=27102584</a>