Finetuning Gemma 3 on private data with Unsloth and CircleCI
Blog post from CircleCI
Fine-tuning Large Language Models (LLMs) on private, domain-specific data can create AI applications that are more aligned with an organization’s unique context, allowing them to deliver highly accurate results. While finetuning is often seen as a complex and resource-intensive process, alternatives such as using mega prompts or few-shot learning can sometimes achieve similar outcomes with less complexity. However, in scenarios requiring a model to match an organization's unique writing style or handle specialized domain knowledge, finetuning becomes essential. Open-source models like Google’s Gemma 3 present opportunities for finetuning without the licensing restrictions of commercial models, though the process remains challenging due to its manual nature, GPU resource demands, and lack of reproducibility. The tutorial discussed outlines an automated finetuning pipeline using Gemma 3-4B, leveraging Kaggle for GPU resources, GitHub for version control, CircleCI for CI/CD orchestration, and Hugging Face Hub for model hosting. This pipeline is structured to enhance efficiency and reliability, ensuring secure data handling and maintaining a clear separation of concerns. Additionally, parameter-efficient finetuning methods such as LoRA and QLoRA are employed to reduce memory usage and training time, making the process feasible on consumer-grade hardware. The tutorial also emphasizes the importance of automation and reproducibility in the finetuning lifecycle, demonstrating how a CI/CD pipeline can streamline the deployment of fine-tuned models in production environments.