Training & Fine-Tuning Guide
This guide covers everything you need to know about training models in ForgeAI — from basic LoRA fine-tuning to advanced capability-targeted training and layer surgery.Prerequisites
Hardware Requirements
Software Requirements
- Python 3.10+ (installed on your system)
- ForgeAI handles the rest: creates a virtual environment and installs PyTorch, Transformers, PEFT, TRL, and BitsAndBytes automatically.
Layer surgery requires no Python or GPU — it’s pure Rust.
Choosing a Training Method
LoRA (Recommended for Most Users)
Low-Rank Adaptation trains small adapter matrices alongside frozen base weights. Best balance of quality and efficiency. When to use: General fine-tuning, instruction tuning, task adaptation.QLoRA (Best for Low VRAM)
Same as LoRA but quantizes the base model to 4-bit, dramatically reducing VRAM usage with minimal quality impact. When to use: Limited GPU memory (4–8 GB), large models.SFT (Standard Training)
Supervised Fine-Tuning on instruction/completion datasets. All parameters are updated. When to use: When you have a large, high-quality dataset and sufficient VRAM.DPO (Preference Learning)
Direct Preference Optimization learns from chosen/rejected response pairs — no reward model needed. When to use: Alignment, preference tuning, RLHF-style training.Full Fine-Tune
Updates every parameter in the model. Maximum quality but maximum VRAM. When to use: When LoRA quality isn’t sufficient and you have abundant GPU memory.Capability-Targeted Training
Instead of fine-tuning every layer, ForgeAI can target layers responsible for specific capabilities:How It Works
- ForgeAI analyzes the model architecture and maps layers to capabilities
- You select which capabilities to train (e.g., “Code Generation” + “Reasoning”)
- Only layers associated with those capabilities are included in training
- Other layers remain frozen, preserving existing knowledge
Available Capabilities
Preparing Datasets
Supported Templates
ForgeAI auto-detects your dataset format:Dataset Tips
- Use DataStudio (10) to explore and validate your dataset before training
- For DPO, ensure each row has both
chosenandrejectedresponses - Longer sequences require more VRAM — reduce
max_seq_lengthif running out of memory - Parquet is the most efficient format for large datasets
Training Presets
Layer Surgery
Layer surgery is a separate mode that operates directly on model tensors — no training, no GPU, no Python.Remove Layers
Remove layers to create smaller, faster models. Useful for:- Creating smaller test models
- Removing redundant layers
- Reducing inference latency
Duplicate Layers
Duplicate layers to increase model depth. Useful for:- Expanding model capacity
- Experimental architecture modifications
Surgery Process
- Select a model (GGUF or SafeTensors)
- Load layer details to see full tensor breakdown
- Select layers to remove or positions to duplicate
- Review the preview (final layer count, estimated size)
- Run surgery — a new file is created, the original is never modified
- ForgeAI automatically updates
config.json/ GGUF metadata