Fine-tuning adapts a pretrained model to a specific task by continuing training on a smaller, specialized dataset. Training adjusts model parameters so the model performs better on that task without starting from scratch. Uses include sentiment analysis, question answering, and domain-specific generation. section 2.8.8 section 9.1.1
Treat fine-tuning as a later option, not the default response to weak output. Try prompt engineering first; add retrieval-augmented generation (RAG) when answers need grounding in your data. These approaches can remain useful after fine-tuning. section 9.0 section 9.2
A practical workflow is:
- Define the task, identify where the base model falls short, and establish evaluation criteria and a baseline. section 9.2
- Choose a suitable model and method. Full fine-tuning updates all parameters; low-rank adaptation (LoRA) trains a smaller set while leaving pretrained weights frozen. section 9.1.1 section 9.6.1
- Curate representative, high-quality examples and separate training, validation, and test data. Validate the dataset format and use validation results to watch for overfitting. section 9.2.1 section 9.3.1
- Train, compare the result with the base model and task baseline, then iterate before deploying for inference. Use qualitative and quantitative checks suited to the task. section 9.2 section 9.2.1
Teaching a model a required output format
Suppose a chat assistant must answer with emoji codes that Microsoft Teams renders, rather than ordinary emoji characters. Example JSONL training records pair a user message with the desired assistant response, such as “I've been working nonstop and need a break.” → “(tired)”. An Azure OpenAI workflow uploads the file, submits a GPT-3.5 Turbo fine-tuning job, and deploys the resulting model for testing. The example is not a guarantee of correct output: some fine-tuned answers still require a revised system prompt. section 9.3 section 9.3.1 section 9.3.3 section 9.4.1
Listing 9.1 JSONL example
{"messages": [{"role": "system", "content": "You're a chatbot that only responds with emojis!"}, {"role": "user", "content": "I heard the koala habitat was destroyed by the fire."}, {"role": "assistant", "content": "(sadkoala)" }]}
{"messages": [{"role": "system", "content": "You're a chatbot that only responds with emojis!"}, {"role": "user", "content": "I've been working nonstop and need a break."}, {"role": "assistant", "content": "(tired)" }]}
{"messages": [{"role": "system", "content": "You're a chatbot that only responds with emojis!"}, {"role": "user", "content": "I just finished reading an amazing book!"}, {"role": "assistant", "content": "(like)" }]}
Inspect the JSONL message records to see how system instructions, user inputs, and desired assistant outputs are represented for the emoji task. section 9.3.1
Budget for curated data, compute, evaluation, and repeated runs. Fine-tuning can be expensive, can overfit, and can cause catastrophic forgetting of earlier capabilities. A first fine-tuned model may perform worse than the base model; deploy only after testing the behavior that matters for the task. section 2.8.8 section 9.2 section 9.8




































