Estimate Fine-Tuning Memory Requirements
Company: Voleon
Role: Machine Learning Engineer
Category: ML System Design
Difficulty: hard
Interview Round: Technical Screen
# Estimate Fine-Tuning Memory Requirements
Explain how to estimate accelerator memory for language-model fine-tuning. Account for parameters, gradients, optimizer states, activations, temporary buffers, precision, sequence shape, and the chosen data, tensor, or pipeline parallel strategy.
### Constraints & Assumptions
- Give a formula with named assumptions rather than a universal bytes-per-parameter claim.
- Distinguish full fine-tuning from parameter-efficient adaptation.
- Peak memory, not only steady-state allocation, determines feasibility.
### Clarifying Questions to Ask
- Which optimizer and numeric formats are used?
- How many parameters are trainable?
- What batch size, sequence length, checkpointing, and parallelism are planned?
```hint Build a memory ledger
Estimate persistent model state separately from shape-dependent activations and measured runtime overhead.
```
### What a Strong Answer Covers
- Parameter, gradient, master-weight, and optimizer-state accounting.
- Activation scaling with layers, tokens, hidden size, microbatch, and checkpointing.
- How sharding and parallelism redistribute rather than always eliminate memory.
- Headroom, fragmentation, communication buffers, profiling, and validation.
### Follow-up Questions
1. How does LoRA change memory without shrinking frozen-model inference cost?
2. Why can a theoretically fitting model still run out of memory?
Overview: Learn to estimate full and parameter-efficient fine-tuning memory with a transparent ledger for model state, activations, sharding, and peak overhead.