Estimate LoRA Parameters and Memory for a 70B Fine-Tune

Last updated: November 29, 2026

Quick Overview

For a 70B-parameter Llama-style model with grouped-query attention, estimate how many trainable parameters rank-16 LoRA adds across attention and MLP projections, and compare the training memory of LoRA, QLoRA and full fine-tuning.

Together AI
Machine Learning
Machine Learning Engineer
Together AI
November 29, 2026
Machine Learning Engineer
Technical Screen
Machine Learning
Medium

0

0

0 solved


For a 70B-parameter Llama-style model with grouped-query attention, estimate how many trainable parameters rank-16 LoRA adds across attention and MLP projections, and compare the training memory of LoRA, QLoRA and full fine-tuning.

Together AI's fine-tuning service offers both LoRA and full fine-tuning on large open models and shows customers cost and time estimates, which depend on exactly this arithmetic. The screen checks that a candidate knows where LoRA attaches, how GQA shrinks the K and V projections, and what actually dominates GPU memory in training.

What the Interviewer Expects
  • Uses r times (in + out) per adapted matrix
  • Accounts for smaller K and V projections under grouped-query attention
  • Includes MLP gate, up and down projections when targeted
  • Separates frozen weights, trainable parameters, gradients, optimizer state and activations
  • Gives order-of-magnitude memory for each method and the GPU count it implies
Key Topics to Cover
LoRA
QLoRA
parameter counting
optimizer memory
fine-tuning
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How does the choice of rank and target modules affect quality on reasoning tasks?
  • Why can many LoRA adapters share one base model at serving time, and what limits that?
  • How does activation checkpointing change the memory picture for long-context fine-tuning?
  • When would you recommend full fine-tuning over LoRA to a customer?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Assume 80 layers, hidden size 8192, MLP intermediate 28672, 64 query heads and 8 KV heads of dim 128, so K and V project 8192 to 1024. LoRA rank r=16r=16 on q, k, v, o, gate, up and down. A LoRA pair fo...

Approach

Count per layer, multiply by layers, then build memory per method: frozen weights, plus trainable parameters with their gradients and Adam states (about 16 bytes per trainable parameter in mixed preci...


Submit Your Answer
Markdown supported

Related Questions