Skip to content
NVIDIA AI Model and Application Development Associate (NCA-AMAD) Exam Prep

Lesson 4 of 8 · 13 min

x
4/8

Model Customization and Fine-Tuning Concepts (14%)

Video lesson: NCA-AMAD Domain 4: Model Customization and Fine-Tuning Concepts

Official exam topics: exam-guide/nca-amad-exam-page.md ("Model Customization and Fine-Tuning Concepts"). NVIDIA defines this area as key concepts for adapting a general pretrained AI or LLM for specific tasks, including fine-tuning types and approaches, data requirements, risks, pre-deployment testing and validation, and deploying fine-tuned models. The topic list also covers prompt engineering and RAG as the other two ways to customize. Expect prompt, RAG or fine-tune? which fine-tuning method? how to serve it? how to validate it? scenarios. The reading list: Mastering LLM Techniques: Customization, NeMo Customizer, LoRA with TensorRT-LLM and with NIM (Seamlessly Deploying a Swarm of LoRA Adapters), the NVIDIA RAG Blueprint docs (prompts, hybrid search, reasoning), RAG 101, chunking strategies, vector databases, NeMo Retriever PDF extraction, multilingual retrieval, guided decoding, and NVIDIA Merlin.

Exam topics in this domain 1. 4.1 Choosing an approach: prompt engineering vs RAG vs fine-tuning (data, cost, effort) 2. 4.2 Prompt engineering and optimization: system prompts, zero/few-shot, chain-of-thought, structured output 3. 4.3 RAG pipelines and best practices: ingestion, chunking, embeddings, vector indexing, hybrid search, reranking, multimodal and code retrieval 4. 4.4 What fine-tuning is, when to use it, data requirements and preparation 5. 4.5 Fine-tuning methods: SFT, instruction tuning, PEFT, LoRA, QLoRA, RLHF, DPO, KTO, GRPO, distillation 6. 4.6 Fine-tuning risks: catastrophic forgetting, overfitting 7. 4.7 Validating before deployment (offline experiments, A/B tests) and deploying fine-tuned models (adapter serving, model merging)

4.1 Prompt Engineering vs RAG vs Fine-Tuning

ApproachChangesBest forData neededCost / effort
Prompt engineeringThe inputFormat, tone, task instructions, quick iterationNone or a few examplesLowest; minutes to hours
RAGThe context (retrieved knowledge)Fresh, private or large knowledge; citations; reducing hallucinations about factsA document corpus (no labels)Moderate: pipeline, index, retrieval tuning
Fine-tuningThe model weightsBehaviour, style, domain language, consistent formats, skills, smaller/cheaper models via distillationHundreds to many thousands of labelled examplesHighest: data prep, GPUs, evaluation, model management

Order of attack: prompt engineering → RAG (for knowledge) → fine-tuning (for behaviour) — and they combine: a fine-tuned model can still use RAG. Fine-tuning is not a good way to teach frequently changing facts (they go stale and can't be cited); RAG is.

4.2 Prompt Engineering and Optimization

  • System prompt: role, goals, rules, tone, output format, what to do when unsure.
  • Zero-shot (instructions only) → few-shot (add input–output examples; consistent formatting matters) → chain-of-thought (ask for step-by-step reasoning, or use a reasoning model).
  • Structured output: ask for JSON matching a schema; enforce it with guided decoding (TensorRT-LLM and NIM support JSON-schema, regex and grammar constraints), so outputs always parse.
  • Prompt templates and variables; delimiters around untrusted input.
  • Prompt optimization: build an evaluation set, change one thing at a time, measure; automated prompt optimizers search instructions and examples against the metric.
  • The NVIDIA RAG Blueprint keeps its prompts in a configurable prompt file so teams can customize system and RAG prompts without code changes, and can enable reasoning for harder questions (more accurate, more tokens and latency).

4.3 RAG Pipelines and Best Practices (RAG 101)

Ingestion side 1. Extract content: text, tables, charts and images from PDFs and slides (NeMo Retriever extraction handles multimodal PDFs quickly on GPUs), OCR for scans, transcripts for audio. 2. Chunk: split into retrievable pieces. 3. Embed each chunk with an embedding model. 4. Index in a vector database (Milvus, cuVS-accelerated indexes, pgvector, Elasticsearch) with metadata (source, page, date, access permissions).

Query side 5. Embed the query (same embedding model), retrieve top-k candidates, optionally with query rewriting or multi-turn context. 6. Rerank candidates with a cross-encoder reranking model (for example a NeMo Retriever reranking NIM) and keep the best few. 7. Generate an answer grounded in the retrieved chunks, with citations.

Chunking (Finding the Best Chunking Strategy) | Strategy | Notes | |---|---| | Fixed token size with overlap | Simple baseline (for example 512 tokens, 10–20% overlap) | | Sentence / paragraph / section-aware | Respects document structure | | Page-level | In NVIDIA's tests it gave the most consistent accuracy across datasets, but the best choice depends on the content and queries | | Semantic | Split where meaning changes | Too small: chunks lose context. Too large: retrieval is less precise and wastes context. Evaluate with your own questions.

Search types - Semantic (dense) search: embedding similarity; matches meaning and paraphrases. - Keyword (sparse/lexical) search: BM25; exact terms, IDs, product codes, names. - Hybrid search: run both and fuse rankings (for example reciprocal rank fusion); usually best for enterprise data. The RAG Blueprint can enable hybrid search in Milvus. - Vector index types: exact (flat) vs approximate nearest neighbour (HNSW graphs, IVF clusters, GPU CAGRA); approximate search trades a little recall for big speed gains.

Multimodal, multilingual and code RAG - Multimodal: extract tables and charts as text, caption images, or use multimodal embeddings; return page images to a VLM. - Multilingual / cross-lingual: multilingual embedding models let a query in one language retrieve documents in another; reduce storage with smaller embedding dimensions or quantized vectors. - Code: chunk by function or class, keep file paths, use code-aware embeddings. - Recommender systems are a related retrieval-and-ranking problem; NVIDIA Merlin is the framework for GPU-accelerated recommenders.

4.4 What Fine-Tuning Is and When to Use It

Fine-tuning continues training a pretrained model on a smaller, task-specific dataset to change its behaviour.

Use it when: - prompts and RAG can't reach the required quality or consistency (format, tone, domain terminology); - you need a smaller, cheaper or faster model to match a large one on a narrow task (distillation); - the task needs a skill the base model lacks (a new output format, a specialized classification, tool-calling style).

Data requirements and preparation - Quality over quantity: hundreds to a few thousand clean, representative examples can be enough for PEFT; more for full fine-tuning. - Format: prompt–response pairs (SFT), conversations in the model's chat template, or preference data (chosen vs rejected) for alignment. - Cover the real distribution of inputs, including edge cases and refusals; remove duplicates and PII; split train / validation / test with no overlap; hold back an untouched test set. - Label consistently with clear guidelines; review a sample.

4.5 Fine-Tuning Methods

MethodWhat it does
SFT (supervised fine-tuning)Train on prompt → ideal response pairs
Instruction tuningSFT on many varied instructions so a base model follows instructions in general
Full fine-tuningUpdate all weights: most capacity, most memory and storage, highest forgetting risk
PEFT (parameter-efficient fine-tuning)Train a small number of new or selected parameters; base frozen
LoRAAdd small low-rank matrices (A × B, rank r) to weight matrices and train only those; adapters are megabytes; many can share one base model
QLoRALoRA on a 4-bit quantized frozen base model: fine-tune large models on one GPU
RLHFSFT → train a reward model on human preference rankings → optimize the policy with RL (PPO) against it
DPO (direct preference optimization)Learn directly from pairs (chosen vs rejected) with a classification-style loss; no separate reward model or RL loop
KTO (Kahneman–Tversky optimization)Learns from unpaired binary feedback (each response simply marked desirable or undesirable), which is easier to collect than pairs
GRPO (group relative policy optimization)RL that samples a group of responses per prompt and scores each relative to the group average, so no separate value (critic) model is needed; popular for reasoning with verifiable rewards (maths, code)
DistillationTrain a smaller student on a larger teacher's outputs (responses or logits) to keep quality at lower cost

NeMo Customizer is NVIDIA's microservice for running these jobs (LoRA, full SFT, DPO and others) through an API; the NeMo framework covers large-scale training.

4.6 Fine-Tuning Risks

RiskSymptomMitigation
Catastrophic forgettingThe model loses general skills or safety behaviour while learning the new taskPEFT/LoRA (base frozen), lower learning rate, fewer epochs, mix in general data, evaluate on general benchmarks too
OverfittingGreat on training data, worse on new inputs; memorized phrasingMore varied data, early stopping on validation loss, fewer epochs, regularization
Data leakage / contaminationInflated test scoresStrict splits, deduplicate across splits
Bias or unsafe behaviour introduced by dataNew harmful outputsCurate data, safety evaluation, guardrails
PrivacyThe model memorizes PIIRemove PII before training
MaintenanceEach base-model upgrade needs re-tuningKeep data and pipelines versioned and repeatable

4.7 Validating and Deploying Fine-Tuned Models

Before deployment - Offline experiments: compare the fine-tuned model with the base model (and the current production model) on the same held-out test set and task metrics, plus safety and general-capability checks; review failure cases. - A/B testing: route a share of real traffic to the new model and compare business and quality metrics (task completion, user ratings, escalation rate) with statistical significance; roll out gradually (canary) with rollback ready. - Shadow deployment: run the new model on live traffic without showing results, to compare safely.

Deployment options | Option | How | When | |---|---|---| | Adapter serving (multi-LoRA) | Keep one base model in GPU memory and load LoRA adapters per request (NIM and TensorRT-LLM support serving many adapters on one base) | Many tasks or customers on one base model: cheap, flexible | | Model merging | Fold the LoRA weights into the base weights (W' = W + BA) to make a standalone model | One task, lowest latency, simplest serving | | Full model | Serve the fully fine-tuned checkpoint (optimize with TensorRT-LLM, package as NIM) | Full fine-tunes |

Exam Tips - Knowledge that changes → RAG; behaviour, format and style → fine-tune; try prompts first. - Structured output: JSON schema + guided decoding. - Hybrid search = dense + BM25; rerank with a cross-encoder; chunk with overlap and test. - LoRA trains small adapters; QLoRA = LoRA on a 4-bit base. - DPO uses preference pairs with no reward model; KTO uses unpaired good/bad labels; GRPO compares a group of samples, no critic. - Catastrophic forgetting → PEFT, low LR, mix general data, evaluate broadly. - Validate offline on held-out data, then A/B test with real traffic. - Multi-LoRA adapter serving shares one base model; merging makes a standalone model.

References

  1. NVIDIA NCA-AMAD certification exam page — checked Nov 11, 2026

Check your understanding

  • Should you fine-tune the model every day to keep facts current?Show answer

    Answer

    No. Use RAG for changing knowledge; fine-tune for behaviour, format and style, and try prompting first.
  • Does DPO need a separate reward model?Show answer

    Answer

    No. DPO trains directly on preference pairs. RLHF with PPO is the method that uses a reward model.
  • Does LoRA update all of the base model's weights?Show answer

    Answer

    No. LoRA trains small low-rank adapters while the base stays frozen; QLoRA does the same on a 4-bit base.
  • Training loss is low. Can you deploy the fine-tuned model to all users?Show answer

    Answer

    No. Validate on held-out data, then A/B test with real traffic before a full rollout.
Previous

Progress is saved in this browser.

Next Lesson