Lit-Llama is Lightning AI’s clean-room, hackable implementation of the LLaMA language model, written in the spirit of nanoGPT: the whole model lives in readable PyTorch code instead of a tangle of configuration files. It has about 6,100 stars on GitHub and is released under the Apache 2.0 license.
The project implements LLaMA training and inference with the techniques practitioners actually use: Flash Attention for speed, Int8 and GPTQ 4-bit quantization for cheap inference, and LoRA plus LLaMA-Adapter for parameter-efficient fine-tuning, alongside plain pre-training. Because everything is explicit PyTorch, researchers can read exactly how the model works and modify it for experiments. One honest caveat, stated in the repository itself: Lit-Llama is no longer actively maintained, and the Lightning team points new users to its successor, LitGPT, which covers many more model architectures.
Lit-Llama grew out of the same philosophy as nanoGPT โ the codebase it is modeled on โ namely that a training implementation should be short enough to hold in your head. That made it a popular starting point for courses, blog posts and fine-tuning experiments in the first wave of open LLaMA adoption, and its quantization and adapter code was widely copied into other projects. Lightning AI later generalized the approach into LitGPT, which covers Llama, Mistral, Gemma, Qwen and many other architectures with the same readable style.
Free. Lit-Llama is open source under the Apache 2.0 license; you supply your own compute and model weights.
Researchers and engineers who want to understand or experiment with LLaMA internals in transparent code โ keeping in mind the maintainers now recommend LitGPT for new work.