Chapter 1: Why model adaptation?
The introduction explains why general-purpose LLMs can fail at enterprise tasks and defines model adaptation as a range of ways to close that gap.
After this chapter you will be able to
- Generalist to specialist gap. Explain why a broadly capable LLM may still fail at an organization’s tasks, using the policy-assistant example to illustrate the risk.
- Model adaptation continuum. Describe model adaptation and identify the broad kinds of changes included in its continuum, without explaining how the individual techniques work.
- Adaptation as middle ground. Explain how adaptation differs from accepting an off-the-shelf model unchanged or training a new model from scratch.
- Adaptation continuum and trade-offs. Describe why choosing a technique is not a binary fine-tune-or-not decision, and explain the trade-off involved in moving along the adaptation continuum.
- Enterprise adaptation patterns. Describe the three common enterprise adaptation patterns—industry vocabulary and rules, regional languages and culture, and house tone and brand voice—and explain that a production system may target more than one.
- Industry-Specific Model Gaps. Explain why a general-purpose model may need adaptation for an industry and how an industry-specific corpus addresses the gap.
- Data Quality And Trusted Evaluation. Justify why curated domain data and a benchmark trusted by domain experts matter more than dataset size or organizational scale in these examples.
- Regional language and culture gaps. Explain why strong performance in English does not imply comparable performance across languages or cultural contexts, and why translating a benchmark may not reveal the full gap.
- Regional adaptation recipe. Describe SEA-LION as an example of adapting strong base models with regional data, and state the recipe the section gives for capturing both language and cultural context.
- Enterprise brand voice mismatch. Explain why competent general-purpose prose may still be unsuitable for an enterprise assistant, using the contrasting tones of a consumer-fintech company and a private bank.
- Input level voice and handoff. Describe how Klarna carried its brand voice without reported weight updates, and explain what its later reversal shows about customer-service handoff.
- Cost and payback comparison. Explain why adaptation and self-hosting save money only under some combinations of request volume, API tier, and operating costs. Use the section’s million-request example to contrast fast, mainstream, and frontier API tiers.
- Privacy through deployment location. Distinguish the privacy benefit of a permitted deployment location from adaptation itself, and explain what adaptation can contribute once a model runs inside that boundary.
- First-token latency and predictability. Explain what self-hosting changes about response latency and why that may matter more than raw generation speed.
- Recurring human maintenance costs. Explain why engineer and reviewer effort belongs in an adaptation ROI calculation, including what happens when a base model changes.
- Enterprise adaptation triggers. Explain how specialized accuracy gaps, high inference costs, and data-location requirements can each create a case for adaptation.
- Portability and relocated lock-in. Explain why a team might adapt a model for portability and what dependence a self-hosted adapter creates instead.
- Adapted model staffing burden. Describe the staffing obligation that can make adaptation a poor choice even when other pain points favor it.
- Good Enough Prompted Baseline. Explain why a frontier model with a careful prompt may be preferable to adaptation for commodity tasks or when it already meets the business target.
- Early Project Evaluation Gate. Describe what a team should establish before starting a training run early in an LLM project.
- Training Data Readiness. Explain why insufficient, noisy training examples or a lack of domain expertise are reasons to postpone fine-tuning.
- Base Model Refresh Cost. Explain why the pace of base-model improvements can make a frontier API preferable to a custom adapter.
- Specific Failure And Ownership. Distinguish a business pain point from the model failure adaptation is meant to fix, and state the ownership condition for building a model.
- Adaptation inputs and stages. Trace how a base model and curated data enter an adaptation step, followed by evaluation, deployment, and monitoring. Explain what each input contributes and why neither is sufficient alone.
- Evaluation and shipping gate. Explain the checks an adapted model must pass before shipping and describe how different failed checks can point to data, technique, or base-model changes.
- Adaptation continuum and axes. Explain how the techniques progress from prompting to larger-scale model changes, and distinguish techniques that change the input from those that change the model.
- Prompting and retrieval limits. Distinguish what prompting can accomplish without training from what RAG adds, and describe the principal limit of each.
- LoRA and full SFT tradeoff. Explain how LoRA differs from full SFT and when the section suggests moving from one to the other; describe QLoRA’s memory-saving role.
- Combined techniques and evaluation. Justify combining input-changing and model-changing techniques, and state the evaluation requirement before shipping any adaptation.
- Adapted Answer Tradeoff. Distinguish the base model’s answer from the LoRA and full-SFT answers to the Outlook password question. Explain both the improvement in IT-support format and voice and the remaining problem of unsupported recovery instructions.
- Behavior Demonstrated in Training Data. Explain why closing the gap requires examples of the desired behavior, such as refusing, citing a source, or escalating when the correct recovery path is unknown.
- Task Fit and Starting Point. Distinguish commodity from specialized tasks when choosing a starting technique. Explain why a commodity task can start with a carefully prompted frontier API, while most projects move beyond prompting and RAG only when measurable gaps remain.
- Measured Prompting Baseline. Explain how to establish a prompting baseline on a held-out set before training, and why the set must be large enough for the decision being made.
- Training Data Readiness. Explain when curated examples make LoRA a viable starting point and what to do when those examples are missing. Describe which evaluation and task data can be prepared before selecting a technique.
- Constraints and Escalation Choices. Match the section’s binding constraints to possible next techniques, and distinguish technique choice from the hosting decision imposed by privacy or data residency.
- Adaptation safety risks. Distinguish guardrail weakening, jailbreak transfer, and prompt-injection vulnerability in RAG-augmented systems. Explain why narrow adaptation can make a model less likely to refuse harmful requests even when its training data contains no harmful examples.
- Predeployment safety regression gate. Describe the section’s minimum safety check: run the same harmful-prompt suite on the base and adapted models, compare refusal rates, and block a meaningful regression. State the book’s release threshold and its suggested response to a failed gate.
- Teaching Model Choice. Explain why the book uses Qwen3-4B-Instruct-2507 as its primary teaching model: it is affordable to run on consumer hardware while capable enough to demonstrate generalizable behavior.
- Starter dataset composition. Describe the roughly 500-example starter dataset: its core of filtered, consistently formatted IT support questions and accepted answers from Stack Exchange, plus a small slice of Dolly-15K examples. Explain why the Dolly examples are included.
- Required and optional tooling. State the main software stack used in the book and distinguish the optional experiment-tracking tool from tools needed to run the chapters.
- Technique-dependent hardware needs. Explain how hardware requirements change with the technique, using the distillation example, and describe what the CPU smoke tests let you do.
- Repository and README roles. Describe what the public GitHub repository contains and distinguish the top-level README’s one-time setup instructions from the chapter READMEs’ specific instructions and prerequisites.
Section by section
Introduction
The introduction explains why general-purpose LLMs can fail at enterprise tasks and defines model adaptation as a range of ways to close that gap.
- Generalist to specialist gap: Explain why a broadly capable LLM may still fail at an organization’s tasks, using the policy-assistant example to illustrate the risk.
Why it matters: A convincing answer is not necessarily a reliable answer for your organization. - Model adaptation continuum: Describe model adaptation and identify the broad kinds of changes included in its continuum, without explaining how the individual techniques work.
Why it matters: Adaptation is not one method: teams have several broad kinds of change available.
Key terms: general-purpose large language model (LLM), generalist, specialist, model adaptation, pretrained LLM, continuum, input-level changes, parameter updates, behavioral shaping
1.1 The adaptation problem
The section frames model adaptation as a middle ground and a continuum of choices that should be guided by the use case, evidence, and ongoing business ownership.
- Adaptation as middle ground: Explain how adaptation differs from accepting an off-the-shelf model unchanged or training a new model from scratch.
Why it matters: This distinction clarifies what an enterprise adaptation project is trying to change. - Adaptation continuum and trade-offs: Describe why choosing a technique is not a binary fine-tune-or-not decision, and explain the trade-off involved in moving along the adaptation continuum.
Why it matters: A fit-for-purpose starting point avoids treating fine-tuning as the automatic answer. - Evidence before model training: Explain why a team should test whether prompting or RAG is sufficient and pay attention to representative data and held-out evaluation before committing to training.
Why it matters: Testing simpler options and establishing evaluation evidence can prevent unnecessary training. - Business metric and ownership: State the budget owner’s starting question for an adaptation project and explain why evaluation needs an owner after launch.
Why it matters: An adaptation proposal needs both a business outcome and a plan to keep checking it after deployment.
Key terms: adaptation, pre-trained model, off-the-shelf API, adaptation continuum, rungs, prompting, RAG, LoRA, high-quality, representative examples, held-out evaluation set
1.2 Scenarios where adaptation pays off
The section identifies three common enterprise adaptation patterns and notes that they can be combined.
- Enterprise adaptation patterns: Describe the three common enterprise adaptation patterns—industry vocabulary and rules, regional languages and culture, and house tone and brand voice—and explain that a production system may target more than one.
Why it matters: These patterns help you recognize what an enterprise wants adaptation to accomplish.
Key terms: industry’s vocabulary and rules, region’s languages and culture, house tone and brand voice
1.2.1 Scenario 1: Industry-specific models
This section shows why industry-specific data matters when adapting general-purpose models, illustrates different adaptation routes, and emphasizes data quality and trusted evaluation over scale.
- Industry-Specific Model Gaps: Explain why a general-purpose model may need adaptation for an industry and how an industry-specific corpus addresses the gap.
Why it matters: It gives you a concrete reason to consider adaptation rather than assuming general-purpose performance will transfer to your domain. - Different Industry Adaptation Routes: Distinguish the input-level and weight-update routes illustrated by the finance examples, and describe another concrete industry use from the section.
Why it matters: The examples show that matching a model to an industry can take different forms depending on the task. - Data Quality And Trusted Evaluation: Justify why curated domain data and a benchmark trusted by domain experts matter more than dataset size or organizational scale in these examples.
Why it matters: It keeps an adaptation project focused on useful evidence of domain performance rather than sheer training volume.
Key terms: general-purpose model, industry-specific corpus, terminology, regulatory boundaries, workflow conventions, input-level route, weight-update route, retrieval, fine-tuned, catalog tagging
1.2.2 Scenario 2: Regional and cultural adaptation
This section explains why English-heavy general-purpose LLMs can fall short on regional languages and cultural context, and illustrates a regional adaptation approach with SEA-LION.
- Regional language and culture gaps: Explain why strong performance in English does not imply comparable performance across languages or cultural contexts, and why translating a benchmark may not reveal the full gap.
Why it matters: It helps you distinguish a language performance gap from a cultural knowledge gap when considering adaptation. - Regional adaptation recipe: Describe SEA-LION as an example of adapting strong base models with regional data, and state the recipe the section gives for capturing both language and cultural context.
Why it matters: It connects the regional gap to a concrete adaptation approach without assuming that translation alone is enough.
Key terms: English-heavy training corpora, translated benchmark, cultural gap, code-switching, SEA-LION, strong base, curated regional corpus, fine-tuning
1.2.3 Scenario 3: Enterprise tone and brand
This section shows why enterprise assistants need a deliberate brand voice, how that voice can be shaped without or with weight updates, and why customer-service quality still requires human handoff.
- Enterprise brand voice mismatch: Explain why competent general-purpose prose may still be unsuitable for an enterprise assistant, using the contrasting tones of a consumer-fintech company and a private bank.
Why it matters: Brand fit is a reason to adapt an assistant even when its prose is already competent. - Input level voice and handoff: Describe how Klarna carried its brand voice without reported weight updates, and explain what its later reversal shows about customer-service handoff.
Why it matters: An assistant can sound on-brand and resolve chats quickly while still needing safeguards for service quality. - Weight based house style: Describe the section’s alternative of moving voice into model weights, including the reported SK Telecom results and the proposed LoRA starting point.
Why it matters: This offers a concrete, potentially affordable route when a team wants a stable house style.
Key terms: general-purpose model, brand, tone and voice, input-level rung, scaffolding, weight updates, hand off, fine-tuned, LoRA, open base model
1.3 The numbers: ROI in real terms
This section shows how to assess adaptation ROI through cost, deployment constraints, latency, proprietary value, and ongoing human effort.
- Cost and payback comparison: Explain why adaptation and self-hosting save money only under some combinations of request volume, API tier, and operating costs. Use the section’s million-request example to contrast fast, mainstream, and frontier API tiers.
Why it matters: A savings case needs a comparison with the API tier and traffic you actually have, not a blanket claim that self-hosting is cheaper. - Privacy through deployment location: Distinguish the privacy benefit of a permitted deployment location from adaptation itself, and explain what adaptation can contribute once a model runs inside that boundary.
Why it matters: For a regulated use case, a deployable model may have value even when it is not the cheapest option. - First-token latency and predictability: Explain what self-hosting changes about response latency and why that may matter more than raw generation speed.
Why it matters: For a conversational service, a quick, steady start can matter more than a dramatic reduction in total generation time. - Proprietary behavioral advantage: Describe how adaptation can create a competitive advantage from an organization’s own data, expertise, or customer feedback.
Why it matters: Some adaptation projects are justified by differentiated behavior rather than immediate hosting savings. - Recurring human maintenance costs: Explain why engineer and reviewer effort belongs in an adaptation ROI calculation, including what happens when a base model changes.
Why it matters: A project that looks economical on GPU costs alone may not pay off once recurring people and evaluation work is included.
Key terms: ROI, fast tier, mainstream tier, frontier tier, self-hosting, payback, privacy, data sovereignty, data-residency, no-training commitments
1.4 Enterprise pain points
This section identifies enterprise problems that can justify model adaptation and explains the operational responsibility that adaptation shifts onto the team.
- Enterprise adaptation triggers: Explain how specialized accuracy gaps, high inference costs, and data-location requirements can each create a case for adaptation.
Why it matters: These problems give a team concrete reasons to consider adaptation rather than treating it as a goal in itself. - Portability and relocated lock-in: Explain why a team might adapt a model for portability and what dependence a self-hosted adapter creates instead.
Why it matters: Portability is a trade-off, not an escape from ongoing dependence. - Adapted model staffing burden: Describe the staffing obligation that can make adaptation a poor choice even when other pain points favor it.
Why it matters: A credible adaptation decision must include the people needed to operate the model after deployment.
Key terms: accuracy gap, specialized vocabulary, inference costs, data residency, model portability, vendor lock-in, self-hosted adapter, evaluation gate, retrain, guardrails
1.5 When NOT to adapt
This section explains when to avoid model adaptation and what evidence, data, and ongoing ownership should be in place before attempting it.
- Good Enough Prompted Baseline: Explain why a frontier model with a careful prompt may be preferable to adaptation for commodity tasks or when it already meets the business target.
Why it matters: A working baseline can save you from training a model that costs more without solving a business problem. - Early Project Evaluation Gate: Describe what a team should establish before starting a training run early in an LLM project.
Why it matters: A baseline and held-out test make it possible to tell whether training actually helped. - Training Data Readiness: Explain why insufficient, noisy training examples or a lack of domain expertise are reasons to postpone fine-tuning.
Why it matters: Waiting to build trustworthy examples is better than teaching the model from unreliable ones. - Base Model Refresh Cost: Explain why the pace of base-model improvements can make a frontier API preferable to a custom adapter.
Why it matters: The continuing cost of keeping an adapter current can outweigh the value of its customization. - Specific Failure And Ownership: Distinguish a business pain point from the model failure adaptation is meant to fix, and state the ownership condition for building a model.
Why it matters: A concrete failure gives adaptation a target, while ownership makes the resulting model maintainable.
Key terms: commodity use cases, frontier API, held-out evaluation set, prompt, prompting, retrieval, baseline, domain expert, high-quality examples, fine-tuning
1.6 How model adaptation works
The section frames the cost of choosing the wrong adaptation technique and introduces the process and technique continuum that the following sections will explain.
1.6.1 The adaptation lifecycle
This section explains how base models and curated data move through adaptation, evaluation, deployment, and monitoring in a continuous lifecycle.
- Adaptation inputs and stages: Trace how a base model and curated data enter an adaptation step, followed by evaluation, deployment, and monitoring. Explain what each input contributes and why neither is sufficient alone.
Why it matters: A successful training run cannot compensate for poor inputs, especially poorly curated data. - Evaluation and shipping gate: Explain the checks an adapted model must pass before shipping and describe how different failed checks can point to data, technique, or base-model changes.
Why it matters: The gate keeps an adaptation from shipping merely because training completed. - Production feedback loop: Describe how deployment and monitoring feed newly observed failures into the next dataset iteration, making adaptation an ongoing practice.
Why it matters: Production use can expose problems that pre-deployment tests did not catch.
Key terms: base model, curated data, adaptation step, adaptation lifecycle, held-out set, production workload, safety regression check, evaluation gate, deployment and monitoring, failure mode
1.6.2 The continuum of techniques
This section compares adaptation techniques by effort and by whether they change the model’s input or the model itself, then explains why production systems combine and evaluate them.
- Adaptation continuum and axes: Explain how the techniques progress from prompting to larger-scale model changes, and distinguish techniques that change the input from those that change the model.
Why it matters: These two distinctions make the options easier to compare and combine. - Prompting and retrieval limits: Distinguish what prompting can accomplish without training from what RAG adds, and describe the principal limit of each.
Why it matters: It helps you choose between improving instructions and supplying current, citable information. - LoRA and full SFT tradeoff: Explain how LoRA differs from full SFT and when the section suggests moving from one to the other; describe QLoRA’s memory-saving role.
Why it matters: It frames the choice between a smaller training change and the added capacity and demands of full fine-tuning. - Teacher student distillation: Describe how distillation uses a powerful teacher to train a smaller student and why an organization might choose it.
Why it matters: It offers a way to capture useful teacher behavior without paying for a teacher call on every request. - Preference alignment purpose: Explain what alignment changes after a model can perform a task, and distinguish the preference signals described for DPO and GRPO.
Why it matters: It separates improving task capability from shaping which responses the model favors. - Combined techniques and evaluation: Justify combining input-changing and model-changing techniques, and state the evaluation requirement before shipping any adaptation.
Why it matters: A complementary stack addresses different gaps, while representative testing checks that it works on the cases users will actually bring.
Key terms: continuum of techniques, what the model sees, what the model is, prompting, in-context learning, response schema, retrieval-augmented generation, retrieval quality, LoRA, QLoRA
1.6.3 What the gap actually looks like
The section contrasts base and adapted answers to show that fine-tuning can improve task-specific format and voice while making ungrounded answers sound more confident.
- Adapted Answer Tradeoff: Distinguish the base model’s answer from the LoRA and full-SFT answers to the Outlook password question. Explain both the improvement in IT-support format and voice and the remaining problem of unsupported recovery instructions.
Why it matters: A polished support answer is not necessarily a trustworthy one. - Behavior Demonstrated in Training Data: Explain why closing the gap requires examples of the desired behavior, such as refusing, citing a source, or escalating when the correct recovery path is unknown.
Why it matters: Examples of the right response to uncertainty matter more than merely teaching the model to sound helpful. - Clinical Tasks Beyond Prompting: State what the cited clinical study illustrates about fine-tuning when prompt engineering falls short, particularly for structured output from unstructured health records.
Why it matters: The clinical example shows that adaptation can address a task gap, not just change an answer’s style.
Key terms: base model, LoRA adapter, full-SFT model, house format, ungrounded, training data, desired behavior, refuse, cite a source, escalate
1.7 Choosing a starting technique
This section uses four diagnostic questions to choose an initial adaptation technique, starting with a measured baseline and adding training only when the evidence and constraints warrant it.
- Task Fit and Starting Point: Distinguish commodity from specialized tasks when choosing a starting technique. Explain why a commodity task can start with a carefully prompted frontier API, while most projects move beyond prompting and RAG only when measurable gaps remain.
Why it matters: Starting simply avoids training a model before you have evidence that the task needs it. - Measured Prompting Baseline: Explain how to establish a prompting baseline on a held-out set before training, and why the set must be large enough for the decision being made.
Why it matters: Without a baseline, you cannot tell whether training is necessary or whether it improved the result. - Training Data Readiness: Explain when curated examples make LoRA a viable starting point and what to do when those examples are missing. Describe which evaluation and task data can be prepared before selecting a technique.
Why it matters: Preparing representative examples and a common test set makes a training decision possible and comparisons meaningful. - Constraints and Escalation Choices: Match the section’s binding constraints to possible next techniques, and distinguish technique choice from the hosting decision imposed by privacy or data residency.
Why it matters: Separating performance and cost gaps from hosting restrictions helps a team choose both an appropriate technique and an acceptable place to run it.
Key terms: commodity, specialized, frontier API, prompting plus RAG, prompting baseline, held-out set, accuracy, LoRA, high-quality, domain-representative examples, data curation
1.8 Considerations: Safety and adaptation risk
This section explains how model adaptation can weaken safety behavior and sets out a minimum regression check before deployment.
- Adaptation safety risks: Distinguish guardrail weakening, jailbreak transfer, and prompt-injection vulnerability in RAG-augmented systems. Explain why narrow adaptation can make a model less likely to refuse harmful requests even when its training data contains no harmful examples.
Why it matters: A model that improves on its target task may still become less safe to deploy. - Predeployment safety regression gate: Describe the section’s minimum safety check: run the same harmful-prompt suite on the base and adapted models, compare refusal rates, and block a meaningful regression. State the book’s release threshold and its suggested response to a failed gate.
Why it matters: A repeatable release gate can catch safety losses that task-performance testing misses.
Key terms: guardrail weakening, jailbreak transfer, adversarial vulnerability, prompt injection, refusal behavior, safety regression suite, refusal rate, base model, release gate, explicit refusal examples
1.9 What you’ll need to follow along
States the Python prerequisite and reassures readers that fine-tuning is taught from first principles with runnable companion code.
1.9.1 The base model: Qwen3-4B-Instruct-2507
This section explains why the book uses Qwen3-4B-Instruct-2507, what hardware its fine-tuning examples require, and how the workflows extend to other models.
- Teaching Model Choice: Explain why the book uses Qwen3-4B-Instruct-2507 as its primary teaching model: it is affordable to run on consumer hardware while capable enough to demonstrate generalizable behavior.
Why it matters: The model choice makes the book’s exercises accessible without making them merely toy examples. - Fine-Tuning Memory Requirements: Distinguish the approximate GPU memory needs of Qwen3-4B LoRA, QLoRA, and full supervised fine-tuning, and explain why full fine-tuning needs more.
Why it matters: These estimates help you tell which book exercises fit your available GPU. - Workflow Portability Across Models: Explain that the book’s adaptation workflows apply beyond Qwen3-4B, while changing models or deployment settings can require practical configuration changes.
Why it matters: You can carry the book’s workflows into your own model environment rather than treating them as Qwen-only recipes.
Key terms: Qwen3-4B-Instruct-2507, open-weight, consumer GPUs, LoRA, QLoRA, full SFT, VRAM, gradients, optimizer state, Qwen3-4B
1.9.2 The starter dataset: IT support Q&A from Stack Exchange and Dolly
This section introduces the small, publicly sourced IT support dataset used in the book’s hands-on chapters and explains why it includes general-instruction examples.
- Starter dataset composition: Describe the roughly 500-example starter dataset: its core of filtered, consistently formatted IT support questions and accepted answers from Stack Exchange, plus a small slice of Dolly-15K examples. Explain why the Dolly examples are included.
Why it matters: The mix explains why the practice data contains both support answers and more general instructions.
Key terms: IT support dataset, Stack Exchange, Databricks Dolly-15K, general-instruction dataset
1.9.3 Tooling and hardware
This subsection identifies the book’s software toolchain and shows how hardware needs vary by technique, with CPU smoke tests available before GPU runs.
- Required and optional tooling: State the main software stack used in the book and distinguish the optional experiment-tracking tool from tools needed to run the chapters.
Why it matters: You can prepare the shared environment without treating optional tracking software as a prerequisite. - Technique-dependent hardware needs: Explain how hardware requirements change with the technique, using the distillation example, and describe what the CPU smoke tests let you do.
Why it matters: You can check that code runs locally and budget GPU hardware for the technique you actually plan to use.
Key terms: Python 3.12, PyTorch 2.x with CUDA, Hugging Face Transformers, TRL, PEFT, datasets library, hardware bar, distillation, LoRA student, 24 GB card
1.9.4 The code repository
This section tells readers where to find the book’s practical materials and which README to use for setup and chapter-specific instructions.
- Repository and README roles: Describe what the public GitHub repository contains and distinguish the top-level README’s one-time setup instructions from the chapter READMEs’ specific instructions and prerequisites.
Why it matters: Knowing which README to consult helps you set up once and find the right instructions for each chapter.
Key terms: public GitHub repository, top-level README, chapter READMEs, smoke test
1.10 How this book teaches model adaptation
The section introduces a recurring help desk example and outlines the book’s incremental, hands-on approach to teaching model adaptation.
1.11 Summary
1.12 References
This section lists the sources cited in chapter 1 without explaining their findings or methods.
Where this is used later
- The adaptation continuum at decision depth (chapter 2) · Examines the adaptation continuum at decision depth.
- Hybrid approaches: Most production systems stack rungs (chapter 2) · Examines production systems that combine approaches.
- Golden test sets and held-out evaluation (chapter 3) · Develops held-out evaluation through golden test sets.
- The case for in-context learning (chapter 4) · Develops the case for in-context approaches.
- Long-term maintenance practices (chapter 9) · Develops long-term maintenance practices relevant to ongoing ownership.
- Finance: Dragon LLM domain models (chapter 5) · The idea of adapting models for an industry-specific use case.
- Use RAG when knowledge gaps appear (chapter 4) · Provides an example of using retrieval over an internal corpus instead of weight updates.
- Why data quality is important (chapter 3) · Develops the importance of data quality.
Concepts explained in this chapter
- model adaptationModifying a pretrained model for a particular task, domain, or use case without training it from scratch.
- distillationTraining a student model to imitate the behavior of a teacher model, often a larger or stronger one.
- preference tuningTraining a model from preference signals so that it favors desired responses over less desired ones.
- retrieval-augmented generationA technique that retrieves relevant external information and supplies it to a generative model when producing a response.
- supervised fine-tuningFurther training a pretrained model on labeled input-output examples to adapt its behavior.
- low-rank adaptationA learned, low-rank additive change to a model's weights.
- prompt engineeringSteering a model's behavior through its input instructions or examples without updating its weights.
- alignment trainingSteering a model's behavior toward human or organizational preferences and constraints.
- in-context learningA technique in which a model uses examples and instructions in its prompt to perform a task without updating its weights.
- evaluation datasetA subset of examples reserved for evaluating a model rather than updating its parameters.
- fine-tuningFurther training a pretrained model on task- or domain-specific data to change its behavior.
- schemaA fixed arrangement of fields and separators used to present examples and queries in a consistent format for a model.
- baselineA reference performance level against which model changes are evaluated.
- adaptation continuumA range of model-adaptation options, from prompting and retrieval to fine-tuning, considered as choices with different costs and complexity.
- data sovereigntyThe control of sensitive data within an organization's own infrastructure or jurisdiction so it does not leave the trusted boundary.
- latencyThe time between sending a request and receiving a response, including network and processing delays.
- return on investmentReturn on investment: the economic benefit of an investment relative to its cost.
- QLoRAA LoRA-based fine-tuning method that loads the base model in low-bit precision to reduce memory use during adaptation.
- parameter-efficient fine-tuningAdapting a pretrained model by updating only a small number of added or selected parameters rather than all its weights.
- privacyThe requirement that sensitive data not be exposed to external systems during model use or deployment.
- self-hostingA deployment arrangement in which systems run within an organization's own infrastructure rather than an external provider's environment.
- safety regression suiteThe practice of repeatedly evaluating model changes for newly introduced safety failures.
- costThe money required to train, operate, or maintain a model.
- data curationThe process of selecting, cleaning, organizing, and preparing data for adaptation or evaluation.
- failure modeA recurring way in which a retrieval-augmented generation system can produce incorrect or degraded behavior in production.
- refusal rateRefusal rate is the proportion of tested requests that a model refuses, with the request set determining whether it measures appropriate or harmful-request refusals.
- adaptation techniqueThe specific method used to modify a base model, such as prompting, RAG, LoRA, fine-tuning, distillation, or alignment.
- foundation modelThe original pretrained model whose weights are kept fixed while LoRA learns an additive adaptation.
- brand voiceThe distinctive tone, style, and messaging an organization wants its text to convey.
- quality gateA check that determines whether generated or collected examples meet quality requirements before they are accepted into a dataset.
- data residencyA requirement that data be stored or processed within specified geographic or organizational boundaries.
- adapterA small trainable component added to a model to modify its behavior without updating all its original parameters.
- Direct Preference OptimizationA method that tunes a model directly from preference comparisons without separately training a reward model.
- Group Relative Policy OptimizationA reinforcement-learning method that optimizes a policy using relative comparisons among groups of sampled outputs instead of a separate critic network.
- student modelA student model is a smaller model trained to mimic a teacher model during distillation.
- teacher modelA model whose outputs or behavior provide targets for training a student model during distillation.
- driftA change over time in inputs, their relationship to correct outputs, or model behavior that can degrade performance.
- prompt cachingA technique that stores reusable prompt prefixes or inputs so repeated content does not need to be processed or billed in the same way each time.
- demonstrationA data example consisting of an input prompt and its desired completion.
- accuracyThe proportion of evaluated predictions or answers that are correct.
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.
