Lesson 3 of 3 Agents in Microsoft 365 and Foundry

Designing Solutions with Custom Models in Foundry

This lesson explains fine-tuning methods, training and deployment options, and how agents consume custom models.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish supervised, preference and reinforcement fine-tuning.
  • Compare training and deployment types.
  • Describe how agents consume a custom model.

Fine-tuning methods and training options

Foundry supports three main fine-tuning methods. Supervised fine-tuning (SFT) learns from examples of prompts and desired responses, and suits format, style and task specialization. Preference fine-tuning, using direct preference optimization (DPO), learns from pairs of preferred and rejected responses, and suits aligning tone and judgement. Reinforcement fine-tuning (RFT) learns from prompts scored by a grader, and suits reasoning tasks with checkable answers. Distillation, where a large teacher model generates training examples for a smaller student model, is a common way to create SFT data.

Training runs with a training type that sets data handling and price. The following table summarizes the training types.

Training typeCharacteristics
StandardTraining in the resource's region, for data residency
Data zoneTraining within a data zone (only the United States zone is supported)
GlobalLower cost, with no data residency guarantee
DeveloperUses idle capacity, with no service level agreement; jobs can be pre-empted

Model support varies: the gpt-4.1, gpt-4.1-mini and gpt-4.1-nano models support supervised and preference fine-tuning, o4-mini supports reinforcement fine-tuning, and several open models, such as Llama, Qwen, gpt-oss and Ministral, support supervised fine-tuning.

Deploying and consuming a custom model

A fine-tuned model is deployed before use. Serverless deployment lets Foundry host the model, with deployment types such as Standard, Global Standard and Data Zone Standard, or Provisioned Throughput for predictable high volume. A Developer deployment is intended only for evaluation and lasts 24 hours. Managed compute, with dedicated GPUs, is in preview. Hosted fine-tuned deployments can carry a hosting charge in addition to token charges, so an unused deployment should be removed.

Agents and apps then consume the model. A Foundry agent can use the deployment as its model. A Copilot Studio agent can call it through a prompt that uses a Foundry model, through a custom connector to the endpoint, or by connecting to a Foundry agent that uses it. Models trained with Azure Machine Learning for prediction tasks are deployed as endpoints and called as tools.

Designing the solution around the model

A custom model is part of a larger solution, and the design should cover the elements around it.

  • Data pipeline: how training data is collected, labelled, cleaned and versioned.
  • Evaluation: validation criteria and a held-out test set that the model must pass before deployment.
  • Baseline comparison: the custom model must outperform, or match at lower cost, the base model with good prompting.
  • Residency: training type and deployment type must match data residency requirements.
  • Lifecycle: retraining triggers, version management and the response to new base model versions.
  • Fallback: what the solution uses if the custom deployment is unavailable.
Worked example

A fine-tuned classification model for an agent

A bank in Germany wants its Copilot Studio service agent to classify customer complaints into 40 regulatory categories. Prompting a large model achieves 82 percent accuracy, and the regulator expects at least 92 percent. The bank has 60,000 labelled complaints, and data must remain in Germany. What should you recommend?

Prompting has been tried and falls short, the task is narrow and stable, and labelled data exists, so supervised fine-tuning of a model such as gpt-4.1-mini is justified. To keep data in Germany, training uses the Standard training type in a German region, and the model is deployed with the Standard deployment type in that region, not Global. The model is evaluated on a held-out test set against the 92 percent criterion before release, and the Copilot Studio agent calls it through a prompt that uses the Foundry model or a connector to the endpoint.

Check yourself

Which fine-tuning method learns from pairs of preferred and rejected responses?

Show answer

Preference fine-tuning with direct preference optimization (DPO).

Exam Tips

Remember for the exam

  • SFT learns from examples, DPO from preferred and rejected pairs, RFT from graded prompts.
  • Standard training keeps data in region; Global is cheaper with no residency guarantee; Developer has no SLA.
  • Developer deployments last 24 hours for evaluation; managed compute is preview.
  • Copilot Studio can use a custom model through a prompt, a connector or a connected Foundry agent.