SuperAPI AI Directory

litgpt

20+ high-performance LLMs, with solutions for pretraining, fine-tuning, and large-scale deployment.

Open website

About this tool

  1. Purpose LitGPT is an open-source toolkit for the full lifecycle of large language models (LLMs), covering pretraining, continued pretraining, fine-tuning, evaluation, deployment, and testing. The goal is to enable developers to quickly train and run LLMs locally or on large-scale clusters with minimal abstraction and full control.

  2. Main Capabilities

  • 20+ high-performance LLMs: each model is implemented from scratch, with no internal abstraction layers, supports single-file implementation, is easy to debug and modify, and is performance-optimized for enterprise scale.
  • Training and fine-tuning: supports pretraining, continued pretraining, and fine-tuning; provides parameter-efficient fine-tuning methods such as LoRA, QLoRA, Adapter, and Adapter v2.
  • Deployment: can deploy pretrained or fine-tuned models, automatically sets up a web server for websites or applications to call via API.
  • Evaluation: supports benchmarks such as MMLU and Truthful QA, evaluating model performance on tasks such as chemistry and programming.
  • Quantization and low memory: supports 4-bit floating point, 8-bit integer, and double quantization, and can run on low-memory GPUs.
  • Precision settings: supports FP16, BF16, and FP16/FP32 mixed precision, reducing computational requirements.
  • Optimization features: Flash Attention v2, multi-GPU fully sharded data parallel (FSDP), optional CPU offloading, TPU and XLA support.
  • Configuration files: provides validated YAML training recipes, and all fine-grained parameters can be customized.
  • Datasets: includes a variety of commonly used pretraining and fine-tuning datasets, and supports custom datasets.
  • Export: supports export to other popular model weight formats.
  • Command-line interface: run workflows such as download list, finetune, pretrain, evaluate, deploy, and chat through the litgpt command.
  1. Usage
  • Installation: install from source (the official text does not provide the complete code for the specific command, only mentions "Install from source").
  • Download models: run litgpt download list List all available models; downloading some models requires an additional access token.
  • Finetuning: after selecting a model, run the finetune workflow (see the official finetuning docs for full documentation).
  • Deployment: run the deploy command to automatically set up a web server, which can be tested and integrated with the API in another terminal.
  • Evaluation: run the evaluate workflow to test model performance on tasks such as MMLU and Truthful QA.
  • Chat: use the chat command for interactive conversation, extracting embeddings, etc., for example using the Phi-2 model.
  • Pretraining and continued pretraining: use the command-line interface to run on your own data.
  • Configuration files: customize training parameters through YAML configuration.

IV. Use cases

  • Enterprise-level LLM training, finetuning, and deployment.
  • Research experiments: needing to modify model code and try the latest research ideas.
  • Resource-constrained environments: run on limited hardware through quantization, low precision, and CPU offloading.
  • Large-scale training: multi-GPU and TPU clusters, with the help of FSDP and XLA.
  • Projects and competitions: such as Samba, TinyLlama, MicroLlama, NeurIPS 2023 LLM Efficiency Challenge, etc., are all based on or use LitGPT.

V. Limitations and notes

  • The official text does not provide specific installation commands, pricing, charging models, or platform restrictions and other details, so they are not provided for now.
  • Deployment sets up a web server by default, but specific interface details need to refer to the official deployment documentation.
  • Downloading some models requires an access token; see the download documentation for details.
  • The license is Apache 2.0, allowing unrestricted enterprise use.
  • Citation requirements: if used in research, the specified work must be cited (the specific citation format is not fully given in the official text).

VI. Project highlights LitGPT is extended based on Lit-LLaMA and nanoGPT and is powered by Lightning Fabric. It has been used in projects such as Samba (Microsoft), TinyLlama, MicroLlama, and the official starter kit of the NeurIPS 2023 LLM Efficiency Challenge. Contributions are welcome, including feature requests, submissions, and the Discord community.