gemma-trainer
Train and adapt Gemma models on consumer hardware through supervised fine-tuning, direct preference optimization, and reward modeling workflows. The skill guides you through memory-efficient setups with Unsloth and TRL, dataset formatting, multimodal training for vision and audio, and deployment via GGUF or LiteRT.
Gemma-trainer enables efficient local fine-tuning of Gemma models using QLoRA, SFT, DPO, and reward modeling.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-08
Gemma-trainer enables efficient local fine-tuning of Gemma models using QLoRA, SFT, DPO, and reward modeling. Train and adapt Gemma models on consumer hardware through supervised fine-tuning, direct preference optimization, and reward modeling workflows. The skill guides you through memory-efficient setups with Unsloth and TRL, dataset formatting, multimodal training for vision and audio, and deployment via GGUF or LiteRT.
Use it when
- gemma-trainer handles dataset preparation and validation for Gemma training workflows.
- gemma-trainer covers direct preference optimization (DPO) techniques for aligning Gemma model behavior without reward models.
Verify before relying
Read SKILL.md below before installing (6 files). Open directory: indexed for reading, not audited.
Install
google-gemma/gemma-skills/gemma-trainer · repository language: Python
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I fine-tune Gemma locally on consumer hardware?
gemma-trainer guides you through fine-tuning Gemma models on local hardware using memory-efficient methods like QLoRA and Unsloth. The skill covers supervised fine-tuning workflows that let you adapt Gemma on single GPUs, including hyperparameter configuration, training loops, and checkpoint management for practical consumer-grade setups.
What dataset formats does gemma-trainer support for training?
gemma-trainer handles dataset preparation and validation for Gemma training workflows, including chat template formatting and structured data layouts. The skill guides you through preparing datasets in formats compatible with supervised fine-tuning, DPO alignment, and reward modeling pipelines, ensuring your data integrates smoothly with TRL and Unsloth frameworks.
How can I use DPO alignment with Gemma models?
gemma-trainer covers direct preference optimization (DPO) techniques for aligning Gemma model behavior without reward models. The skill walks through DPO training setup, preference pair formatting, and training loops to refine model outputs based on human preferences, complementing supervised fine-tuning for more nuanced behavioral control.
How do I deploy trained Gemma models to mobile devices?
gemma-trainer supports deployment workflows via GGUF conversion and LiteRT optimization for edge and mobile environments. The skill covers model format conversion, inference optimization, and device-specific configurations to run your fine-tuned Gemma models efficiently on resource-constrained platforms.
Does gemma-trainer support multimodal fine-tuning for vision and audio?
Yes, gemma-trainer includes guidance for multimodal training workflows extending Gemma to vision and audio modalities. The skill covers dataset preparation, training loops, and model adaptation techniques for multimodal fine-tuning, enabling you to extend Gemma's capabilities beyond text on local hardware.
What memory-efficient training methods does gemma-trainer use?
gemma-trainer leverages Unsloth and TRL for memory-efficient training, including QLoRA quantization and LoRA adapters. The skill provides hyperparameter tuning guidance and setup instructions to maximize training efficiency on limited VRAM, making Gemma fine-tuning accessible on consumer GPUs.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Gemma Training and Fine-Tuning Skill
1. Core Principles: Local Fine-Tuning Setup
When training locally, memory efficiency and execution speed are huge. Always guide the user to follow these best practices:
- Prioritize Unsloth: For local single-GPU training, always recommend Unsloth. It supports Gemma 4 natively, uses up to 70% less memory, and is up to 2x faster than standard Hugging Face PEFT training.
- Fall Back to TRL: For multi-GPU environments (using DDP/FSDP) or when Unsloth is unavailable, use Hugging Face TRL (
SFTTrainer,DPOTrainer) coupled with PEFT and bitsandbytes (for QLoRA). - Always use QLoRA (4-bit Quantization): Crucial for fitting Gemma models (like Gemma 4 12B/31B) into consumer VRAM.
- Manage Context Window & Max Length: Although Gemma 4 supports up to a 256K context window, recommend training with a context window of 2048 to 8192 tokens locally to
(truncated - see the full file via the links below)
File tree — 6 files
skills/gemma-trainer/SKILL.md
skills/gemma-trainer/assets/dataset_prep.py
skills/gemma-trainer/assets/distill_dataset.py
skills/gemma-trainer/assets/dpo_train.py
skills/gemma-trainer/assets/reward_train.py
skills/gemma-trainer/assets/sft_train.py
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Fine-tune or adapt Gemma models on local hardware using efficient methods”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Unsloth accelerates LLM fine-tuning on consumer and datacenter GPUs through optimized LoRA and QLoRA training, cutting both speed and memory requirements dramatically. It handles supervised fine-tuning, reinforcement learning with GRPO, vision model adaptation, and TTS training across 300+ model architectures, with direct export to GGUF for deployment on Ollama and llama.cpp.
Run Unsloth-powered LLM training directly on Google Colab GPUs from openscience, connecting via WebSocket bridge for remote execution. Supports supervised fine-tuning, reinforcement learning, preference optimization, vision, and text-to-speech workflows across free T4 through paid A100 tiers.
Unsloth-buddy guides you through optimized language model training using the Unsloth library, delivering 2x speedup and up to 80% VRAM reduction compared to standard approaches. It covers SFT, DPO, GRPO, vision, TTS, and embedding fine-tuning across Apple Silicon, NVIDIA, and Windows environments. The skill orchestrates a complete 7-phase lifecycle from project setup through deployment, managing templates, dashboards, and hardware detection automatically.
Unsloth Training accelerates LLM fine-tuning through GRPO (reinforcement learning with reward functions) and SFT (supervised learning with input-output pairs). It cuts VRAM usage by 60% with FP8 training, speeds up mixed-length datasets via automatic packing, and supports vision model tuning, mobile deployment via ExecuTorch, and export to GGUF, Ollama, and vLLM.
This skill teaches efficient LLM fine-tuning via Unsloth, covering GRPO (reinforcement learning with reward functions) and SFT (supervised training). Learn FP8 training for 60% VRAM reduction, automatic packing for 2–5x speedup, vision model tuning, mobile deployment via QAT, Docker containerization, and export to GGUF and other formats.
Fine-tuning with TRL provides post-training methods to align language models with human preferences through multiple approaches. Train models on instruction data with SFT, optimize for preference alignment via DPO without a separate reward model, or run full RLHF pipelines combining supervised fine-tuning, reward modeling, and PPO optimization. GRPO offers memory-efficient online reinforcement learning for resource-constrained setups.