Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Compare

Prompt Engineering vs RAG vs Fine-Tuning

30-second answer

Start with prompt engineering: change the instructions and examples. Add RAG when the model needs your current facts. Consider fine-tuning only when you need a consistent style or format that prompts can’t deliver, because it changes behaviour but isn’t a reliable way to add facts.

Simulate it »

Side by side

↔ Swipe the table to see every column.

Prompt engineeringRAGFine-tuning
What changesThe instructions and examplesThe context sent with each questionThe model’s weights
Best forTone, format, rulesPrivate or fast-changing facts, citationsConsistent style or a narrow task at scale
EffortMinutesIndex and retrieval to buildTraining data, training run and hosting
UpdatingEdit the textUpdate the indexTrain again
RiskPrompt driftBad retrieval gives bad answersNeeds good labelled data

Prices are illustrative pay-as-you-go list prices converted at approximate rates, for "price feel" only. Check the Azure pricing calculator for real quotes.

Which one should I pick?

  • Prompt engineering

    Pick it when the model knows enough and just needs better direction

  • RAG

    Pick it when the answer must come from your documents

  • Fine-tuning

    Pick it when you need a consistent format at high volume and prompts aren’t enough

Simulate it

3D Generative AI and agents: models, RAG, flows, agents, orchestration and tuning Ask with and without retrieval.

🖱️ Drag to rotate · scroll or pinch to zoom

Loading the 3D scene…
</> Embed

Embed this simulation

Free for trainers, teachers and bloggers. Paste this into your page:

RAG: retrieve first, then answer

Retrieval-augmented generation searches your own content (Azure AI Search, hybrid keyword plus vector), puts the best chunks in the prompt and asks the model to answer from them with citations. Without retrieval the model guesses.

Read this tour as text
  1. Deploy a model, call the deployment. A deployment is a named copy of a model with a version, a deployment type and capacity. Your app calls the deployment name, never the model name. Pick a large model for hard work and a small language model for cheap, fast, simple work.
  2. RAG: retrieve first, then answer. Retrieval-augmented generation searches your own content (Azure AI Search, hybrid keyword plus vector), puts the best chunks in the prompt and asks the model to answer from them with citations. Without retrieval the model guesses.
  3. A multistep flow with checks. A workflow breaks one big request into steps you control: classify, extract to a JSON schema, call a tool, draft, then verify. Retries, fallbacks and a final check live in code, so one bad step can’t slip through unseen.
  4. Evaluate before you ship. Evaluators score each answer on a test set: groundedness (is it supported by the context?), relevance, coherence and safety checks. A fabrication shows up as a low groundedness score on one row, so you fix it before users see it.
  5. SDK, project endpoint and connections. The Foundry SDK (azure-ai-projects) opens one door: AIProjectClient with the project endpoint and DefaultAzureCredential. From it your app gets an OpenAI-compatible client, deployments and connections (Azure AI Search, Application Insights) with no secrets in code.
  6. Design the agent: role, goal, tool schema. An agent is a model plus instructions (role and goal), tools and a conversation (thread). A strict function schema names each parameter and marks the required ones, so the model asks the user instead of inventing a value.
  7. Retrieval, function calling and memory. One agent can use file search for documents, a function for live data and memory for what it learned about a user. The model asks to call a function; your code runs it and returns the result. Memory survives into a new conversation.
  8. Multi-agent orchestration. Several specialist agents can share a job. Sequential passes work down a line, concurrent fans out and merges, handoff moves control to the right specialist, group chat lets agents take turns in one shared conversation and Magentic lets a manager agent plan and delegate. Microsoft Agent Framework builds all five.
  9. Autonomy with approvals. Reads are safe, writes are not. A tool marked approval required pauses the run until a person decides. A hard limit in code blocks what no one should approve, whatever the model says.
  10. Monitor and debug agent runs. Agent evaluators read the whole run: intent resolution, tool call accuracy and task adherence. Error analysis groups the failing rows, such as a made-up tool argument, and points to the fix.
  11. Tune prompts and parameters. Instructions shape tone and rules, a few-shot example shows the format, temperature and top_p change how adventurous the wording is, and max output tokens caps length. A self-critique loop drafts, checks against a checklist and revises once.
  12. Trace every call and count tokens. OpenTelemetry spans record each agent run, model call and tool call, with tokens and latency, and Application Insights stores them. Tracing is opt-in, and recording message content is for development only because it captures prompts and answers.
  13. Route requests to the right model. A hybrid design puts rules first for answers code can decide, a small model for easy language work and a large or reasoning model only when needed. A model router can pick for you. Fewer big-model calls means a lower bill and faster replies.

Questions people ask

Can I combine them?

Yes. Most production apps use good prompts and RAG, and a few add fine-tuning.

Does RAG stop all made-up answers?

No. It lowers them. Tell the model to say it doesn’t know, and check groundedness with an evaluator.

Learn each one properly

More comparisons

Install MSDEVBUILD Azure

Free · no account · works offline

Save the whole course for offline ›

Hi, I’m your Nimbus

Your study buddy. Pick what we do next.

MSDEVBUILD · Multi-Stack Dev Build

Sign in to MSDEVBUILD

One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.