---
title: "Fine-tuning an open model on our docs agent's traces"
description: "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."
url: "https://swe.quest/articles/fine-tuning-an-open-model-on-our-docs-agent-s-traces-ae8b29a58b101562"
canonical: "https://www.langchain.com/blog/fine-tuning-an-open-model-on-our-docs-agents-traces"
source: "LangChain"
published: "2026-12-02"
difficulty: "hard"
kind: "Case study"
reading_minutes: 6
tags: ["model-training","evals","ai-agents","llms","cost-optimization"]
---

# Fine-tuning an open model on our docs agent's traces

A post on [LangChain](https://swe.quest/sources/langchain.md), published 2026-12-02, 6 min read, Case study. Original: [https://www.langchain.com/blog/fine-tuning-an-open-model-on-our-docs-agents-traces](https://www.langchain.com/blog/fine-tuning-an-open-model-on-our-docs-agents-traces)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)

## Prerequisites

- LLM fine-tuning basics ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- SFT, DPO and GRPO
- LLM evaluation with judges ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- tool-using agents ([easy posts on AI agents](https://swe.quest/tags/ai-agents.md?difficulty=easy))

## Keywords

GLM 5.3 Flash, Chat LangChain, LangSmith, DPO, GRPO, Gemini 3.5 Flash Lite, GPT-6.1 Sol

## Related posts

- [Open Models have crossed a threshold](https://swe.quest/articles/open-models-have-crossed-a-threshold-c54376af892bf600.md): LangChain · 2026-10-13 · Medium · 7 min read · Evaluation, LLMs, AI agents, Cost optimization
  Open-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.
- [We Got Claude to Fine-Tune an Open Source LLM](https://swe.quest/articles/we-got-claude-to-fine-tune-an-open-source-llm-b2f9fccf5ad1d82f.md): Hugging Face · 2025-12-04 · Medium · 12 min read · Model training, AI agents, AI for coding, LLMs
  Hugging 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.
- [Introducing LangSmith Fine-Tuning](https://swe.quest/articles/introducing-langsmith-fine-tuning-14e7ff1bff14370e.md): LangChain · 2026-10-08 · Medium · 7 min read · Model training, AI agents, LLMs, Evaluation
  LangSmith Fine-Tuning and its \`smithtune\` CLI turn agent trajectories recorded in LangSmith into supervised fine-tuned models in one workflow.
- [Codex is Open Sourcing AI models](https://swe.quest/articles/codex-is-open-sourcing-ai-models-fa17d18abe8d9c1f.md): Hugging Face · 2025-12-11 · Medium · 18 min read · Model training, AI agents, AI for coding, Evaluation
  Hugging 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.
- [Fine-tune Llama 2 with DPO](https://swe.quest/articles/fine-tune-llama-2-with-dpo-68d2e917aae1caca.md): Hugging Face · 2023-08-08 · Hard · 7 min read · Model training, LLMs, Python
  Direct 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
