Skip to content

Graded Quiz: Transformers and Fine-Tuning :Generative AI Engineering and Fine-Tuning Transformers (IBM AI Engineering Professional Certificate) Answers 2025

1. Why is PyTorch great for rapid prototyping?

❌ It has intuitive Python syntax
❌ It offers tools for many ML models
❌ It supports diverse neural architectures
It allows real-time testing of code segments without waiting for full implementation

Explanation:
PyTorch’s eager execution means operations run immediately, allowing fast debugging and incremental testing.


2. Best fine-tuning method for limited data & low compute?

❌ Train for many epochs on tiny data
❌ Full fine-tuning on irrelevant dataset
Parameter-efficient fine-tuning (PEFT)
❌ Use pretrained model as-is

Explanation:
PEFT (e.g., LoRA, adapters) updates only small portions of the model, preserving general knowledge and reducing compute.


3. Essential step when adapting a pretrained model (4 classes → 2 classes)?

❌ Use model without modifying output layer
❌ Freeze all layers except embeddings
❌ Replace transformer with LSTM
Adjust the final output layer from 4 to 2 neurons

Explanation:
The classifier head must match the number of target labels for the new task.


4. What does num_labels control in BERT sequence classification?

❌ Controls batch size
❌ Loads tokenizer
Defines output categories & sets number of output neurons
❌ Controls learning rate

Explanation:
num_labels directly determines the size of the classification head (e.g., 3-class, 5-class, etc.).


5. Benefit of Hugging Face SFTTrainer?

❌ Tunes hyperparameters automatically
Simplifies training by automating common tasks and reducing errors
❌ Increases dataset size
❌ Creates new tokenization schemes

Explanation:
SFTTrainer handles tokenization, batching, training loops, logging, evaluation, and more—reducing boilerplate PyTorch code.


🧾 Summary Table

Q# Correct Answer Key Concept
1 Real-time testing Eager execution in PyTorch
2 PEFT Low-compute fine-tuning
3 Adjust output layer New class count
4 num_labels sets output neurons Model head configuration
5 Automation of training flow Benefit of SFT trainer