LoRA vs Full Supervised Fine-Tuning: Trade-offs, Training Data Format and Loss
Company: ByteDance
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: hard
Interview Round: Technical Screen
During a deep dive into a past project, a search and retrieval pipeline, the interviewer turned to how a pretrained language model had been fine-tuned. Answer for a project in which you fine-tuned a pretrained transformer model, for example as one component of such a pipeline, and say which model type and task you assume.
### Clarifying Questions
- Is the model a decoder that generates text (for example, rewriting queries or writing grounded answers) or an encoder that produces embeddings or relevance scores? The data format and the loss differ.
- How large is the base model, and how much GPU memory and training budget are available?
- How much labeled data is there, and how far is the target domain from the pretraining data?
- Will one base model serve several tasks or customers, each needing its own adaptation?
### Part 1 — LoRA versus full supervised fine-tuning
Explain how LoRA adapts a model and how it differs from full supervised fine-tuning, which updates every weight. Compare the two on trainable parameters, training memory, speed, output quality, forgetting of general ability, and deployment, and say when you would choose each.
```hint Count what the optimizer must hold
For each method, list what has to sit in GPU memory during training: the weights, their gradients and the optimizer state. Which of these shrink when most weights are frozen?
```
#### What This Part Should Cover
- The low-rank update, which weights stay frozen, and how many parameters are trained
- Training memory and compute, and what changes or does not change at inference time
- Quality, forgetting and multi-task serving trade-offs, ending in a decision rule
### Part 2 — Training data format and loss
Describe the input and output format of the fine-tuning examples, how an example is turned into model inputs and labels, and which loss is optimized. Explain why that loss fits the task.
```hint Which positions are graded
Look at one training example after tokenization and decide which positions should contribute to the loss and which should not.
```
#### Clarifying Questions for this Part
- Was the model trained to generate text, or to embed or score query-document pairs?
#### What This Part Should Cover
- A concrete example record and how it becomes input tokens and labels
- The loss written out, including any masking or negative examples
- Data pitfalls: template mismatches, truncation, label noise, and leakage between training and evaluation data
### What a Strong Answer Covers
- Correct mechanics of both LoRA and full fine-tuning
- Memory reasoning backed by an estimate rather than vague claims
- A loss that matches the model type and the task
- An evaluation showing improvement on the target task without regressions elsewhere
- A defensible choice for the project as assumed
### Follow-up Questions
- How do you choose the LoRA rank and which layers to adapt, and how would you tell that the rank is too low?
- The fine-tuned model got better at the target task but worse at following general instructions. What happened, and what do you change?
- How does QLoRA change the memory picture, and what does it cost?
- If you fine-tuned an embedding model for retrieval, how would you mine hard negatives, and what goes wrong when some of them are actually relevant?
Overview: A machine learning interview question on adapting a pretrained language model: compare LoRA with full supervised fine-tuning on trainable parameters, memory, quality, forgetting and deployment, then describe the training data format and the loss used. It tests practical LLM fine-tuning knowledge drawn from a project deep dive.