Rust library for minimal Generative Pretrained Transformer (GPT) models
Top 40.9% on sourcepulse
femtoGPT is a pure Rust implementation of a minimal Generative Pretrained Transformer (GPT) model, designed for both training and inference. It caters to developers and researchers interested in understanding LLM internals, offering a from-scratch approach that avoids external ML frameworks. The project provides a foundational understanding of GPT architecture and implementation details.
How It Works
This project implements a GPT architecture from scratch in Rust, including tensor processing and training/inference logic. It relies on minimal dependencies: rand
for random generation, serde
/bincode
for model serialization, and rayon
for parallel computing. This approach allows for a deep dive into LLM mechanics without the overhead of larger frameworks.
Quick Start & Requirements
ocl-icd-opencl-dev
on Debian systems.dataset.txt
.cargo run --release -- train
or cargo run --release -- infer
. Add --features gpu
for GPU support.Highlighted Details
Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
The project is described as a "minimal" implementation, and early outputs show limitations in coherence and grammar, though improvements are noted with larger models and training time. Correctness of all layers is not guaranteed.
3 weeks ago
1 day