{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "lightning-ai-litgpt--finetune-a-small-llm-on-your-own-json-data-with-litgpt",
 "repo": "Lightning-AI/litgpt",
 "repo_url": "https://github.com/Lightning-AI/litgpt",
 "repo_slug": "lightning-ai-litgpt",
 "title": "Finetune a small LLM on your own JSON dataset",
 "page_title": "How to finetune a small LLM on your own JSON dataset with Litgpt",
 "summary": "Use the Litgpt finetune command to train microsoft/phi-2 on a JSON file of examples, then chat with and serve the result.",
 "who": "A developer with a few thousand question and answer pairs from their own domain.",
 "problem": "Generic models answer domain questions vaguely, and writing a training loop takes days.",
 "outcome": "A finetuned checkpoint in out/custom-model/final that you can chat with and serve.",
 "steps": [
  "Install with `pip install 'litgpt[extra]'`",
  "Download the example dataset with `curl -L https://huggingface.co/datasets/ksaw008/finance_alpaca/resolve/main/finance_alpaca.json -o my_custom_dataset.json` or point to your own JSON file",
  "Run `litgpt finetune microsoft/phi-2` with `--data JSON`, `--data.json_path my_custom_dataset.json`, `--data.val_split_fraction 0.1` and `--out_dir out/custom-model`",
  "Test the result with `litgpt chat out/custom-model/final`",
  "Deploy it with `litgpt serve out/custom-model/final`"
 ],
 "agent_prompt": "Using Lightning-AI/litgpt, install it with `pip install 'litgpt[extra]'`, finetune microsoft/phi-2 on <my JSON dataset> with `litgpt finetune microsoft/phi-2 --data JSON --data.json_path my_custom_dataset.json --data.val_split_fraction 0.1 --out_dir out/custom-model`, then run `litgpt chat out/custom-model/final` and report five sample answers.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Intermediate",
 "time": "1 to 3 hours",
 "basis": "readme",
 "caveat": "Finetuning needs a GPU; training time depends on the dataset size and the card.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Python with pip",
  "A GPU for finetuning and pretraining",
  "Disk space for model weights"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "download",
   "notice": "The first run downloads the base model weights, which can be several gigabytes."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/lightning-ai-litgpt/finetune-a-small-llm-on-your-own-json-data-with-litgpt/",
 "md": "https://dedupedai.com/use-cases/lightning-ai-litgpt/finetune-a-small-llm-on-your-own-json-data-with-litgpt/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/lightning-ai-litgpt--finetune-a-small-llm-on-your-own-json-data-with-litgpt.json",
 "api_version": "v1"
}
