Chapter 2: How to do model adaptation
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
- Technique and task fit. Explain why fine-tuning historical earnings transcripts did not meet the bank’s need for answers about recent calls, and why retrieval-augmented generation was a better fit.
- The training threshold. Explain why moving from RAG to LoRA is the largest jump on the adaptation continuum and what new commitments begin there.
- Build and per-call costs. Distinguish the cost of building an adaptation from its cost on every call, particularly for prompting and RAG.
- Measured prompting baseline. Explain how a measured prompting baseline and an appropriate comparison bar establish whether further adaptation is needed.
- Evidence-based escalation decision. Describe how the ticket-classification example tests prompting before training and uses both reliable comparisons and downstream error cost to decide whether to move to LoRA.
- Complementary adaptation roles. Explain why fine-tuning and RAG complement each other in the investment-bank example: fine-tuning supports organization-specific behavior, while RAG supplies current facts at inference time.
- Hybrid production stack. Describe the layers of the illustrated production stack and how a request passes through the included layers and back. Explain the roles of guardrails and telemetry alongside fine-tuning and RAG.
- Task shape and technique fit. Distinguish a behavior-focused classification task suited to LoRA from a private-document question-answering task suited to RAG.
- Hard constraints and escalation. Explain why some use cases move from lighter approaches toward LoRA or full supervised fine-tuning.
- Buy versus build criteria. Explain why choosing between a managed API and a self-hosted model comes before writing training code, and describe the three considerations that guide the choice.
- Reasons to prototype first. Justify starting with a managed API while exploring a task, even if the team expects to self-host later.
- Vendor data policy gate. Describe the data-policy checks that can rule out a managed API before adoption.
- Compute crossover and limits. Explain how request volume changes the managed-API versus self-hosted cost comparison, and what the comparison leaves out.
- Self-hosting control and responsibility. Explain that self-hosting means serving downloaded model weights on infrastructure your team controls, giving the team control over the model, serving stack, and data while making it responsible for keeping the API available.
- Request volume and cost crossover. Explain why self-hosting can become cheaper than a managed API at sufficiently high request volume, provided the GPU cluster has been sized to meet demand.
- Restricted data processing needs. Describe why privacy or regulatory constraints can require self-hosting when data cannot be processed through a third-party-managed API.
- Vendor-limited customization depth. Distinguish the customization available through managed APIs from deeper model control that may require self-hosting, using an example given in the section.
- Ongoing infrastructure maintenance burden. Explain why self-hosting is an ongoing operational commitment and how underestimating that work can undermine expected savings.
- Self-hosting infrastructure trade-offs. Distinguish cloud GPU rental, on-premises GPU clusters, and cloud-managed inference services by who operates the serving infrastructure and how each balances cost, control, and operational burden.
- Starting infrastructure choice. Justify why the section recommends starting with cloud GPU rental on an existing hyperscaler before making a larger infrastructure commitment.
- Composable fine-tuning library roles. Explain that fine-tuning libraries can be combined rather than treated as mutually exclusive choices. Describe TRL as providing trainers, PEFT as implementing adapter methods such as LoRA and QLoRA, and DeepSpeed as a distributed-training layer.
- Reference stack and tool selection. Justify the book’s use of TRL plus PEFT and describe how a production team might choose another tool for a specific need, such as small-GPU speed, reproducing a published recipe, or scaling beyond one GPU.
- Base model selection constraints. Explain how task complexity and model headroom, inference latency, and available training and serving hardware affect base-model choice. Describe why a model that is too large can impede training and iteration, while one that is too small limits what domain-specific training can achieve.
- Tooling ecosystem fit. Explain why published fine-tuning recipes, serving-stack support, and compatibility with organizational standards matter when selecting a base model, especially when candidates perform similarly on benchmarks.
- Fine-Tuning Candidate Fit. Explain why a fine-tuning candidate must be capable enough for the task but small enough to iterate on, and compare the use-case strengths of DeepSeek, Llama, and Mistral.
- Qwen Training Hardware. Describe how the Qwen 4B Instruct variant's hardware requirements differ for LoRA, QLoRA, and full supervised fine-tuning.
- Leaderboard And Use-Case Testing. Distinguish the role of public leaderboards from testing candidate models on your own use case.
- Reasoning capability versus fine-tuning. Explain why fine-tuning a 7B model may not solve tasks that require deep reasoning, and why the first decision is which capable model to call and what context to give it.
- LoRA as a quickstart choice. Justify why LoRA is used for this end-to-end training preview rather than prompting, RAG, full SFT, distillation, or preference optimization.
- Five-step quickstart workflow. Trace the quickstart from preparing IT support examples through configuring the base model and LoRA, training, generating test responses, and saving the adapter.
- Training and evaluation loss gap. Explain what the contrasting training and evaluation loss changes indicate in this short run.
- Visible changes and training limits. Distinguish the quickstart’s visible format and voice changes from learning new domain knowledge, and explain why format alone is not a reason to train.
- Security exposure across techniques. Explain how different adaptation techniques can introduce unintended security exposure, using the fine-tuning regression as an example.
- Security in adaptation design. Justify considering security while designing an adaptation rather than waiting for a post-deployment review.
- Adaptation attack surfaces. Explain what an attack surface is and why adapting an LLM can change it relative to using a managed API.
- RAG retrieval injection. Distinguish direct injection in a user query from indirect injection planted in content that RAG retrieves, and explain why retrieval increases exposure even though the base model is unchanged.
- Fine-tuning data provenance. Explain how SFT or LoRA training data can change a model’s safety behavior and why the section treats data provenance as a security control.
- Distilled refusal reliability. Explain why a distilled student may reproduce common teacher outputs better than the teacher’s refusals.
- Post-adaptation safety regression checks. Explain why safety checks are an operational minimum after updating a model's weights, and describe what the checks re-test.
- Model promotion lanes. Describe the development, staging, and production lanes and what must move between them.
- Adapter artifact manifests. Explain what an adapter manifest records and why a production team keeps one.
- Canary deployment checks. Describe how a new adapter is canary-deployed and what evidence determines whether rollout continues.
- Advance rollback triggers. Explain when rollback triggers should be chosen and what kinds of signals can activate them.
- Production traffic monitoring. Describe the minimum logging and review practice and why production traffic is valuable.
What it builds on
- The continuum of techniques (chapter 1) · Introduces adaptation as a continuum of techniques.
- Choosing a starting technique (chapter 1) · Introduces the diagnostic questions for choosing a starting technique.
- The base model: Qwen3-4B-Instruct-2507 (chapter 1) · The book's base model is introduced there.
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.
- Technique and task fit: Explain why fine-tuning historical earnings transcripts did not meet the bank’s need for answers about recent calls, and why retrieval-augmented generation was a better fit.
Why it matters: Matching the method to the information the task needs can avoid an expensive system that sounds right but cannot answer the key question.
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.
- The training threshold: Explain why moving from RAG to LoRA is the largest jump on the adaptation continuum and what new commitments begin there.
Why it matters: It helps you recognize when a proposed improvement turns into a training project. - Build and per-call costs: Distinguish the cost of building an adaptation from its cost on every call, particularly for prompting and RAG.
Why it matters: A low-effort prototype can still carry a substantial production inference bill. - Measured prompting baseline: Explain how a measured prompting baseline and an appropriate comparison bar establish whether further adaptation is needed.
Why it matters: A baseline can prevent an unnecessary training run and gives an accuracy score practical meaning. - Evidence-based escalation decision: Describe how the ticket-classification example tests prompting before training and uses both reliable comparisons and downstream error cost to decide whether to move to LoRA.
Why it matters: It keeps a small, noisy score change or an impressive technique from driving the decision instead of the business consequence 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.
- Complementary adaptation roles: Explain why fine-tuning and RAG complement each other in the investment-bank example: fine-tuning supports organization-specific behavior, while RAG supplies current facts at inference time.
Why it matters: This distinction helps you choose the right layer for a behavior gap versus a current-knowledge gap. - Hybrid production stack: Describe the layers of the illustrated production stack and how a request passes through the included layers and back. Explain the roles of guardrails and telemetry alongside fine-tuning and RAG.
Why it matters: The stack shows how a deployed application combines capabilities rather than relying on one adaptation technique. - Incremental technique selection: Explain the section's practical starting approach: begin with a cheaper option, learn from it, and consider fine-tuning when prompting and retrieval no longer close the gap.
Why it matters: Starting with a less costly approach avoids committing to fine-tuning before the team sees a need for it.
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.
- Task shape and technique fit: Distinguish a behavior-focused classification task suited to LoRA from a private-document question-answering task suited to RAG.
Why it matters: Identifying whether the gap is behavior or access to knowledge helps you choose a sensible first technique. - Matrix as a starting point: Explain how to use the use-case matrix without treating its recommended technique or illustrative targets as a final prescription.
Why it matters: A starting recommendation leaves room to combine techniques once real requirements become clearer. - Hard constraints and escalation: Explain why some use cases move from lighter approaches toward LoRA or full supervised fine-tuning.
Why it matters: A concrete unmet requirement gives a defensible reason to take on the cost of heavier adaptation.
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.
- Buy versus build criteria: Explain why choosing between a managed API and a self-hosted model comes before writing training code, and describe the three considerations that guide the choice.
Why it matters: This choice determines whether you need to take on model hosting and potentially fine-tuning at all. - Vendor and hosting commitments: Distinguish what a team takes on when it buys access to a managed API versus when it builds by self-hosting.
Why it matters: The two paths create different dependencies and operational planning work.
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.
- Managed API service model: Explain what a managed API provides and what the application team still does.
Why it matters: It clarifies which operational work a team avoids by buying hosted inference. - Reasons to prototype first: Justify starting with a managed API while exploring a task, even if the team expects to self-host later.
Why it matters: A quick prototype can prevent an expensive infrastructure or training commitment before the task is understood. - Vendor data policy gate: Describe the data-policy checks that can rule out a managed API before adoption.
Why it matters: A cheap or convenient API is not an option if its terms conflict with the data the application must send. - Managed API price discounts: Distinguish when prompt caching and batch APIs reduce managed-API costs.
Why it matters: Ignoring available discounts can make a managed API look more expensive than it would be in practice. - Compute crossover and limits: Explain how request volume changes the managed-API versus self-hosted cost comparison, and what the comparison leaves out.
Why it matters: The crossover helps frame a cost decision without mistaking an illustrative compute estimate for the full cost of a project.
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.
- Self-hosting control and responsibility: Explain that self-hosting means serving downloaded model weights on infrastructure your team controls, giving the team control over the model, serving stack, and data while making it responsible for keeping the API available.
Why it matters: This trade-off frames every reason to build rather than buy. - Request volume and cost crossover: Explain why self-hosting can become cheaper than a managed API at sufficiently high request volume, provided the GPU cluster has been sized to meet demand.
Why it matters: Request volume can change which hosting option is economical. - Restricted data processing needs: Describe why privacy or regulatory constraints can require self-hosting when data cannot be processed through a third-party-managed API.
Why it matters: Data-processing constraints may decide the hosting choice regardless of cost. - Vendor-limited customization depth: Distinguish the customization available through managed APIs from deeper model control that may require self-hosting, using an example given in the section.
Why it matters: The required degree of model control can rule out a managed API even when it offers fine-tuning. - Ongoing infrastructure maintenance burden: Explain why self-hosting is an ongoing operational commitment and how underestimating that work can undermine expected savings.
Why it matters: A cost comparison is incomplete if it ignores the work of operating the service.
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.
- Self-hosting infrastructure trade-offs: Distinguish cloud GPU rental, on-premises GPU clusters, and cloud-managed inference services by who operates the serving infrastructure and how each balances cost, control, and operational burden.
Why it matters: The infrastructure choice determines how much serving work and cost your team takes on. - Starting infrastructure choice: Justify why the section recommends starting with cloud GPU rental on an existing hyperscaler before making a larger infrastructure commitment.
Why it matters: Testing against your own traffic helps you avoid committing to infrastructure before its benefits are clear.
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.
- Composable fine-tuning library roles: Explain that fine-tuning libraries can be combined rather than treated as mutually exclusive choices. Describe TRL as providing trainers, PEFT as implementing adapter methods such as LoRA and QLoRA, and DeepSpeed as a distributed-training layer.
Why it matters: Seeing the tools as complementary makes it easier to understand a fine-tuning stack. - Reference stack and tool selection: Justify the book’s use of TRL plus PEFT and describe how a production team might choose another tool for a specific need, such as small-GPU speed, reproducing a published recipe, or scaling beyond one GPU.
Why it matters: The reference stack helps you follow the book’s code, while specific constraints can justify a different production tool.
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.
- Base model selection constraints: Explain how task complexity and model headroom, inference latency, and available training and serving hardware affect base-model choice. Describe why a model that is too large can impede training and iteration, while one that is too small limits what domain-specific training can achieve.
Why it matters: A base model must be capable enough for the task while remaining practical to train and serve. - Tooling ecosystem fit: Explain why published fine-tuning recipes, serving-stack support, and compatibility with organizational standards matter when selecting a base model, especially when candidates perform similarly on benchmarks.
Why it matters: Good weights are less useful if your team must work out adaptation settings or serving support from scratch. - Enterprise model pools: Distinguish the two model pools described for enterprise adaptation: open-weight models suited to supervised fine-tuning and LoRA, and frontier reasoning models accessed through managed APIs or used as distillation teachers.
Why it matters: The two pools point to different ways an enterprise may use a model.
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.
- Fine-Tuning Candidate Fit: Explain why a fine-tuning candidate must be capable enough for the task but small enough to iterate on, and compare the use-case strengths of DeepSeek, Llama, and Mistral.
Why it matters: The best starting model depends on your workload and ability to iterate, not just a benchmark rank. - Qwen Training Hardware: Describe how the Qwen 4B Instruct variant's hardware requirements differ for LoRA, QLoRA, and full supervised fine-tuning.
Why it matters: The training method changes whether an experiment fits your available hardware. - Qwen Version Compatibility: Explain why the newer Qwen 3.5 cannot be treated as a simple replacement for the book's chosen Qwen variant.
Why it matters: A newer model version can change the work needed to keep an adaptation valid. - Leaderboard And Use-Case Testing: Distinguish the role of public leaderboards from testing candidate models on your own use case.
Why it matters: A current shortlist is useful only if its candidates also work for your actual task.
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.
- Reasoning capability versus fine-tuning: Explain why fine-tuning a 7B model may not solve tasks that require deep reasoning, and why the first decision is which capable model to call and what context to give it.
Why it matters: It helps you avoid treating fine-tuning as the answer to every model capability gap. - Provisional frontier model choices: Describe the model options named for reasoning tasks, including a self-hostable option when capability must stay inside a VPC, and explain why specific choices should be revisited.
Why it matters: It keeps a model shortlist responsive to deployment needs and changing capabilities and costs.
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.
- LoRA as a quickstart choice: Justify why LoRA is used for this end-to-end training preview rather than prompting, RAG, full SFT, distillation, or preference optimization.
Why it matters: It explains why this inexpensive exercise can demonstrate a real training run. - Five-step quickstart workflow: Trace the quickstart from preparing IT support examples through configuring the base model and LoRA, training, generating test responses, and saving the adapter.
Why it matters: The sequence gives the reader a concrete reference for later, more substantial training runs. - Training and evaluation loss gap: Explain what the contrasting training and evaluation loss changes indicate in this short run.
Why it matters: A successful training run is not, by itself, evidence that the model improved on new tickets. - Visible changes and training limits: Distinguish the quickstart’s visible format and voice changes from learning new domain knowledge, and explain why format alone is not a reason to train.
Why it matters: It prevents a noticeable formatting change from being mistaken for a meaningfully improved help-desk model. - Saved adapter artifact: Describe what is saved after training and why it is smaller than a copy of the base model.
Why it matters: The saved artifact shows how the customization can be retained without storing another full base model.
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.
- Security exposure across techniques: Explain how different adaptation techniques can introduce unintended security exposure, using the fine-tuning regression as an example.
Why it matters: An adaptation that improves a task can still make the deployed system less safe. - Security in adaptation design: Justify considering security while designing an adaptation rather than waiting for a post-deployment review.
Why it matters: Considering security early helps avoid discovering adaptation-related regressions only after deployment.
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.
- Adaptation attack surfaces: Explain what an attack surface is and why adapting an LLM can change it relative to using a managed API.
Why it matters: The security review needs to account for the whole adapted system, not just the original model. - RAG retrieval injection: Distinguish direct injection in a user query from indirect injection planted in content that RAG retrieves, and explain why retrieval increases exposure even though the base model is unchanged.
Why it matters: An unchanged model can still be exposed to malicious instructions through retrieved material. - Fine-tuning data provenance: Explain how SFT or LoRA training data can change a model’s safety behavior and why the section treats data provenance as a security control.
Why it matters: Checking where training data came from helps protect safety behavior that fine-tuning might otherwise alter. - Distilled refusal reliability: Explain why a distilled student may reproduce common teacher outputs better than the teacher’s refusals.
Why it matters: A student that generally imitates its teacher may still need separate safety checks.
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.
- Post-adaptation safety regression checks: Explain why safety checks are an operational minimum after updating a model's weights, and describe what the checks re-test.
Why it matters: Adaptation may weaken guardrails, so refusal behavior needs to be checked rather than assumed to remain intact.
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.
- Model promotion lanes: Describe the development, staging, and production lanes and what must move between them.
Why it matters: Promotion lanes provide a check before an adapted model serves users. - Adapter artifact manifests: Explain what an adapter manifest records and why a production team keeps one.
Why it matters: A manifest makes it possible to identify and audit the adapter that is actually deployed. - Canary deployment checks: Describe how a new adapter is canary-deployed and what evidence determines whether rollout continues.
Why it matters: A canary limits exposure while the team checks a new version under production conditions. - Advance rollback triggers: Explain when rollback triggers should be chosen and what kinds of signals can activate them.
Why it matters: Predefined triggers let a team react to regressions without debating the threshold during an incident. - Production traffic monitoring: Describe the minimum logging and review practice and why production traffic is valuable.
Why it matters: Keeping and reviewing production evidence helps the team spot problems that predeployment tests miss.
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
- Knowledge gaps versus behavior gaps (chapter 4) · Develops the distinction between knowledge gaps and behavior gaps.
- Golden test sets and held-out evaluation (chapter 3) · Develops the held-out evaluation set used to compare variants.
- Few-shot prompting in practice (chapter 4) · Develops the few-shot prompting approach tried before training.
- When to graduate to parameter-efficient methods (chapter 4) · Develops the decision to move from prompting and RAG to parameter-efficient methods.
- Where an adapter beats prompting (chapter 5) · Judging where an adapter beats prompting builds on recognizing behavior-focused tasks.
- The decision tree (chapter 4) · The decision tree revisits when to move beyond an initial in-context approach.
- When SFT is worth it: Decision framework (chapter 6) · The decision framework for SFT can apply the principle that a harder requirement must justify the heavier approach.
- Evaluating RAG end-to-end (chapter 4) · The buy-versus-build decision for infrastructure.
Concepts explained in this chapter
- low-rank adaptationA learned, low-rank additive change to a model's weights.
- SFTTrainerA trainer component in the TRL library for supervised fine-tuning of transformer language models.
- adapterA small trainable component added to a model to modify its behavior without updating all its original parameters.
- adaptation continuumA range of model-adaptation options, from prompting and retrieval to fine-tuning, considered as choices with different costs and complexity.
- managed APIA provider-operated model interface accessed through an API rather than self-hosted by the user.
- retrieval-augmented generationA technique that retrieves relevant external information and supplies it to a generative model when producing a response.
- baselineA reference performance level against which model changes are evaluated.
- foundation modelThe original pretrained model whose weights are kept fixed while LoRA learns an additive adaptation.
- provenanceThe record of data’s origins, transformations, and movement through processing systems.
- monitoringThe ongoing observation of a deployed model to detect performance issues, failures, or drift in production.
- adaptation techniqueThe specific method used to modify a base model, such as prompting, RAG, LoRA, fine-tuning, distillation, or alignment.
- fine-tuningFurther training a pretrained model on task- or domain-specific data to change its behavior.
- self-hostingA deployment arrangement in which systems run within an organization's own infrastructure rather than an external provider's environment.
- PEFT libraryA Hugging Face library for parameter-efficient adaptation of pretrained models.
- regressionA change that makes a model less likely to decline requests outside its competence.
- memorizationA training outcome in which a model learns training examples without correspondingly improving its ability to generalize to new examples.
- objective functionA measure of how well a model’s predictions fit its training examples, typically computed from the training objective.
- validation lossA measure of a model’s training objective on held-out data, used to assess how well it generalizes beyond its training examples.
- prompt engineeringSteering a model's behavior through its input instructions or examples without updating its weights.
- 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.
- in-context learningA technique in which a model uses examples and instructions in its prompt to perform a task without updating its weights.
- test suiteAn organized collection of test cases designed to evaluate a system against defined criteria.
- preference tuningTraining a model from preference signals so that it favors desired responses over less desired ones.
- supervised fine-tuningFurther training a pretrained model on labeled input-output examples to adapt its behavior.
- data residencyA requirement that data be stored or processed within specified geographic or organizational boundaries.
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.
