DevPrep

All topics › AI fundamentals for developers

Fine-tuning, prompting or RAG: which to choose, and what is LoRA?

Senior PRO

Essence

There are three ways to adapt a model to a task: prompting (explain in words and show examples), RAG (insert the needed knowledge into the request) and fine-tuning (change the model's weights on your data). The order of choice is almost always: prompting first, then RAG, and only if that's not enough — fine-tuning. The short rule: RAG adds knowledge, fine-tuning changes behavior.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store