Skip to content

Add 🦀 Rust port with safety + CUDA to notable forks#827

Open
phildav wants to merge 1 commit intokarpathy:masterfrom
phildav:docs/rust-port
Open

Add 🦀 Rust port with safety + CUDA to notable forks#827
phildav wants to merge 1 commit intokarpathy:masterfrom
phildav:docs/rust-port

Conversation

@phildav
Copy link
Copy Markdown

@phildav phildav commented Sep 11, 2025

Motivations

Rust is focused on performance and reliability (cf Rust), so I found it particularly interesting to see how these principles apply to an LLM training loop.

Although there are 2 Rust projects listed in notable forks, their focus is not on safety or CUDA support. This was my motivation starting this new port.

I tried to make the code as idiomatic and safe as possible, while keeping the CPU/GPU path close to the llm.c structure for easier comparison and educational value.

Features

  • 100% safe CPU training loop
  • safe (minimal unsafe blocks for the GPU kernel launchers) and idiomatic Rust
  • CUDA support
  • training results are bit-exact with the reference implementation
  • devcontainer and modal.com support for the GPU poor 🙋

Link

llm.rs 🦀 https://github.com/phildav/llm.rs

Performances

Full description in the README.md

Here is a quick preview:

cpu_training_time gpu_training_time

@phildav phildav changed the title Add Rust port with safety + CUDA to notable forks Add 🦀 Rust port with safety + CUDA to notable forks Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant