Lesson 3 of 4 Build Decisions for Agents and Models

Deciding When to Create Custom AI Models

This lesson explains the conditions that justify custom or fine-tuned models.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain the order of prompting, grounding and custom models.
  • Identify conditions that justify a custom model.
  • Describe where custom models can be built.

The order of options

An architect should improve an AI solution in increasing order of cost and effort. The first step is prompt engineering: clearer instructions, examples and output formats. The second is grounding with retrieval, which supplies current, organization-specific facts. Only when these do not reach the required quality, cost or latency does a custom model become worth considering, either by fine-tuning a foundation model or by training a model for a specific prediction task. Fine-tuning does not replace retrieval for current information, because a model's weights do not change when a document is updated.

Custom models carry ongoing costs that are easy to underestimate: training data must be curated and labelled, the model must be evaluated against criteria, hosted, monitored for drift and retrained, and every new base model version raises the question of whether to repeat the work.

Conditions that justify a custom model

The following situations are the usual justifications. A scenario that describes one of them, and states that prompting and grounding have been tried, points towards a custom model.

  • A prediction or classification task on structured data, such as predicting churn, demand or late payment. This is classic machine learning, and generative prompting is the wrong tool.
  • A consistent style, format or vocabulary that examples in the prompt cannot achieve reliably, such as producing reports in a strict house format.
  • Domain-specific accuracy on a narrow task where a general model makes repeated errors that grounding does not fix.
  • Cost or latency at high volume, where a smaller fine-tuned model can replace a large model with long prompts, which is a form of specialization through distillation.
  • Tool-use accuracy, where an agent repeatedly chooses or calls tools incorrectly despite clear descriptions.

Where custom models are built

Microsoft offers custom model options at different levels of effort. The following table summarizes them.

OptionTypical useEffort
AI Builder custom models (Power Platform)Document processing, prediction and classification for makersLow code
Foundry Tools customizationCustom document extraction models, custom speech, custom language modelsLow to moderate
Foundry fine-tuningSupervised fine-tuning, preference (DPO) or reinforcement fine-tuning of foundation modelsModerate
Azure Machine Learning or code-first trainingCustom machine learning models trained on the organization's dataHigh

In Foundry, supervised fine-tuning learns from example prompts and desired responses, preference fine-tuning learns from preferred and rejected responses, and reinforcement fine-tuning learns from prompts scored by a grader. The gpt-4.1 family supports supervised and preference fine-tuning, and o4-mini supports reinforcement fine-tuning.

Worked example

Deciding whether to fine-tune

An insurer's claims agent uses a large model with a 4,000-token prompt that includes 30 examples of claim categories. Accuracy is good, but the agent processes 2 million claims a year and the token cost is above budget. Claim categories have not changed for three years. What should you recommend?

Quality is already acceptable, so the problem is cost at high volume for a stable classification task. Fine-tuning a smaller model, such as gpt-4.1-mini or gpt-4.1-nano, on labelled examples of claims removes the need for the long prompt and lets a cheaper model reach the same accuracy. Adding more retrieval would not reduce cost, and training a model from scratch would be far more effort. The fine-tuned model must be evaluated against the current model on the same test set before it replaces it.

Check yourself

Answers are wrong because a policy changed last week. Will fine-tuning fix this?

Show answer

No. Fine-tuning does not keep a model current; grounding with retrieval from the updated policy does.

Exam Tips

Remember for the exam

  • Improve prompts first, then grounding, and only then consider a custom model.
  • Fine-tuning does not replace retrieval for current information.
  • Predictions on structured data are machine learning tasks, not prompting tasks.
  • Fine-tuning a smaller model is a common response to cost at high volume.