AI docs · Building with AI
Fine-tuning
Further training a model on your own examples to change its behavior, style, or format, rather than its knowledge.
What it is
- Fine-tuning continues training a base model on a curated dataset of example inputs and outputs.
- It is best for teaching behavior, tone, and output format, not for injecting large bodies of factual knowledge.
How it works
- You assemble high-quality example pairs that demonstrate the behavior you want.
- The model's weights are updated (often with efficient methods like LoRA) to favor that behavior.
- The result is a model that reliably produces the desired style or structure with shorter prompts.
Trade-offs
- Can improve consistency and reduce prompt length, but requires good data and ongoing maintenance.
- Worse than RAG for knowledge that changes; the model can still hallucinate.
When to use it
- When you need a consistent style, format, or task behavior that prompting alone cannot reliably achieve.
- When you have enough high-quality examples and the behavior is stable over time.
Common pitfalls
- Using fine-tuning to add facts (use RAG instead).
- Underestimating the cost of building and maintaining the dataset.
Quick check
When is fine-tuning usually the right tool rather than RAG or prompting?
Related concepts
Let's get to work
Want to build with AI for real?
Beyond the explainer, we design, secure, build and run production AI. Tell us what you have in mind.