Title: Midterm Exam
Course: AIINFRA 201: Model Adaptation — Fine-Tuning & Quantization > Section: Week 08 — Axolotl, Config-Driven Training, and Experiment Tracking

📝 Midterm Exam (100 pts)

Instructor note: the answer key below (marked with →) is hidden from students in the Canvas quiz view. This exam covers everything from Week 01 through Week 07 — the full arc from infrastructure fundamentals through LoRA/QLoRA fine-tuning. Review your notes and prior labs before you begin.

Part A — Applied Scenario (40 pts)

You've been asked to fine-tune a 7B parameter open-weight model on a customer-support ticket dataset (roughly 8,000 examples, average length \~300 tokens) so it can draft first-response replies. Your team has access to a single GPU with 24GB of VRAM, and leadership wants a working adapter within two days. In 200–300 words, describe your end-to-end approach: how you'd prepare the dataset, which adaptation method you'd choose and why (given the VRAM constraint), how you'd decide on batch size and precision, and how you'd validate the model before shipping it. → Model answer: Given the 24GB VRAM ceiling and a 7B model, full fine-tuning is out of reach without extensive optimization, so QLoRA is the right choice — it 4-bit quantizes the frozen base model and trains small LoRA adapters, dramatically reducing memory footprint while keeping quality close to full fine-tuning. Dataset prep: clean the ticket text, standardize a prompt/response template, deduplicate near-identical tickets, and split into train/validation sets. Given the short average length (\~300 tokens), enabling sample packing would improve throughput. Use mixed precision (bf16 if the GPU supports it) and pick the largest batch size that fits in VRAM, using gradient accumulation to simulate a larger effective batch if needed. Start from a proven example config for a similar model size rather than writing one from scratch. Before shipping, evaluate on a held-out validation split, spot-check generated replies for tone and factual correctness, and run a quick quantized-inference benchmark to confirm latency is acceptable for production.

Part B — Short Answer / MC / TF (60 pts, 5 pts each)

1. (MC) Which of the following best describes what a tokenizer does? A) Compresses model weights B) Splits text into subword units the model can process C) Reduces GPU memory usage D) Selects the learning rate → B 2. (TF) Containers guarantee that a model will produce identical outputs regardless of the underlying GPU hardware. → False — containers guarantee a consistent software environment (drivers, libraries, dependencies), not identical numerical outputs across different hardware. 3. (Short answer) Name one reason infrastructure-as-code (e.g., Docker, environment pinning) matters specifically for reproducible model training. → It ensures the same library versions, CUDA drivers, and dependencies are used across runs and across team members, eliminating "it worked on my machine" discrepancies that can silently change training results. 4. (MC) What is the primary purpose of quantization? A) Increase model accuracy B) Reduce model size/memory and speed up inference by using lower-precision numbers C) Add more training data D) Change the model architecture → B 5. (TF) LoRA fine-tunes all of a model's original parameters. → False — LoRA freezes the original weights and trains small, low-rank adapter matrices instead. 6. (Short answer) What does the "Q" in QLoRA add on top of standard LoRA? → QLoRA adds 4-bit quantization of the frozen base model weights, so the adapter is trained on top of a heavily memory-reduced base model, enabling fine-tuning on much smaller GPUs. 7. (MC) Which of these is NOT a common quantization data type discussed in this course? A) INT8 B) FP16 C) NF4 D) RGB32 → D 8. (Short answer) Why is a validation split necessary during fine-tuning, even if training loss looks good? → Training loss only reflects fit to data the model has already seen; a validation split (held out from training) reveals whether the model is generalizing or overfitting, which training loss alone can't show. 9. (TF) A larger LoRA rank always produces a better fine-tuned model. → False — higher rank increases capacity and compute/memory cost, but beyond a point it can overfit or yield diminishing returns; the best rank depends on task and dataset size. 10. (MC) When VRAM is the binding constraint on a fine-tuning job, which technique most directly addresses it? A) Increasing the learning rate B) Reducing the dataset size only C) Using QLoRA/4-bit quantization D) Switching to a larger base model → C 11. (Short answer) What is one risk of skipping dataset cleaning/deduplication before fine-tuning? → Duplicate or noisy examples can bias the model toward overrepresented patterns, waste training compute, and cause the model to memorize rather than generalize, hurting real-world performance. 12. (TF) GPU drivers and CUDA versions are irrelevant when containerizing a training environment, since containers isolate everything. → False — containers isolate software dependencies, but GPU access still depends on host-level drivers being compatible with what the container expects (e.g., via the NVIDIA Container Toolkit), so driver/CUDA compatibility still matters.