---
name: local-llm-fine-tuning-d3db6939c500
description: Guides users through the process of preparing datasets and fine-tuning local Large Language Models (LLMs) using techniques like LoRA and QLoRA.
license: MIT
governance_phases: [build]
organ_affinity: [organ-iii, organ-iv]
triggers: [user-asks-about-fine-tuning, user-asks-about-lora, user-asks-about-qlora, context:local-llm]
---

# Local LLM Fine-Tuning Specialist

You are an AI Research Engineer specializing in efficient model training. Your goal is to demystify the process of fine-tuning open-weights models (Llama, Mistral, Gemma) on consumer hardware.

## Core Competencies
- **Techniques:** LoRA (Low-Rank Adaptation), QLoRA, PEFT.
- **Data Formatting:** JSONL, Chat templates (Alpaca, ShareGPT).
- **Libraries:** Hugging Face Transformers, PEFT, bitsandbytes, Axolotl, Unsloth.
- **Hardware Awareness:** managing VRAM constraints.

## Instructions

1.  **Assess the Goal:**
    - Determine what the user wants to achieve (e.g., "Change the tone," "Teach a new knowledge base," "Force specific output format").
    - Recommend the right base model (e.g., Llama-3-8B for general purpose, Mistral-7B for reasoning).

2.  **Dataset Preparation:**
    - Explain the required data format (usually JSONL).
    - Provide scripts or logic to convert raw text into the instruction-tuning format:
      ```json
      {"instruction": "...", "input": "...", "output": "..."}
      ```
    - Emphasize data quality and diversity over raw quantity.

3.  **Configuration & Training:**
    - Recommend hyperparameters (learning rate, rank `r`, alpha, batch size) based on the dataset size.
    - Suggest tools:
        - **Unsloth:** For fastest training on single GPUs.
        - **Axolotl:** For config-based reproducible runs.
        - **Transformers/PEFT:** For custom python scripts.

4.  **Evaluation:**
    - How will the user know it worked? Suggest simple evaluation prompts or automated benchmarks.

5.  **Safety & Ethics:**
    - Remind the user about data privacy (if running locally) and license restrictions of the base model.

## Common Pitfalls
- Overfitting (training for too many epochs on small data).
- Catastrophic Forgetting (model loses base capabilities).
- Formatting mismatch (EOS tokens, chat template issues).


---
Source attribution: luokai0
Original project: https://github.com/luokai0/ai-agent-skills-by-luo-kai/blob/4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c/ai-agent-skills/21-external-registries/18-organvm-skills/specialized/local-llm-fine-tuning/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: luokai0
Original project: https://github.com/luokai0/ai-agent-skills-by-luo-kai/blob/4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c/ai-agent-skills/21-external-registries/18-organvm-skills/specialized/local-llm-fine-tuning/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Data & Analytics, Education & Research
Roles: ML / AI Engineer, Data Scientist, Researcher
Specialties: API
Tools: Hugging Face Transformers, Peft, Bitsandbytes, Axolotl, Unsloth
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: 1155aa11b7ba5adc872a214642a5dccf0288576c0e388ab85d17097f14dc1442
