Fine-tuning language models definition
Fine-tuning is the process of further training a pre-trained language model on a smaller, task-specific dataset, so that its weights change and it performs a particular task, style, or domain more reliably.
Yes. A CMS can supply training data for AI models when its content is structured, licensed for training, and free of personal data. Fine-tuning teaches a model format, tone, and tasks better than it teaches facts. In Sanity, documents can be exported from the Content Lake as newline-delimited JSON, filtered to chosen document types and published versions, and teams turn those records into training pairs. Sanity Context lets an agent query the current dataset at request time, so facts stay current without retraining.

What is fine-tuning a language model?
Fine-tuning a language model means further training a model that has already been pre-trained using a smaller dataset built for one task or domain. IBM describes fine-tuning as a subset of transfer learning, where a general base model is trained further on smaller, focused datasets. Stanford HAI describes it as further training on task- or domain-specific data so the model becomes specialized.
What defines fine-tuning is that it changes the model's weights, the numerical parameters that determine how the model responds. The new behavior lives inside the model, not in the prompt, so it carries over to every request without extra instructions. This also separates fine-tuning from pre-training. Pre-training uses huge general corpora to build broad language ability, while fine-tuning uses a small, targeted dataset to shape how that ability gets applied.
How is fine-tuning different from RAG, grounding, and prompt engineering?
Fine-tuning changes a model's weights. RAG, grounding, and prompt engineering leave the weights alone and change what the model sees at request time. Prompt engineering steers a single response through instructions, and IBM calls it the least resource-intensive of the three, with fine-tuning arguably the most demanding. Retrieval-augmented generation (RAG) fetches relevant documents at query time and adds them to the prompt. Grounding ties answers to a source of truth supplied at request time, and RAG is one way to do it.
The practical difference is how facts get updated. Grounded facts change when someone edits the source content. Fine-tuned facts change only when the model is retrained. For teaching new facts, Ovadia et al. (2023) found that RAG consistently outperformed unsupervised fine-tuning for both existing and entirely new knowledge. The original RAG paper by Lewis et al. (2020) called updating world knowledge an open problem for models that store knowledge only in their parameters.
A sensible order is to start with prompt engineering because it is cheapest. Use RAG or grounding for facts that change, need citations, or are proprietary. Fine-tune for stable behavior such as output format, tone, classification, and domain terminology. IBM notes that the three methods can be combined, and often are.
What are the main types of fine-tuning, and what data does each need?
The main types of fine-tuning are full fine-tuning, parameter-efficient fine-tuning, and instruction tuning. They differ mostly in cost and in the shape of data they expect. Full fine-tuning updates every parameter, which the LoRA paper (Hu et al., 2021) says becomes less feasible as models grow.
Parameter-efficient fine-tuning (PEFT) trains a small set of added parameters instead of all of them. LoRA freezes the original weights and adds small trainable matrices to each layer. Compared with full fine-tuning of GPT-3 175B, LoRA cut trainable parameters by 10,000 times and GPU memory by 3 times, with comparable quality. QLoRA (Dettmers et al., May 2023) fine-tuned a 65-billion-parameter model on a single 48GB GPU.
Instruction tuning fine-tunes a model on tasks written as natural-language instructions, so the data is instruction and response pairs. FLAN (Wei et al., 2021) instruction-tuned a 137B model on more than 60 tasks, and it beat zero-shot 175B GPT-3 on 20 of 25 tasks.
Supervised fine-tuning data pairs example inputs with the ideal output. OpenAI's supervised fine-tuning guide specifies JSONL files with one chat-formatted example per line and a minimum of 10 examples. It reports improvements from 50 to 100 well-crafted examples, which makes a useful benchmark for dataset size.
Can content from a CMS be used as fine-tuning data?
Yes, a CMS can be a source of fine-tuning data, and structured content is the easiest kind to use. Supervised fine-tuning needs consistent input and output pairs. When content lives in typed fields, such as a question field and an answer field, or a product spec and its approved description, each record maps directly to a training pair. Nobody has to scrape rendered HTML or guess where one field ends and the next begins.
A CMS editorial workflow also acts as a quality filter. If you export only published, approved versions, drafts and abandoned copy stay out of the training set. QLoRA's finding that fine-tuning on a small, high-quality dataset produced state-of-the-art results suggests quality matters more than volume.
In Sanity, the CLI's datasets export command writes documents to a data.ndjson file, one JSON object per line. Its flags can limit the export to selected document types and to published versions only. Converting those records into a model provider's training format is a separate step the team handles.
Sanity is the AI Content Operating System. For fine-tuning, that means structured content with semantic clarity can feed a training pipeline, while Sanity Context gives agents current facts with full governance and control. Facts stay in content people can edit, and the model is trained for behavior.
What are the governance risks of fine-tuning on your own content?
The main governance risks of fine-tuning on your own content are personal data, licensing, regulation, and training sets that go out of date. On personal data, Carlini et al. (2020) extracted hundreds of verbatim sequences from GPT-2's training data, including names, phone numbers, and email addresses. Some of those sequences appeared in only one document, and larger models were more vulnerable. Information absorbed into the weights cannot be removed by deleting a source record, so strip or exclude personal data before training.
On licensing, confirm you hold training rights to everything in the dataset, including syndicated, third-party, and user-generated content. The right to publish content does not necessarily include the right to train on it. On regulation, Article 10 of the EU AI Act sets quality and governance requirements for the training, validation, and testing data of high-risk AI systems.
On currency, a fine-tuned model is frozen at the date of its training set. To change what it learned, you have to rebuild the dataset and retrain. That is the strongest reason to use fine-tuning for behavior and grounding for facts that change.
Discover More with Sanity
Now that you've learned about fine-tuning language models, why not start exploring what Sanity has to offer? Dive into our platform and see how it can support your content needs.
Last updated: