litgpt  by Lightning-AI

LLM SDK for pretraining, finetuning, and deploying 20+ high-performance LLMs

Created 2 years ago
12,754 stars

Top 3.9% on SourcePulse

GitHubView on GitHub
Project Summary

LitGPT provides over 20 high-performance Large Language Models (LLMs) with comprehensive recipes for pretraining, finetuning, and deployment. It targets developers and researchers seeking efficient, scalable, and customizable LLM solutions, offering a no-abstraction, beginner-friendly approach for enterprise-grade applications.

How It Works

LitGPT implements LLMs from scratch, prioritizing performance and minimal abstractions. It leverages PyTorch Lightning Fabric for distributed training across GPUs and TPUs, supporting advanced techniques like Flash Attention v2, Fully Sharded Data Parallelism (FSDP), and parameter-efficient finetuning methods (LoRA, QLoRA, Adapters). This design enables reduced memory usage through quantization (4-bit, 8-bit) and mixed-precision training (FP16, BF16), facilitating efficient operation on lower-memory GPUs and at scale.

Quick Start & Requirements

  • Install: pip install 'litgpt[all]'
  • Prerequisites: Python 3.8+, PyTorch. GPU recommended for training/inference.
  • Usage: Load and generate text with from litgpt import LLM; llm = LLM.load("microsoft/phi-2"); llm.generate(...)
  • More Info: Quick start, Models, Finetune, Deploy

Highlighted Details

  • Supports 20+ LLMs including Llama, Code Llama, Gemma, Phi, Qwen, Mistral, and Falcon.
  • Offers optimized workflows for pretraining, finetuning (LoRA, QLoRA), evaluation, and deployment.
  • Features quantization (4-bit, 8-bit) and mixed-precision training for reduced memory footprint.
  • Includes validated YAML configuration files for training recipes and CLI overrides.
  • Powers projects like SAMBA, the NeurIPS 2023 LLM Efficiency Challenge, and TinyLlama.

Maintenance & Community

Licensing & Compatibility

  • Released under the Apache 2.0 license, permitting unlimited enterprise use.

Limitations & Caveats

Some model downloads may require an additional access token, as detailed in the documentation. The project is built upon Lightning Fabric, extending nanoGPT and Lit-LLaMA.

Health Check
Last Commit

5 days ago

Responsiveness

1 day

Pull Requests (30d)
21
Issues (30d)
7
Star History
127 stars in the last 30 days

Explore Similar Projects

Starred by Casper Hansen Casper Hansen(Author of AutoAWQ), Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), and
5 more.

xtuner by InternLM

0.5%
5k
LLM fine-tuning toolkit for research
Created 2 years ago
Updated 1 day ago
Starred by Clement Delangue Clement Delangue(Cofounder of Hugging Face), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
20 more.

accelerate by huggingface

0.3%
9k
PyTorch training helper for distributed execution
Created 4 years ago
Updated 1 day ago
Feedback? Help us improve.