Skip to content

Guide · Agent skill

How to use the LitGPT fine-tuning agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

This guide explains how to install and use the implementing-llms-litgpt skill, which teaches an AI agent to work with LitGPT, an open-source toolkit of readable single-file implementations of more than 20 open language models. It is written for people who have never used an agent skill before. By the end you will know what the skill lets the agent do, how to add it to Claude, how to ask for work in plain language, and what hardware and safety precautions to consider.

LitGPT LLM Implementation and Fine-TuningOrchestra-Research/AI-Research-SKILLs · MIT

Quick start

  1. 1Download the skill ZIP. Get the implementing-llms-litgpt ZIP from the item page on this site.
  2. 2Install the skill folder. Unzip it into ~/.claude/skills/ for personal use or into .claude/skills/ in a project, or upload it under Settings → Capabilities → Skills in the Claude apps.
  3. 3Install LitGPT. Run pip install 'litgpt[extra]' in a Python environment that also has PyTorch and transformers.
  4. 4Make a request. Ask Claude in plain language for a task, such as fine-tuning a named model with LoRA on your JSON dataset.
  5. 5Review the commands. Check the file paths, model name and GPU settings the agent proposes before approving any run.
  6. 6Train and check the output. Watch the logs in out/finetune/ and confirm the checkpoint was written to your output folder.

What the LitGPT skill makes the agent do

An agent skill is a folder of instructions and reference files that Claude can load when a task matches it. This skill covers LitGPT, which provides clean implementations of pretrained architectures such as Llama, Gemma, Phi, Qwen and Mistral. Once the skill is loaded, the agent knows how to download a model, prepare a dataset, fine-tune the model, merge the results and pretrain a model from scratch.

The skill is aimed at people who want to understand or customise model internals, not only call a hosted API. Its documentation describes the core model code as living in a single file, with classes such as GPT, Block and CausalSelfAttention.

  • Download pretrained models with the litgpt download command
  • Fine-tune with full training or with LoRA (small add-on weights instead of the whole model)
  • Merge LoRA weights into a base model for deployment
  • Pretrain from scratch, including multi-GPU training with FSDP

How to install the LitGPT skill

Download the skill ZIP from the item page on this site. Unzip it into one of two locations. For a personal install, use ~/.claude/skills/. For a single project, use the .claude/skills/ folder inside that project. Either way, the unzipped folder should contain SKILL.md and its references folder.

If you use the Claude apps instead, you can upload the skill under Settings → Capabilities → Skills rather than placing files on disk.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project
  • Claude apps: Settings → Capabilities → Skills

Set up the LitGPT package the skill needs

The skill's examples assume the litgpt package is installed with pip, along with PyTorch and transformers. The source installs LitGPT with the extras bundle shown below. You need Python with pip and an NVIDIA GPU to run the training examples.

You can ask the agent to check the setup for you, but you should read any command it proposes before running it.

pip install 'litgpt[extra]'

How to trigger the skill with natural requests

You do not need special syntax. Describe the task in plain language and mention LitGPT or the model you have in mind. The skill's description says it applies when you need clean model implementations, educational understanding of architectures, or production fine-tuning with LoRA or QLoRA.

Be specific about your data file, your GPU and your goal. The more of this you give, the better the agent can choose between full fine-tuning and LoRA.

  • Fine-tune microsoft/phi-2 with LoRA on data/my_dataset.json. I have a 16GB GPU.
  • Explain how the attention block is implemented in LitGPT's Llama model.
  • Download google/gemma-2b with LitGPT and show me how to test it locally.
  • Merge the LoRA adapter in out/phi2-lora/final into a standalone model.

Example: LoRA fine-tuning on one GPU

The skill recommends LoRA for limited GPU memory. Its guidance lists Phi-2 as a good quality-to-size trade-off for 12-16GB, with Llama 3 1B as the smallest and fastest option. The source uses a rank of 16 and a learning rate of 1e-4 as a standard starting point.

Training writes results to an output folder, here out/phi2-lora. After training, the source shows how to merge the adapter for deployment.

  • Dataset format: the source uses Alpaca-style JSON records with instruction, input and output fields.
  • Save the dataset as data/my_dataset.json or change the path in the command.
litgpt finetune_lora \n microsoft/phi-2 \n --data JSON \n --data.json_path data/my_dataset.json \n --lora_r 16 \n --train.epochs 3 \n --train.learning_rate 1e-4 \n --train.micro_batch_size 4 \n --train.global_batch_size 32 \n --out_dir out/phi2-lora

What you need before you start

The skill lists its requirements plainly. The GPU memory figures are the most important: the source gives about 12-16GB for LoRA and 40GB or more for full fine-tuning of 7B models. Ordinary laptops will usually fail or be impractical for training.

Gated models such as Llama 3 are downloaded from Hugging Face. The source does not state this requirement explicitly, but downloading meta-llama models implies you need a Hugging Face account and access token, and approval for the model.

  • Python with pip
  • The litgpt package, installed with pip install 'litgpt[extra]'
  • PyTorch and transformers
  • An NVIDIA GPU with enough memory for your chosen method
  • A Hugging Face account and access token for gated models (implied, not stated in the source)

Safety notes: scripts and network access

This skill runs scripts and uses the network. Downloading models fetches files from the internet. Training commands read your datasets and write checkpoints and logs to local folders such as checkpoints/ and out/. Long or multi-GPU jobs, including SLURM cluster runs shown in the source, can be slow and costly.

Do not send sensitive or proprietary data through an unknown setup. Review each command the agent proposes, check the file paths, and confirm the GPU you are using before you approve a run.

  • Read every command before the agent runs it
  • Keep private datasets on machines you control
  • Check output folders so you do not overwrite earlier checkpoints
  • Start with a small max_steps value to confirm the setup works

Tips for better results

Start with a small model and a short run to confirm your data and hardware work. The source suggests Phi-2 or Gemma 2B for limited memory. Once a run succeeds, scale up gradually.

If you are unsure which LoRA settings to use, the skill's guide gives rough guidance: rank 8 for lightweight adapters, 16 as a standard choice, and 32 or 64 for more complex tasks at higher memory cost. Monitor training with the log file in out/finetune/ or with TensorBoard if you enabled it.

  • Use LoRA before full fine-tuning unless you have 40GB+ of GPU memory
  • Keep the LoRA rank modest and increase it only if quality is lacking
  • Use litgpt download list to see which models are available
  • Check the reference files for model lists and distributed training details

What people use it for

  • Fine-tuning a 2.7B model like Phi-2 on your own instruction data using LoRA on a single 16GB GPU
  • Reading how a transformer architecture such as Llama or Mistral is built, for teaching or research
  • Merging a LoRA adapter into a base model to produce a standalone model folder for deployment
  • Planning a multi-GPU or multi-node pretraining run with FSDP for a domain-specific model

Frequently asked questions

Is the LitGPT skill free to use?

The skill is published under the MIT licence, as stated on the item page. LitGPT is an open-source toolkit, but your compute costs for GPUs, cloud or cluster time are not covered by the licence and can be substantial.

How much GPU memory do I need for LitGPT fine-tuning?

The skill gives about 12-16GB for LoRA fine-tuning and 40GB or more for full fine-tuning of 7B models. Training on ordinary laptops will usually fail or be impractical. Smaller models such as Phi-2 are the recommended starting point under those limits.

Do I need a Hugging Face account to use LitGPT?

For public models you may not need one, but gated models such as Llama 3 require a Hugging Face account and access token. The source does not state this explicitly; it is implied by the meta-llama downloads in the examples.

What is the difference between LoRA and full fine-tuning?

Full fine-tuning updates all of the model's weights and needs much more GPU memory. LoRA trains small add-on weights while the base model stays frozen, so it fits on a single 12-16GB GPU. The skill recommends LoRA for limited memory.

Can the LitGPT skill run without a GPU?

The skill's training examples assume an NVIDIA GPU. Without one, the training commands are not practical. The skill can still explain model architectures, which requires no training.

How does LitGPT compare with Hugging Face transformers?

LitGPT focuses on readable, single-file model implementations and training workflows for popular open models. The skill's description says it avoids abstraction layers. Hugging Face transformers is a broader library. Choose LitGPT when you want to read or modify model internals, and the transformers library when you need a wider ecosystem.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are an ML engineer or researcher with an NVIDIA GPU who wants to fine-tune open models on your own data or study clean transformer code. Pick something else if you only need a chat or API integration, or if you do not have suitable GPU hardware, because the examples write files and launch costly jobs.

Download the skill