Fine-tuning an open model on our docs agent's traces
Answer-only DPO on tasks mined from Chat LangChain's production traces lifted GLM 5.3 Flash from 0.679 to 0.735 on a 128-question held-out benchmark, close to GPT-6.1 Sol's 0.748 at 83% lower cost. Teacher SFT and GRPO also improved scores but inflated tool calls and latency (SFT pushed median latency from 17s to 75s), while DPO on the base model's own best-of-four answers added far less extra research. A mocked environment mirroring production and a deliberately hard, calibrated benchmark made gains measurable. In a three-way production split, the fine-tune was the most grounded and cut follow-up questions versus Gemini 3.5 Flash Lite (36% vs 41%) at $12 vs $20 per 1,000 questions, despite answering about twice as slowly.
Related posts
- Open Models have crossed a threshold
LangChain mediumAdeptOpen-weight models GLM-5 and MiniMax M2.7 now score close to closed frontier models on core agent tasks in LangChain's Deep Agents eval suite. GLM-5 reached 0.64 correctness, MiniMax M2.7 0.57, and Claude Opus 4.6 0.68, across 138 tests covering file ops, tool use, retrieval, memory and summarization. The open models are far cheaper and faster: about $12/day versus $250/day for 10M output tokens, and 0.65s versus 2.56s latency. The eval metrics are defined (correctness, solve rate, step and tool-call ratios), and switching Deep Agents to an open model is a one-line change, with the harness adapting context management and model identity to each model.
- We Got Claude to Fine-Tune an Open Source LLM
Hugging Face mediumAdeptHugging Face Skills, specifically the hf-llm-trainer skill, lets coding agents like Claude Code, Codex and Gemini CLI run a full LLM fine-tuning lifecycle. The agent validates the dataset, picks GPU hardware by model size, generates a TRL training script with Trackio monitoring, submits it to Hugging Face Jobs, reports progress and pushes the result to the Hub. The walkthrough covers setup, SFT, DPO and GRPO, LoRA for models over 3B, GGUF conversion for llama.cpp, and cost guidance. A 0.6B Qwen3 SFT run on a t4-small costs about $0.30, 3-7B models need A10G/A100 with LoRA at $15-40, and a cheap 100-example test run before a production job catches dataset format errors early.
- Introducing LangSmith Fine-Tuning
LangChain mediumAdeptLangSmith Fine-Tuning and its `smithtune` CLI turn agent trajectories recorded in LangSmith into supervised fine-tuned models in one workflow. The workflow covers curating and labeling golden trajectories, LoRA training on Fireworks or Baseten with checkpoint selection by validation loss, and replay-based evaluation against the base model. Trajectories record the exact context, including tool availability, the model saw at each turn. In internal tests, SFT lifted Kimi K3 from 90.0 to 96.0 on an issue-detection benchmark, and raised Qwen-3.8-27B's code-review F1 from 48.9% to 53.7% with about 30% fewer model and tool calls. Data selection was decisive, since a less curated training set lowered F1, and the recommendation is to exhaust harness engineering before trying SFT.
- Codex is Open Sourcing AI models
Hugging Face mediumAdeptHugging Face Skills, a repository of agent instructions loaded via AGENTS.md (or Claude Code Skills), lets OpenAI Codex run end-to-end fine-tuning experiments on Hugging Face Jobs. From a short prompt it validates the dataset, picks hardware, submits TRL training (SFT, DPO, GRPO), tracks metrics in Trackio, runs lighteval evaluations and keeps a markdown experiment report up to date. In the walkthrough, a LoRA SFT of Qwen3-0.6B on open-r1/codeforces-cots raises HumanEval pass@1 from about 0.30 to 0.34, and the model is then converted to quantized GGUF for llama.cpp. Rough costs are $1-2 for models under 1B, $5-15 for 1-3B and $15-40 for 3-7B with LoRA, and models above 7B are not yet supported.
- Fine-tune Llama 2 with DPO
Hugging Face hardMasterDirect Preference Optimization (DPO) replaces the reward-model and RL steps of RLHF with a simple binary cross-entropy loss over preference pairs, using a frozen reference model to provide an implicit reward. With TRL's DPOTrainer, data is formatted as prompt/chosen/rejected triples and training is controlled by a beta temperature, typically 0.1 to 0.5. The walkthrough fine-tunes Llama 2 7B on the stack-exchange preference dataset: first SFT with QLoRA (4-bit NF4 plus LoRA adapters), then DPO using the SFT model as both policy and reference. Progress is monitored with logged reward metrics (chosen, rejected, accuracies, margins), where margins should grow and accuracies should approach 1.0.