litgpt  by Lightning-AI

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

created 2 years ago
12,563 stars

Top 4.0% 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

1 week ago

Responsiveness

1 day

Pull Requests (30d)
10
Issues (30d)
4
Star History
561 stars in the last 90 days

Explore Similar Projects

Starred by Tobi Lutke Tobi Lutke(Cofounder of Shopify), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
2 more.

xTuring by stochasticai

0.0%
3k
SDK for fine-tuning and customizing open-source LLMs
created 2 years ago
updated 10 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Philipp Schmid Philipp Schmid(DevRel at Google DeepMind), and
2 more.

LightLLM by ModelTC

0.7%
3k
Python framework for LLM inference and serving
created 2 years ago
updated 11 hours ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), and
2 more.

lit-llama by Lightning-AI

0.1%
6k
LLaMA implementation for pretraining, finetuning, and inference
created 2 years ago
updated 1 month ago
Starred by Lewis Tunstall Lewis Tunstall(Researcher at Hugging Face), Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), and
5 more.

torchtune by pytorch

0.2%
5k
PyTorch library for LLM post-training and experimentation
created 1 year ago
updated 1 day ago
Feedback? Help us improve.