An interesting and very informative toy implementation.

https://github.com/karpathy/llm.c