Fine-tuning
Fine-tuning is adapting a pretrained machine-learning model by training it further on targeted data or objectives for a task, domain, or behavior.
LLMs in Production
Fine-tuning is the process of continuing model training on task-specific data to adapt a pretrained model to a particular behavior or domain.
- How it is used
- Adapts a pretrained model to a specific task, domain, or desired behavior without training a foundation model from scratch.
- How deep it goes
- Works through model selection, data preparation, and training trade-offs, including hosted jobs and parameter-efficient variants.
- Examples
- Uses Slack-message persona training, OpenAI fine-tuning jobs, and DreamBooth image avatars to show different adaptation settings.
- What you can do after
- Apply it via Hugging Face Transformers or OpenAI fine-tuning jobs, and evaluate when prompting or fresher retrieval data is preferable.
Natural Language Processing in Action, Second Edition
Fine-tuning is the continued training of a pretrained model on a narrower dataset or task so its parameters adapt to that target domain or behavior.
- How it is used
- Adapts pretrained transformers to toxic-comment classification and domain-specific text generation.
- How deep it goes
- Works through dataset preparation, training, evaluation, and revised settings with library APIs, rather than implementing transformer training from scratch.
- Examples
- Uses a six-label toxic-comment dataset and a before-and-after GPT-2 generation comparison.
- What you can do after
- Apply it via Simple Transformers or Hugging Face Trainer to adapt pretrained BERT or GPT-2, then evaluate the result.
Read how Natural Language Processing in Action, Second Edition explains fine-tuning →
Generative AI in Action
Task-specific fine-tuning is the adaptation of a pretrained model using data targeted at a particular task.
- How it is used
- Adapts pretrained language models to specialized tasks when simpler prompting and retrieval do not meet the task’s requirements.
- How deep it goes
- Works through model choice, dataset preparation, training jobs, evaluation, and deployment, with a high-level account of parameter-efficient methods.
- Examples
- Uses JSONL chat examples and Azure OpenAI training jobs to teach a GPT-3.5 Turbo model Microsoft Teams emoji-code responses.
- What you can do after
- Apply it via Azure OpenAI to prepare data, submit a fine-tuning job, evaluate the result, and deploy a task-specific model.
Software Testing with Generative AI
Fine-tuning is the process of adapting a pretrained model to a task or domain by training it further on targeted data.
- How it is used
- Deploys targeted training to embed testing or business-domain context into an LLM’s responses.
- How deep it goes
- Explains goals, data preparation, tokenization, tuning, metrics, testing, and iteration, while deferring many implementation nuances.
- Examples
- Uses London travel responses, project-code instruction records, Axolotl commands, and loss and learning-rate logs.
- What you can do after
- Operate/configure Axolotl to prepare data, run a LoRA fine-tune, and test the resulting domain-specific model.
Read how Software Testing with Generative AI explains fine-tuning →
The Art of AI Product Development
Fine-tuning is adapting a pretrained model by training it further on task- or domain-specific data.
- How it is used
- Positions fine-tuning as an investment when prompting and RAG leave recurring gaps in specialist output, task performance, or editing effort.
- How deep it goes
- Works through objectives, model choice, data, and evaluation from a product perspective; leaves detailed training engineering to specialists.
- Examples
- Uses brand-voice rewrites, topic-label datasets, draft-revision pairs, and Llama 3.2 adapted for ESG reporting.
- What you can do after
- Practice/perform it by selecting a justified fine-tuning objective, planning representative data, and evaluating improvements against user needs.
Read how The Art of AI Product Development explains fine-tuning →
Reinforcement Learning from Human Feedback
Fine-tuning is further training of a pretrained model on a task-specific or behavior-specific objective.
- How it is used
- Establishes instruction-following behavior and supplies starting checkpoints for preference modeling, RLHF, rejection sampling, and tool use.
- How deep it goes
- Explains SFT data choices, masking, batch sizes, pipeline roles, and KL regularization, while deferring full tool-use training treatment.
- Examples
- Contrasts a chemistry-question continuation with a direct answer and traces InstructGPT and Tülu 3 multistage recipes.
- What you can do after
- Apply it via supervised fine-tuning to teach response formats, tool trajectories, or selected completions while choosing data and masking strategies.
Read how Reinforcement Learning from Human Feedback explains fine-tuning →
Deep Learning with R, Third Edition
Fine-tuning is the continued training of a pretrained model, typically with a small learning rate, to adapt its learned representations to a new task.
- How it is used
- Adapts pretrained image classifiers, text classifiers, and language models to new tasks or desired responses.
- How deep it goes
- Works through freezing, training, unfreezing, and joint training for images, then demonstrates classifier heads and instruction–response formatting for language models.
- Examples
- Uses Xception for dogs versus cats, RoBERTa for IMDb sentiment, and Gemma with instruction–response pairs.
- What you can do after
- Apply it via R/Keras and KerasHub to adapt pretrained classifiers, or practice instruction fine-tuning with formatted responses.
Read how Deep Learning with R, Third Edition explains fine-tuning →
Deep Learning with Python, Third Edition
Adapting a pretrained model to a new task by continuing training, usually with a smaller learning rate or on additional data.
- How it is used
- Adapts pretrained vision and language models to new classification tasks or desired response styles.
- How deep it goes
- Works through freeze–train–unfreeze steps, classifier construction, preprocessing, and training listings; treats batch normalization details as a later topic.
- Examples
- Uses Xception for dogs versus cats, RoBERTa for IMDb sentiment, and Gemma with instruction–response pairs.
- What you can do after
- Apply it via Keras and KerasHub to adapt pretrained classifiers and train a language model on instruction–response pairs.
Read how Deep Learning with Python, Third Edition explains fine-tuning →
Build a Large Language Model (From Scratch)
Further training of a pretrained model on a smaller task-specific dataset to improve downstream performance.
- How it is used
- Adapts foundation models for domain-specific or downstream tasks after broad language pretraining.
- How deep it goes
- Explains the two-stage workflow and model-loading step, but defers detailed optimization and parameter-update mechanics.
- Examples
- Uses labeled instruction-response data, sentence transformation, personal assistants, and text classifiers as concrete applications.
- What you can do after
- Apply it to adapt pretrained GPT models for instruction following or classification with smaller task-specific datasets.
Read how Build a Large Language Model (From Scratch) explains fine-tuning →
AI-Powered Search
Fine-tuning is additional training of a pretrained model on task-specific data to adapt its behavior or performance.
- How it is used
- Adapts pretrained models for semantic similarity search and extractive answers drawn from search results.
- How deep it goes
- Works through dataset curation, model training, pipeline loading, and holdout evaluation; does not specify one universal weight-update method.
- Examples
- Uses STS-B similarity labels, an outdoors question-answer dataset, and a ten-example answer-extraction holdout.
- What you can do after
- Apply it via a transformers question-answering pipeline to test a fine-tuned reader and connect it to a search retriever.
Grokking AI Applications
Fine-tuning is additional training of a pretrained model on more specific data or objectives to adapt its behavior.
- How it is used
- Adapts pretrained language models for specific tasks, domains, instructions, and conversational behavior.
- How deep it goes
- Explains supervised examples and parameter adjustment through backpropagation-like passes, but does not detail implementation procedures or training configurations.
- Examples
- Uses GPT-3, ChatGPT dialogue refinement, prompt-completion pairs, and specialized medical knowledge as examples.
- What you can do after
- Apply supervised fine-tuning to move a pretrained model toward desired task, domain, instruction-following, or dialogue outputs.
How Large Language Models Work
Fine-tuning is an additional training stage that adapts a pretrained model to a particular task or behavior using a smaller, task-relevant dataset.
- How it is used
- Uses a second training stage to constrain an LLM’s behavior for instruction following, domain knowledge, or application-specific goals.
- How deep it goes
- Explains SFT mechanics and RLHF objectives, but stops short of detailed optimization, implementation, and adversarial-machine-learning treatment.
- Examples
- Uses car sales, medical records, legal transcripts, repair manuals, code repositories, coding questions, and symbolic mathematics.
- What you can do after
- Apply it via SFT or RLHF to adapt a pretrained model, while selecting task data and checking privacy, reliability, and output risks.
Read how How Large Language Models Work explains fine-tuning →
Time Series Forecasting Using Foundation Models
Fine-tuning is additional training of a pretrained model on task- or domain-specific data by updating some or all of its parameters.
- How it is used
- Specializes foundation forecasting models for a target dataset when zero-shot predictions may not be accurate enough.
- How deep it goes
- Explains parameter depth, training budgets, losses, validation, and overfitting, but does not disclose TimeGPT’s exact tuned-parameter counts.
- Examples
- Uses N-BEATS, TimeGPT, Lag-Llama, and Chronos on store-sales forecasting experiments.
- What you can do after
- Diagnose with validation metrics whether adapting a pretrained forecaster improves accuracy enough to justify its computational cost.
Read how Time Series Forecasting Using Foundation Models explains fine-tuning →
Deep Learning with PyTorch, Second Edition
The process of adapting a pretrained model to a new task by continuing training on task-specific data.
- How it is used
- Adapts pretrained models to specific datasets, especially to turn point-guided CT nodule masks into prompt-free segmentation.
- How deep it goes
- Works through data preparation, checkpoint loading, an optimizer, and training results without detailing SegFormer internals.
- Examples
- Uses SAM-generated CT masks to fine-tune SegFormer and proposes fine-tuning a pretrained Vision Transformer on CIFAR-10.
- What you can do after
- Apply it via Hugging Face Transformers to train SegFormer on CT masks, monitor losses, and visualize predictions on unseen scans.
Read how Deep Learning with PyTorch, Second Edition explains fine-tuning →
Introduction to Generative AI, Second Edition
Fine-tuning is adapting a pretrained model through continued training for a particular task or behavior.
- How it is used
- Adapts general-purpose language models to particular tasks, instruction-following, safety responses, or tool use.
- How deep it goes
- Defines continued training and explains supervised fine-tuning through prompt–response examples and next-token prediction, without implementation steps.
- Examples
- Uses product-review ratings, safe responses to unsafe inputs, Codex coding assistance, and Toolformer API calls.
- What you can do after
- Evaluate/understand when continued training can steer a model’s behavior and when prompting offers an alternative.
Read how Introduction to Generative AI, Second Edition explains fine-tuning →
Data Analysis with LLMs
Fine-tuning is the process of further training an existing model on task-specific examples to adapt its behavior to a particular task.
- How it is used
- Specializes an existing model for a specific analysis task when simpler optimization methods may not suffice.
- How deep it goes
- Works through labeled-data format, model use, and a cost comparison, without showing a fine-tuning job submission in the supplied excerpts.
- Examples
- Uses labeled movie reviews, a JSON-lines chat interaction, and a ten-review accuracy and token-cost test.
- What you can do after
- Apply it via OpenAI chat models: prepare labeled examples, use a fine-tuned model ID, and assess whether its results justify its costs.
Build a Text-to-Image Generator (from Scratch)
Fine-tuning is adapting a pretrained model to a new task by updating selected parameters, often only the task-specific output layers.
- How it is used
- Applies pretrained models to specialized tasks when training from scratch would require excessive data, time, or computation.
- How deep it goes
- Explains freezing, head replacement, training, validation, and early stopping, but focuses on output-head adaptation rather than full-network retraining.
- Examples
- Uses ResNet50 to classify sample images, then adapts it to distinguish real images from AI-generated deepfakes.
- What you can do after
- Apply it via PyTorch and torchvision to build a specialized image classifier with frozen pretrained features and a trainable task head.
Read how Build a Text-to-Image Generator (from Scratch) explains fine-tuning →
Domain-Specific Small Language Models
Training a pretrained model further on task- or domain-specific data to adapt it to a narrower use case.
- How it is used
- Adapts pretrained language models to organizational domains and specialized tasks when general-purpose behavior is insufficient.
- How deep it goes
- Explains dataset preparation, tokenization, training, evaluation, inference, full fine-tuning, and PEFT, but defers detailed PEFT implementations.
- Examples
- Demonstrates DistilBERT question answering, GPT-2 data preparation, small-model code generation, and ProGen2-based antibody generation.
- What you can do after
- Build it with Hugging Face Transformers and Datasets, train a task-adapted model, and run inference against new inputs.
Read how Domain-Specific Small Language Models explains fine-tuning →
Building Reliable AI Systems
Fine-tuning is the adaptation of a pretrained model by further training it, typically on task- or domain-specific data.
- How it is used
- Adapts model behavior for specialized domains and consistent responses when prompting or RAG alone is insufficient.
- How deep it goes
- Details data preparation, model selection, API training jobs, and checkpoint inspection; identifies open-model and parameter-efficient alternatives.
- Examples
- Uses a branded customer-support bot, current inventory, medical-exam performance, code generation, and biased service logs.
- What you can do after
- Apply it via the OpenAI Python SDK to train and monitor a chat-format model, then evaluate its behavior and limitations.
Read how Building Reliable AI Systems explains fine-tuning →
Data Storytelling with Altair and AI
Fine-tuning is the additional training of a pretrained machine-learning model on targeted data to adapt its parameters to a task or domain.
- How it is used
- Adapts LLM-generated data-story titles, annotations, and commentaries to particular audiences, scenarios, and domains.
- How deep it goes
- Defines targeted retraining and walks through dataset construction, JSONL conversion, API job creation, and generation without explaining LLM internals.
- Examples
- Demonstrates audience-specific titles and commentary using household chores and popular-sports percentages, plus CSV-to-JSONL conversion.
- What you can do after
- Apply it via the OpenAI API to train and call an audience-specific model for new data commentary.
Read how Data Storytelling with Altair and AI explains fine-tuning →
Starting Data Analytics with Generative AI and Python
Fine-tuning is the further training of a pretrained model on targeted data to adapt its behavior or performance.
- How it is used
- Adapts pretrained language models to nuanced or domain-specific NLP tasks when labeled-data resources are limited.
- How deep it goes
- Explains benefits, requirements, alternatives, and overfitting risk, but stops short of procedural training details.
- Examples
- Uses BERT on Hugging Face as an NLP fine-tuning example and contrasts it with zero-shot learning and training from scratch.
- What you can do after
- Evaluate whether adapting a pretrained model suits a task by weighing data quality, model relevance, resources, and overfitting risk.
Read how Starting Data Analytics with Generative AI and Python explains fine-tuning →
Transformers in Action
Fine-tuning is the adaptation of a pretrained model by further optimizing its parameters for a specific task or behavior.
- How it is used
- Adapts pretrained language models to specific tasks or conversational behaviors using supervised examples.
- How deep it goes
- Works through data formatting, trainer configuration, training, and output checks; does not derive the optimization mathematics.
- Examples
- Uses Alpaca instruction data, ProsocialDialog conversations, and OPUS-100 English–Spanish sentence pairs.
- What you can do after
- Apply it via TRL's SFTTrainer to specialize a pretrained model and compare its generations with a baseline.
Hugging Face in Action
Fine-tuning is the adaptation of a pretrained model by continuing training on data for a particular task or domain.
- How it is used
- Adapts pretrained models for specialized tasks such as sentiment analysis, object detection, classification, and language generation.
- How deep it goes
- Explains dataset preparation, model and device setup, training configuration, evaluation, saving, and inference without deriving optimization mathematics.
- Examples
- Uses yelp_polarity reviews, DistilBERT sequence classification, training logs, saved checkpoints, and positive or negative review predictions.
- What you can do after
- Apply it via Hugging Face Trainer to train, evaluate, save, reload, and use a task-specific classification model.
The AI Pocket Book
Additional training applied to an existing model to adapt or improve its behavior using new examples.
- How it is used
- Positions fine-tuning as a late-stage customization choice after prompt improvements, especially for specialized outputs or smaller self-hosted models.
- How deep it goes
- Explains parameter adjustment, continued training, dataset size, overfitting, and validation, but defers detailed prevention techniques.
- Examples
- Uses intended-style documents, manually written prompt-output examples, and smaller self-hosted models as concrete cases.
- What you can do after
- Evaluate and select a fine-tuning strategy using validation data, test data, and checks for overfitting.
Microsoft Azure in Action
Fine-tuning is the process of further training a pretrained model on task-specific data to adapt its behavior or vocabulary.
- How it is used
- Adapts a general-purpose model to specialist review vocabulary when off-the-shelf recommendations fall short.
- How deep it goes
- Walks through data preparation, wizard submission, job inspection, and deployment; defers real-world production monitoring.
- Examples
- Uses a JSONL file pairing customer reviews with desired book recommendations for a recommendation engine.
- What you can do after
- Apply it via Azure AI Foundry’s Fine-Tuning wizard to submit labeled data, inspect a job, and deploy an inference endpoint.
Build Applications with Local AI Models on a Mac
Fine-tuning is the process of further training a pretrained model on selected examples to adapt its behavior or capabilities.
- How it is used
- Adapts a pretrained model when a change in underlying behavior is needed rather than a new instruction or retrieved reference.
- How deep it goes
- Outlines data preparation, training, export, local deployment, and iteration; leaves training implementation at a high level.
- Examples
- Uses customer-support summarization and beginner-friendly rewriting pairs, alongside legal, medical, and translation specialization scenarios.
- What you can do after
- Apply it via Unsloth and Ollama to train on personal examples, export a GGUF, and run a custom model locally.
Read how Build Applications with Local AI Models on a Mac explains fine-tuning →
AI Agents and Applications
Fine-tuning is the additional training of a pretrained model on a narrower or task-specific dataset to adapt its behavior.
- How it is used
- Adapts pretrained language models for specialized tasks, domains, terminology, workflows, and response behavior.
- How deep it goes
- Defines curated training and major tradeoffs, but stops short of dataset schemas, training code, and evaluation procedures.
- Examples
- Uses BioMistral, LexiGPT, BloombergGPT, Code Llama, and Claude Code as specialized-model examples.
- What you can do after
- Apply it via a fine-tuning API or open-source toolkit to adapt a model for specialized behavior.
Machine Learning System Design
The process of continuing training on an existing model to adapt its parameters to new data or a related task.
- How it is used
- Uses pretrained models as a deep-learning baseline for adapting existing capabilities to related tasks.
- How deep it goes
- Explains when to choose fine-tuning and what to compare, but does not detail optimization steps or parameter-freezing mechanics.
- Examples
- Uses ImageNet pet-breed recognition and PhotoStock CLIP relevancy scoring as concrete adaptation examples.
- What you can do after
- Apply it by adapting a pretrained model or its components and evaluating the result against simpler baseline options.
Read how Machine Learning System Design explains fine-tuning →
The Complete Obsolete Guide to Generative AI
Fine-tuning is continued training of a pretrained model on task- or domain-specific data to specialize its behavior.
- How it is used
- Specializes pretrained language models when general off-the-shelf behavior does not suit a task or domain.
- How deep it goes
- Outlines datasets, architecture adaptation, gradient optimization, and iterative training, but defers practical dataset construction and execution.
- Examples
- Uses positive-versus-negative sentiment labels and legal or medical domain datasets as specialization examples.
- What you can do after
- Evaluate/understand when fine-tuning may specialize a model and why it requires proprietary data and substantial hardware.
Read how The Complete Obsolete Guide to Generative AI explains fine-tuning →
Causal AI
Fine-tuning is the process of adapting a pretrained model by continuing parameter training on task-specific or domain-specific data.
- How it is used
- Aligns pretrained language models with node-specific causal Markov kernels for generating intervention-relevant text.
- How deep it goes
- Explains model selection, tokenization, dataset splitting, training configuration, generation, and Pyro integration, but not parameter-update mathematics.
- Examples
- Uses GPT-2 for King actions and BART models for Prince actions, Kingdom fate, and Prince-to-King inference.
- What you can do after
- Builds task-specific causal text generators with Hugging Face Transformers, then samples and scores their outputs inside Pyro.
Knowledge Graphs and LLMs in Action
Fine-tuning is adapting a pretrained model by continuing its training on targeted data or objectives.
- How it is used
- Improves domain-specific extraction, schema understanding, and query generation when prompting alone is insufficient.
- How deep it goes
- Explains dataset preparation, annotation reuse, trade-offs, and selective component replacement without detailing optimization internals.
- Examples
- Uses entity-relation extraction, schema-aware agents, and knowledge-graph query planning as application examples.
- What you can do after
- Build task-specific LLM components for more stable extraction or more efficient graph-aware querying.
Read how Knowledge Graphs and LLMs in Action explains fine-tuning →
AI Agents in Action
A fine-tuned model is a pretrained model further trained on additional data for a narrower behavior or domain.
- How it is used
- Refines foundation models for particular use cases, domains, chat behavior, or instruction following.
- How deep it goes
- Defines fine-tuning and relates it to staged training, but stops short of implementation steps or training configuration.
- Examples
- Uses ChatGPT’s staged training and the comparison between smaller fine-tuned models and larger general models.
- What you can do after
- Evaluate whether a domain-specific or fine-tuned model suits an agent better than a larger general-purpose model.
Machine Learning Algorithms in Depth
Fine-tuning is adapting a pretrained model to a target task by continuing training, typically with task-specific output parameters.
- How it is used
- Adapts pretrained transformer models to language-processing tasks such as question answering and language inference.
- How deep it goes
- Defines task adaptation through an additional output layer but stops short of training mechanics, optimization, or implementation details.
- Examples
- Uses BERT-based question answering and language inference as concrete fine-tuning applications.
- What you can do after
- Apply pretrained BERT with an added output layer to multiple language-processing tasks.
Read how Machine Learning Algorithms in Depth explains fine-tuning →
Data Without Labels
Fine-tuning is the adaptation of a pretrained model's parameters to optimize performance on a target task.
- How it is used
- Adapts a pretrained DBN to supervised classification or regression after unsupervised representation learning.
- How deep it goes
- Explains layer-wise pretraining, joint weight adjustment, objectives, benefits, and training difficulties without detailing optimizer implementation.
- Examples
- Uses DBNs for speech recognition, image recognition, dimensionality reduction, feature learning, and classification.
- What you can do after
- Apply supervised fine-tuning to adjust a pretrained DBN for classification or regression using labeled data.
Machine Learning Platform Engineering
Fine-tuning is the additional training of a pretrained model on task-specific data to adapt its behavior to a new task or domain.
- How it is used
- Applies pretrained models to domain-specific production tasks such as identity-card detection.
- How deep it goes
- Defines adaptation and dataset splits, then connects training with evaluation and retraining without detailing optimization internals.
- Examples
- Uses YOLOv8, COCO, identity cards, passports, and separate training, testing, and validation images.
- What you can do after
- Apply it via YOLOv8 to train a custom detector for objects absent from its original classes.
Read how Machine Learning Platform Engineering explains fine-tuning →
Outlier Detection in Python
Fine-tuning is the continued training of a pretrained model, usually on a new task or domain, by adjusting some or all of its parameters.
- How it is used
- Applies pretrained neural networks to related tasks with less retraining than training a model from scratch.
- How deep it goes
- Explains reused embeddings, selective layer retraining, benefits, and weaker transferability for tabular data.
- Examples
- Uses cat-versus-dog classification adapted to distinguishing different types of dogs.
- What you can do after
- Apply it via a pretrained neural network by retraining a final layer or adding a task-specific layer.
Financial AI in Practice
Fine-tuning adapts a pretrained model by continuing training on task-specific or domain-specific data.
- How it is used
- Adapts a pretrained model’s behavior, such as writing in a financial platform’s distinctive style.
- How deep it goes
- Explains the goal, data curation, PEFT trade-offs, and a conceptual LoRA recipe, but not a complete training workflow.
- Examples
- Uses 200 analyst-written input-output examples to adapt summaries of AlphaStream community posts.
- What you can do after
- Apply it via Hugging Face Transformers and PEFT to customize a pretrained model with LoRA.
Related concepts
- retrieval-augmented generationcontrasts with · Retrieval-augmented generation is a technique that retrieves relevant information from external sources and supplies it as context to a generative model when producing an output.
- prompt engineeringcontrasts with · Prompt engineering is the deliberate design and refinement of instructions, context, examples, or other inputs to guide an AI model’s behavior or outputs.
- custom modelproduces · A custom model is a machine-learning model trained, adapted, or configured for a particular domain, task, or set of requirements.
- reinforcement learningcontrasts with · Reinforcement learning is a machine-learning paradigm in which an agent learns actions or a policy through interaction with an environment and evaluative feedback, such as rewards.
- regressionproduces · A regression is an unintended deterioration in a system’s behavior, performance, or capabilities relative to a prior or expected level, often following a change.
- ResNet50uses · ResNet50 is a 50-layer residual convolutional neural network architecture for visual recognition and image processing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




































