dorjeduck/llm.mojo
port of Andrjey Karpathy's llm.c to Mojo
What it solves
It demonstrates that the Mojo programming language can implement low-level, C-style AI training code—utilizing raw pointers and manual memory management—while matching or exceeding the performance of C.
How it works
This project is a direct port of an earlier version of Andrej Karpathy's llm.c (specifically the train_gpt2.c implementation). It implements the GPT-2 training process in Mojo, allowing users to train a model on datasets like TinyShakespeare.
Who it’s for
Developers and researchers interested in the performance characteristics of Mojo compared to C for low-level machine learning implementations.
Highlights
- High Performance: Benchmarks on an M2 MacBook Pro show the Mojo implementation achieving higher throughput (150 tok/s) than the OpenMP-enabled C version (128 tok/s).
- Low-Level Control: Implements raw pointers and manual memory management to mirror the original C project.
- Validation: Includes a ported version of
test_gpt2.cto ensure the functionality of the port is correct.
Related
- Dispatch
- Dispatch
- Project
- Project
- Project