Open-Source AI Cookbook
by Hugging Face
70+ runnable notebooks for post-training, RAG and agents built entirely on open models and open-source tooling.
Overview
The Cookbook is organized as a browsable index of individual notebooks rather than a linear course, which makes it a reference you return to rather than something you finish. The fine-tuning and post-training cluster is the deepest: supervised fine-tuning of code LLMs on a single GPU, GRPO with TRL, online GRPO training with vLLM, advanced GRPO reward design, DPO and MPO for vision-language models, function-calling fine-tuning on the xLAM dataset, PEFT prompt tuning, multi-config SFT with RapidFire AI, and vision fine-tuning across SmolVLM, Granite Vision, ViT and DETR. The retrieval cluster covers advanced RAG, agentic RAG, multi-agent RAG, multimodal RAG with document retrieval plus rerankers and VLMs, RAG evaluation, semantic reranking and caching, and integrations with Milvus, Elasticsearch, MongoDB, Neo4j knowledge graphs, LlamaIndex and LangChain. The agents cluster includes text-to-SQL agents, data-analyst agents, multi-agent web assistants and smolagents micro-agent architectures. Evaluation and reliability get real coverage too — LLM-as-judge, judging AI search engines, dataset quality issues, active-learning annotation, preference-dataset generation with distilabel, structured generation, PII detection at an LLM gateway, and Phoenix observability on Spaces. Everything runs on open models and open tooling (Transformers, TRL, PEFT, vLLM, Gradio, Argilla), which makes the notebooks adaptable to self-hosted stacks. It is Apache-2.0, maintained in the huggingface/cookbook repository with over 1,300 commits, and explicitly community-driven with contributions accepted.
At a Glance
- Topic
- Fine-Tuning
- Level
- Intermediate
- Format
- Tutorial
- Cost
- Free
- Duration
- ~45-90 minutes per notebook; 70+ notebooks, entirely self-paced
- Provider
- Hugging Face
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Run GRPO reinforcement post-training with TRL, including online training served by vLLM
- ✓Design advanced reward functions for reasoning-focused GRPO runs rather than copying a default
- ✓Fine-tune vision-language models with SFT, DPO and MPO on SmolVLM and Granite Vision
- ✓Fine-tune a code LLM on a single GPU and tune function calling on the xLAM dataset
- ✓Build multimodal RAG that combines document retrieval, a reranker and a vision-language model
- ✓Evaluate RAG systems and use LLM-as-judge, including judging AI search engines
- ✓Assemble agentic pipelines — text-to-SQL, data analyst, multi-agent web assistant — with smolagents
- ✓Generate and clean preference datasets with distilabel, and add observability with Phoenix
Highlights
- •Every recipe is a runnable notebook against open models, so nothing is locked behind one vendor's hosted API.
- •It tracks the ecosystem rather than lagging it — current entries include DSPy GEPA optimization, online GRPO with vLLM in TRL, and multi-config SFT with RapidFire AI.
- •Unusually strong on the unglamorous half of the job: dataset quality issues, active-learning annotation, preference-data generation, PII detection at an LLM gateway.
- •Vision-language post-training is covered properly (SFT, DPO, MPO, GRPO across four model families), which most RAG-and-agents tutorials skip entirely.
- •Written by the maintainers of the libraries it uses — Transformers, TRL, PEFT — plus community contributors, so the code matches current library APIs.
- •Apache-2.0 and openly contributed, with 1,300+ commits in huggingface/cookbook; you can fork a recipe as a starting point without licensing friction.
Who It’s For
Best For
- ✓AI engineers doing post-training or fine-tuning who want a working reference implementation
- ✓Teams building RAG or agent systems on self-hosted open models instead of a hosted API
- ✓Practitioners who need evaluation, annotation and dataset-quality recipes, not just inference demos
- ✓Engineers moving from vendor SDK tutorials into the open Hugging Face stack
Prerequisites
- •Solid Python and prior experience with Hugging Face Transformers
- •A GPU (Colab-class is enough for several recipes; post-training notebooks want more)
- •Familiarity with basic training concepts — loss, batching, LoRA/PEFT — before the GRPO and DPO recipes
FAQ
What is Open-Source AI Cookbook?
A community-maintained collection of over 70 runnable notebooks from Hugging Face showing how to build AI applications with open-source models and tools rather than a hosted API. It is aimed at practicing AI engineers who need a working reference implementation — GRPO post-training, multimodal RAG, LLM-as-judge evaluation, structured generation, agentic pipelines — and it stays current with the ecosystem, carrying recipes for DSPy GEPA, online GRPO with vLLM in TRL and multi-config SFT.
Is Open-Source AI Cookbook free?
Open-Source AI Cookbook is free to access.
What level is Open-Source AI Cookbook for?
Open-Source AI Cookbook is aimed at a intermediate audience. Recommended background: Solid Python and prior experience with Hugging Face Transformers, A GPU (Colab-class is enough for several recipes; post-training notebooks want more), Familiarity with basic training concepts — loss, batching, LoRA/PEFT — before the GRPO and DPO recipes.
How long does Open-Source AI Cookbook take?
Expect roughly ~45-90 minutes per notebook; 70+ notebooks, entirely self-paced. Most learners work through it at their own pace.
What will I learn from Open-Source AI Cookbook?
You'll learn: Run GRPO reinforcement post-training with TRL, including online training served by vLLM; Design advanced reward functions for reasoning-focused GRPO runs rather than copying a default; Fine-tune vision-language models with SFT, DPO and MPO on SmolVLM and Granite Vision; Fine-tune a code LLM on a single GPU and tune function calling on the xLAM dataset; Build multimodal RAG that combines document retrieval, a reranker and a vision-language model; Evaluate RAG systems and use LLM-as-judge, including judging AI search engines; Assemble agentic pipelines — text-to-SQL, data analyst, multi-agent web assistant — with smolagents; Generate and clean preference datasets with distilabel, and add observability with Phoenix.
Topics
Sources
This page was written from 3 sources, 2 on domains other than huggingface.co.