liveBook · Manning

Chapter 2: How to do model adaptation

What you will learn in chapter 2 of LLM Customization and Fine-Tuning

The chapter introduction uses an earnings-transcript failure to show why adaptation methods must be chosen for the task rather than by how intensive they are.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduction uses an earnings-transcript failure to show why adaptation methods must be chosen for the task rather than by how intensive they are.

Key terms: fine-tuning, retrieval-augmented generation, adaptation continuum, rungs

2.1 The adaptation continuum at decision depth

This section shows how to choose an adaptation technique by weighing its costs against measured task performance and the consequences of errors.

Key terms: adaptation continuum, RAG, LoRA, model’s weights, evaluation gate, prompting, inference bill, input tokens, vector store, prompting baseline

2.2 Hybrid approaches: Most production systems stack rungs

This section explains why production systems combine fine-tuning, RAG, guardrails, and telemetry, and why teams often add those capabilities incrementally.

Key terms: RAG, LoRA, SFT, fine-tuning, current facts, base model, fine-tuned weights, RAG layer, system prompt, guardrails

2.3 Matching technique to use case

The section explains how task shape and hard constraints guide the choice of an initial adaptation technique, while treating the use-case matrix as a starting point rather than a fixed prescription.

Key terms: LoRA, RAG, labeled historical examples, private corpus, behavior, grounding, use-case matrix, recommended approach, illustrative targets, layers

2.4 Buy versus build

Introduces the decision to use a managed model API or self-host a model, identifying the main criteria and commitments of each path.

Key terms: buy versus build, managed API, data privacy and residency, expected traffic, fine-tuning, vendor, model versions, SLAs, pricing, GPU capacity

2.4.1 Buy: Start with a managed API

This section explains when to start with a managed model API and how privacy terms, usage discounts, and costs affect the decision to buy or self-host.

Key terms: managed API, model-as-a-service (MaaS), hosted inference, HTTP endpoint, prototype, capability gaps, fine-tuning dataset, data processing agreement (DPA), data-classification policy, inference data

2.4.2 Build: Self-host

This section explains what self-hosting an LLM entails, why teams choose it over a managed API, and the ongoing work that can offset its benefits.

Key terms: self-hosting, model weights, serving stack, managed API pricing, self-hosted infrastructure, GPU cluster, data privacy, regulatory requirements, restricted, third-party-managed API

2.5 Infrastructure options

This section compares three self-hosting infrastructure options and recommends a low-commitment starting point for enterprise teams.

Key terms: cloud GPU rental, on-premises GPU clusters, cloud-managed inference services, model checkpoint, traffic profile, cost and latency

2.6 Tools and frameworks

This section explains how fine-tuning libraries fit together and why the book uses TRL and PEFT as its reference stack.

Key terms: TRL, PEFT, LoRA, QLoRA, DeepSpeed, reference stack, Unsloth, Axolotl

2.7 Selecting a base model

This section gives a constraint-based framework for choosing a base model and distinguishes the two model pools commonly used in enterprise adaptation.

Key terms: base model, headroom, latency budget, training and serving, tooling ecosystem, fine-tuning recipe, LoRA, QLoRA, SFT, serving stack

2.7.1 Open-weight base models for fine-tuning

This section compares open-weight model families for fine-tuning and explains how hardware needs and use-case testing should shape the shortlist.

Key terms: fine-tuning candidate, DeepSeek V3, Llama, Mistral 7B, Qwen 4B Instruct, LoRA, QLoRA, VRAM, SFT, Qwen 3.5

2.7.2 Frontier models for reasoning tasks

This section explains when a task calls for a frontier reasoning model rather than fine-tuning a smaller model, and how to treat model choices as provisional.

Key terms: 7B model, supervised fine-tuning, deep reasoning, frontier reasoning models, Nemotron, VPC, Artificial Analysis

2.8 A quickstart preview: The shape of a fine-tune in five steps

This section walks through a small LoRA fine-tune to show the training pipeline and what its results do—and do not—demonstrate.

Key terms: LoRA, trainable artifact, single GPU, messages format, Qwen3-4B-Instruct-2507, SFTTrainer, adapter, training loss, eval loss, memorization

2.9 Security across the adaptation continuum

This section explains that model adaptation can introduce security regressions and that security belongs in the design phase.

Key terms: RAG, fine-tuning, distillation, alignment properties, security exposure, security considerations, design phase, post-deployment review

2.9.1 How each technique changes the attack surface

This section explains how RAG, fine-tuning, and distillation change an LLM system’s security exposure in different ways.

Key terms: attack surface, managed API, constrained fine-tune, RAG, retrieval pipeline, prompt injection, direct injection, indirect injection, SFT, LoRA

2.9.2 Mitigating the risks

This section identifies post-adaptation safety checks as an operational minimum for mitigating security risks.

Key terms: safety regression suite, refusals, fixed probe set, guardrails

2.10 Lightweight operationalization

The section sets out five lightweight operational practices for safely promoting, tracking, monitoring, and, when necessary, rolling back adapted models.

Key terms: promotion lanes, development, staging, production, shadow-tested, manifest, base model, dataset, seed, hyperparameters

2.11 Summary

2.12 References

This section lists external references cited in Chapter 2 without explaining their findings.

Where this is used later

Concepts explained in this chapter

← Chapter 1: Why model adaptation? Chapter 3: What data do I need for model adaptation? →

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.