llama-factory
Guides fine-tuning of large language models with LLaMA-Factory, covering the WebUI no-code interface, training across 100+ supported models, quantized QLoRA at 2/3/4/5/6/8-bit precision, and multimodal model support. Use when setting up or configuring a LLaMA-Factory fine-tuning run, choosing a quantization level for QLoRA training, using the WebUI instead of writing training code, fine-tuning a multimodal model, or debugging a LLaMA-Factory training error. Not for general-purpose inference serving or for other training frameworks; use the matching skill for those.
Install this skill
Works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, and 70+ other harnesses.
npx skills add KalarisLabs/research-agent-skills --skill llama-factoryuvx research-agent-skills install llama-factoryDocumentation & Instructions
Llama-Factory Skill
Comprehensive assistance with llama-factory development, generated from official documentation.
When to Use This Skill
This skill should be triggered when:
- Working with llama-factory
- Asking about llama-factory features or APIs
- Implementing llama-factory solutions
- Debugging llama-factory code
- Learning llama-factory best practices
Quick Reference
Common Patterns
Quick reference patterns will be added as you use the skill.
Reference Files
This skill includes comprehensive documentation in references/:
- _images.md - Images documentation
- advanced.md - Advanced documentation
- getting_started.md - Getting Started documentation
- other.md - Other documentation
Use view to read specific reference files when detailed information is needed.
Working with This Skill
For Beginners
Start with the getting_started or tutorials reference files for foundational concepts.
For Specific Features
Use the appropriate category reference file (api, guides, etc.) for detailed information.
For Code Examples
The quick reference section above contains common patterns extracted from the official docs.
Resources
references/
Organized documentation extracted from official sources. These files contain:
- Detailed explanations
- Code examples with language annotations
- Links to original documentation
- Table of contents for quick navigation
scripts/
Add helper scripts here for common automation tasks.
assets/
Add templates, boilerplate, or example projects here.
Notes
- This skill was automatically generated from official documentation
- Reference files preserve the structure and examples from source docs
- Code examples include language detection for better syntax highlighting
- Quick reference patterns are extracted from common usage examples in the docs
Updating
To refresh this skill with updated documentation:
- Re-run the scraper with the same configuration
- The skill will be rebuilt with the latest information
Agent operating procedure
- Check the environment. Check GPU type, memory and driver/CUDA versions (
nvidia-smi), framework versions, and dataset location and size. - Pin down the inputs. Confirm formats, identifiers and parameters from the data or the user. Ask rather than guess any value that changes the result.
- Run a small version first. Do a smoke run: tiny model or subset, few steps, and confirm loss decreases and checkpoints save.
- Execute the full task using the instructions and references above.
- Validate the result. Track metrics on held-out data, compare against a baseline, and record seeds, configs and hardware.
- Report. State what was run (versions, commands, parameters), what was checked, and what is still uncertain.
| If this happens | Do this |
|---|---|
| CUDA out-of-memory | Reduce batch size, enable gradient accumulation/checkpointing or mixed precision, or shard the model. |
| Loss is NaN or diverges | Lower the learning rate, check data for invalid values, and enable gradient clipping. |
| A function, flag or endpoint in these instructions is missing in the installed version | Check the installed version's own documentation (help(), --help, official docs), adapt, and tell the user. Never invent an API. |
| A required input, identifier or parameter is ambiguous | Ask the user, or state the assumption explicitly before running. |
Integrity rules
- Never fabricate results, parameters, identifiers, citations or statistics. If something cannot be run or verified, say so plainly.
- Never claim training results without logs; estimate compute cost before launching large jobs.
- Treat version-specific details here as possibly outdated: confirm them against the official documentation for the installed version.
- Ask before actions that cost money, consume shared GPUs or cloud quota, touch personal or patient data, or cannot be undone.
Related skills
axolotl: Provides guidance for fine-tuning large language models with Axolotl, covering YAML training configs, LoRA and QLoRA, preference training w…unsloth: Provides guidance on fine-tuning large language models with Unsloth, a library for faster, lower-memory training using LoRA and QLoRA, base…gptq: Quantizes LLMs to 4-bit (also 3-bit) with GPTQ using group-wise quantization (group size 128 by default), via AutoGPTQ and transformers.
Trigger Prompts & Evaluation Corpus
These evaluation prompts test that the agent correctly selects llama-factory for relevant tasks and leaves it out for near misses.
Should trigger (3)
- should trigger
“How do I launch the LLaMA-Factory WebUI to fine-tune a model without writing code?”
expects Explains starting the WebUI (e.g., `llamafactory-cli webui`), then selecting model, dataset, finetuning method and hyperparameters in the interface. Advises a small smoke run first and checking GPU/environment, and does not invent flags absent from the installed version.
- should trigger
“I'm running QLoRA on Qwen2-7B with LLaMA-Factory on a single 24GB RTX 4090, dataset is my_data.json registered in dataset_info.json. I get 'CUDA out of memory' at step 3 with quantization_bit 8, cutoff_len 4096, batch size 4. What should I change?”
expects Suggests lowering per_device_train_batch_size and using gradient accumulation, enabling gradient checkpointing, reducing cutoff_len, and moving to 4-bit quantization. Checks the dataset_info.json registration and nvidia-smi, and tells the user to verify option names against the installed version's docs.
- should trigger
“I want to adapt a vision-language model to read chest X-ray images and produce short captions, using my own image-text pairs on one GPU with limited VRAM. Where do I start, and how can I make it fit in memory?”
expects Recommends a LLaMA-Factory-supported multimodal model, formatting the image-text data in the expected dataset format, and using low-bit quantized LoRA to fit memory. Runs a small test first, asks about the data source (patient data privacy), GPU specs and the specific model, and holds out data for validation.
Near misses (2)
- near miss
“Write me an Axolotl YAML config for DPO training on Llama-3 8B with FSDP across 4 GPUs.”
expects Recognizes this as Axolotl-specific (YAML config, DPO, FSDP) and not LLaMA-Factory, so it should use the axolotl skill.
- near miss
“I have a Llama-2 13B model. How do I quantize it to 4-bit with GPTQ using group size 128 and pick the right kernel for inference?”
expects Recognizes this as GPTQ post-training quantization and kernel selection, not a fine-tuning run with LLaMA-Factory, so it should use the gptq skill.