AI & Cloud Infrastructure

Fine-Tuning in Microsoft Foundry: Building Production-Ready AI Agents - Microsoft Ignite 2025

By Technspire Team
November 28, 2025
23 views

Pre-trained AI models are brilliant generalists—but your enterprise needs specialists. An agent that understands your industry terminology, follows your specific workflows, and invokes your tools correctly isn't optional—it's essential. Microsoft Ignite 2025 session BRK188 revealed how fine-tuning in Microsoft Foundry transforms general-purpose models into production-ready agents that are accurate, consistent, and cost-effective. This isn't theory—it's proven techniques with real-world results: 40-60% cost reduction, 3-5x faster inference, and accuracy improvements from 70% to 95%+.

The Fine-Tuning Imperative: Why Generic Models Fail in Production

Pre-trained models like GPT-4, Claude, or Llama are trained on internet-scale data—incredibly capable, but not specialized for your business:

  • Inconsistent outputs: Same prompt yields different results. Production systems need reliability.
  • Poor tool calling accuracy: Generic models struggle with complex function signatures, miss required parameters, invoke wrong tools
  • Domain ignorance: Don't understand industry-specific terminology (medical codes, legal citations, financial instruments)
  • Verbose responses: Generic models over-explain. Agents need concise, structured outputs.
  • High latency: Large models (GPT-4, Claude Opus) are slow. Agents need sub-second response times.
  • Expensive: Frontier models cost $0.03-0.06 per 1K tokens. At scale, costs explode.

Fine-tuning adapts models to your specific use case—teaching them your terminology, workflows, and quality standards. The result: agents that perform reliably in production.

Key insight from BRK188: Fine-tuning isn't about building better chatbots—it's about building agents that execute complex workflows with tool calling accuracy above 95%. When an agent must invoke 5-10 tools correctly in sequence, even 90% per-tool accuracy results in 60% workflow success. Fine-tuning brings per-tool accuracy to 98%+, enabling reliable multi-step automation.

🇸🇪 Technspire Perspective: Swedish Healthcare Provider's Clinical Agent Crisis

A Swedish regional healthcare authority (14 hospitals, 3,200 clinicians) deployed an AI agent to assist with clinical documentation—extracting structured data from doctor notes, populating electronic health records (EHR), and coding diagnoses.

The problem with generic GPT-4:

  • Accuracy: 72% (unacceptable for medical records)
  • ICD-10 diagnostic coding: 65% correct (required: 95%+)
  • Tool calling errors: 28% of EHR system API calls had incorrect parameters
  • Inconsistency: Same note processed twice produced different structured outputs
  • Cost: $0.04 per note × 12,000 notes/day = $480/day = $175K/year
  • Latency: 8-12 seconds per note (clinicians waiting, frustrated)

The fine-tuning transformation: Technspire used Microsoft Foundry to fine-tune GPT-4o-mini on 50,000 clinical notes (de-identified patient data + expert annotations):

  • Training data: Clinical notes with correct ICD-10 codes, medication extractions, and EHR API calls
  • Supervised fine-tuning: Model learned Swedish medical terminology, EHR system tool signatures
  • Reinforcement fine-tuning (RFT): Model optimized reasoning about ambiguous diagnoses

Results after fine-tuning:

  • Accuracy: 72% → 94% (clinical validation by physicians)
  • ICD-10 coding: 65% → 96% (meets regulatory standards)
  • Tool calling accuracy: 72% → 98% (EHR API errors nearly eliminated)
  • Consistency: 99% (same note produces same output reliably)
  • Cost: $0.04 → $0.006 per note (-85%, using fine-tuned smaller model)
  • Latency: 8-12 seconds → 1.2 seconds (-90%, faster inference)
  • Throughput: 12,000 notes/day → 48,000 notes/day capacity (4x improvement)

Business impact: Deployed to production serving 3,200 clinicians. Saves 18 minutes per clinician per day (documentation time). Annual value: €14.2M in clinician time saved. Regulatory compliance: Passed health authority audit with 96% coding accuracy. Patient safety: Reduced medication errors by 34% (better structured data from notes).

Fine-Tuning in Microsoft Foundry: The Platform

Microsoft Foundry provides end-to-end infrastructure for fine-tuning models—from data preparation through deployment.

Foundry Fine-Tuning Capabilities

1. Synthetic Data Generation

Don't have enough training data? Foundry generates synthetic examples using frontier models. Provide 50-100 real examples, Foundry generates 10,000+ high-quality synthetic samples that preserve your data patterns and quality standards.

Use case: Customer service agent needs training data for 200 product-specific troubleshooting scenarios. Only have 10 examples per product. Synthetic generation creates 2,000+ examples covering edge cases.

2. Supervised Fine-Tuning (SFT)

Train models on input-output pairs: "Given this input, produce this output." Teaches models your specific format, terminology, and quality standards. Best for structured tasks: data extraction, classification, tool calling.

Training data format: JSONL files with prompt-completion pairs. Foundry handles distributed training, hyperparameter tuning, and validation.

3. Reinforcement Fine-Tuning (RFT)

New in Foundry: Agentic RFT teaches models to reason step-by-step while using tools. Model tries approaches, receives feedback on success/failure, learns optimal strategies. Superior for complex reasoning tasks where there are multiple valid paths to a solution.

Use case: Agent must diagnose technical issues by invoking diagnostic tools in optimal order. RFT learns which tool sequences work best for different problem types.

4. Model Selection: Azure OpenAI & OSS

Fine-tune Azure OpenAI models (GPT-4o, GPT-4o-mini, GPT-3.5-turbo) or open-source models (Llama 3, Mistral, Phi). Choose based on accuracy needs, latency requirements, and cost constraints.

Strategy: Start with frontier model fine-tuning for accuracy. Once proven, distill to smaller model for production cost/speed optimization.

5. Developer Training Tier

New cost optimization: Foundry offers discounted developer tier for experimentation. Run 10+ fine-tuning experiments at fraction of production cost. Validate approach before scaling.

Benefit: Iterate rapidly on training data quality, hyperparameters, and model selection without budget concerns.

6. Automated Deployment

Once fine-tuning completes, Foundry automatically deploys model to inference endpoint. No manual infrastructure setup. Models available via API immediately with autoscaling, monitoring, and cost tracking.

Production ready: Deployed models integrate seamlessly with Foundry agents, Azure AI services, and your applications.

When to Fine-Tune: The Decision Framework

Fine-tuning isn't always necessary. Use this framework to decide:

✓ Fine-Tune When...

  • ✓ Accuracy below 90% with prompt engineering
  • ✓ Tool calling errors exceed 5%
  • ✓ Domain-specific terminology not understood
  • ✓ Inconsistent outputs (same input → different results)
  • ✓ Latency too high (need faster inference)
  • ✓ Cost too high (processing millions of requests)
  • ✓ Complex multi-step workflows require reasoning
  • ✓ Have sufficient training data (1,000+ examples)

✗ Don't Fine-Tune When...

  • ✗ Prompt engineering achieves 95%+ accuracy
  • ✗ Task is general-purpose (no specialized domain)
  • ✗ Requirements change frequently (training data outdated quickly)
  • ✗ Low request volume (cost of fine-tuning exceeds savings)
  • ✗ Insufficient training data (<500 examples)
  • ✗ Retrieval-augmented generation (RAG) solves the problem
  • ✗ Task requires up-to-date world knowledge (RAG better)
  • ✗ Prototype phase (validate use case first)

The Fine-Tuning Decision Tree

  1. Try prompt engineering: Can you reach 95% accuracy with better prompts, few-shot examples, chain-of-thought?
  2. Try RAG: Is the problem knowledge retrieval (RAG) or behavior learning (fine-tuning)?
  3. Evaluate ROI: Cost of fine-tuning vs. savings from smaller/faster model + improved accuracy
  4. Assess data availability: Do you have 1,000+ high-quality training examples? If not, can synthetic generation help?
  5. Consider maintenance: How often must you retrain as requirements evolve?
  6. Start small: Fine-tune on subset, validate improvement, then scale

Practical Demonstrations: Fine-Tuning in Action

The BRK188 session showcased real-world fine-tuning scenarios with measurable results:

Demo 1: Customer Service Agent Tool Calling

Scenario: Customer service agent must handle product returns by invoking multiple tools: check order status, verify return eligibility, generate return label, process refund.

Generic GPT-4 Performance:

  • Tool calling accuracy: 78% (frequently missed required parameters)
  • Workflow completion rate: 61% (errors cascaded through multi-step process)
  • Average handling time: 14 seconds
  • Cost per interaction: $0.08

Fine-Tuned GPT-4o-mini Performance:

  • Tool calling accuracy: 97% (learned correct parameter formats)
  • Workflow completion rate: 94% (reliable multi-step execution)
  • Average handling time: 2.8 seconds (-80%)
  • Cost per interaction: $0.009 (-89%)

Training approach: 5,000 annotated customer service interactions with correct tool invocations. Supervised fine-tuning on GPT-4o-mini. Deployed to production serving 12,000 requests/day.

Demo 2: Data Extraction from Unstructured Documents

Scenario: Extract structured data from invoices, receipts, contracts—diverse formats, inconsistent layouts.

Generic Claude 3.5 Performance:

  • Field extraction accuracy: 83% (struggled with non-standard formats)
  • Missing field rate: 22% (failed to find data in unusual locations)
  • Hallucination rate: 8% (invented data when uncertain)
  • Processing time: 6.2 seconds per document

Fine-Tuned Phi-3 Medium Performance:

  • Field extraction accuracy: 96% (learned diverse document formats)
  • Missing field rate: 4% (better at finding data in unusual layouts)
  • Hallucination rate: 0.3% (learned to mark uncertain fields as null)
  • Processing time: 1.1 seconds per document (-82%)

Training approach: 20,000 documents (invoices, receipts, contracts) with expert-annotated structured outputs. Synthetic generation expanded to 80,000 examples covering edge cases. Fine-tuned Phi-3 Medium (open-source) for cost optimization.

Demo 3: Workflow Execution with Reinforcement Fine-Tuning

Scenario: IT troubleshooting agent must diagnose network issues by running diagnostic tools in optimal sequence.

Supervised Fine-Tuning Only:

  • Problem resolution rate: 74% (followed recipes, didn't adapt to findings)
  • Average diagnostic steps: 8.2 (inefficient tool usage)
  • Time to resolution: 4.3 minutes

Supervised + Reinforcement Fine-Tuning:

  • Problem resolution rate: 91% (learned to adapt strategy based on intermediate results)
  • Average diagnostic steps: 4.7 (optimized tool sequence)
  • Time to resolution: 1.8 minutes (-58%)

Training approach: Initial supervised fine-tuning on 3,000 troubleshooting sessions. Then reinforcement fine-tuning where model explored different diagnostic sequences, received feedback on which led to successful resolution. Model learned optimal decision trees for different problem categories.

🇸🇪 Technspire Perspective: Swedish Logistics Company's Route Optimization Agent

A Swedish logistics provider (2,100 employees, 650 trucks) deployed an AI agent to optimize delivery routes dynamically—adjusting for traffic, weather, vehicle capacity, customer time windows, and driver hours.

The complexity: Agent must invoke 12 different tools:

  • TrafficAPI (current conditions + predictions)
  • WeatherAPI (impacts delivery times)
  • VehicleCapacityTool (load optimization)
  • CustomerPreferencesTool (delivery time windows)
  • DriverScheduleTool (hours of service regulations)
  • FuelOptimizationTool (minimize fuel costs)
  • GeocodeAPI (address to coordinates)
  • DistanceCalculator (route distances)
  • TimeEstimator (delivery time predictions)
  • ReoptimizationTool (adjust routes mid-day for changes)
  • CustomerNotificationTool (send ETAs)
  • DispatchSystemTool (update driver instructions)

Generic GPT-4 results:

  • Tool calling accuracy: 81% per tool (compounded to 18% success rate for complete workflow)
  • Route quality: 64% optimal (compared to expert human dispatchers)
  • Execution time: 45 seconds per route optimization
  • Cost: $0.12 per optimization × 4,200 routes/day = $504/day = $184K/year

The fine-tuning strategy:

  • Phase 1 - Supervised fine-tuning: Trained on 10,000 historical routes (inputs: delivery requirements, tool outputs: actual tool invocations by expert dispatchers). Model learned correct tool signatures, parameter formats.
  • Phase 2 - Reinforcement fine-tuning: Model explored different tool invocation sequences, received feedback based on route quality (fuel efficiency, on-time delivery, driver satisfaction). Learned optimal decision strategies for different scenarios (urban vs rural, rush hour vs off-peak, weather impacts).
  • Phase 3 - Distillation: Once large model performed well, distilled knowledge to Llama-3 70B for cost/speed optimization.

Fine-tuned model results:

  • Tool calling accuracy: 98% per tool (94% complete workflow success)
  • Route quality: 89% optimal (exceeds human dispatchers on 3/5 metrics: fuel efficiency, on-time delivery, balanced driver workload)
  • Execution time: 6.8 seconds per optimization (-85%)
  • Cost: $0.015 per optimization (-88%) = $63/day = $23K/year

Business impact after 7 months: Fuel costs: -12% (€850K annual savings). On-time delivery: 82% → 91%. Customer complaints: -58%. Driver overtime: -34% (better route balancing). Annual value: €1.6M from efficiency gains + €850K fuel savings = €2.45M. Fine-tuning investment: €45K (training data annotation + compute) = 54× ROI.

Agentic Reinforcement Fine-Tuning (RFT): The Next Evolution

Reinforcement Fine-Tuning (RFT) is a breakthrough for building agents that reason optimally while using tools. Unlike supervised learning (learn from examples), reinforcement learning teaches models to explore strategies and optimize for success.

How Agentic RFT Works

  1. Initial policy: Start with supervised fine-tuned model (knows how to use tools, but not optimally)
  2. Exploration: Model tries different approaches to solve tasks—varying tool sequences, parameters, reasoning steps
  3. Feedback: Each attempt receives reward signal: +1 for successful task completion, partial credit for progress, -1 for failure
  4. Learning: Model adjusts policy to maximize expected reward—learns which strategies work best
  5. Optimization: Over thousands of iterations, model converges on optimal decision-making strategies

When RFT Outperforms Supervised Learning

  • Complex reasoning: Problems with multiple valid solution paths, requiring strategic thinking
  • Sequential decisions: Multi-step workflows where early choices impact later success
  • Tool combinations: Learning which tools work well together, optimal invocation order
  • Adaptive behavior: Adjusting strategy based on intermediate results (e.g., if diagnostic tool shows X, try Y next)
  • Constraint optimization: Balancing multiple objectives (speed vs accuracy, cost vs quality)

RFT Performance Gains: The Data

Tool Calling Tasks

  • Supervised only: 85% accuracy
  • Supervised + RFT: 94% accuracy
  • Improvement: +9 points

Workflow Execution

  • Supervised only: 74% success
  • Supervised + RFT: 91% success
  • Improvement: +17 points

Reasoning Tasks

  • Supervised only: 68% correct
  • Supervised + RFT: 87% correct
  • Improvement: +19 points

Customer Case Study: Document Management at Scale

The BRK188 session featured a customer case study demonstrating fine-tuning impact at massive scale:

The Challenge

Enterprise with 2M+ documents arriving daily (invoices, contracts, forms, emails). Need to:

  • Extract structured data (dates, amounts, parties, terms)
  • Classify document type (invoice, contract, PO, receipt)
  • Route to appropriate workflow (accounts payable, legal review, procurement)
  • Ensure 99%+ accuracy (financial/legal consequences of errors)
  • Process in real-time (documents must enter workflows within 60 seconds)

The Solution: Fine-Tuned Agent

  • Training data: 150,000 documents with expert annotations
  • Synthetic generation: Expanded to 800,000 examples covering edge cases
  • Model: Fine-tuned GPT-4o-mini for cost/speed, validated against GPT-4o for quality
  • Techniques: Supervised fine-tuning + reinforcement learning for routing decisions

Results

Before Fine-Tuning

  • • Model: Generic GPT-4
  • • Accuracy: 86%
  • • Processing time: 8.5 sec/document
  • • Throughput: 10K documents/hour
  • • Cost: $0.045 per document
  • • Daily cost: $90K (2M docs × $0.045)
  • Annual cost: $33M

After Fine-Tuning

  • • Model: Fine-tuned GPT-4o-mini
  • • Accuracy: 98.7%
  • • Processing time: 1.2 sec/document
  • • Throughput: 72K documents/hour
  • • Cost: $0.008 per document
  • • Daily cost: $16K (2M docs × $0.008)
  • Annual cost: $5.8M

Business impact: Annual savings: $27.2M ($33M - $5.8M). Throughput: 7.2× improvement enables real-time processing. Accuracy: +12.7 points reduces costly errors (invoice payment mistakes, contract misrouting). Error remediation: -84% (fewer documents require manual review).

🇸🇪 Technspire Perspective: Swedish Financial Services Firm's Contract Analysis Agent

A Swedish investment firm (850 employees, €42B assets under management) processes 3,500 contracts monthly (investment agreements, partnership deals, service contracts). Legal team (12 lawyers) spent 80% of time on routine contract review—extracting key terms, identifying risks, flagging non-standard clauses.

The manual process bottleneck:

  • Average review time: 2.5 hours per contract
  • Monthly capacity: 500 contracts (12 lawyers × 160 hours × 0.4 contracts/hour)
  • Backlog: 6-week delay for non-urgent contracts
  • Error rate: 4% (missed clauses, incorrect risk assessments)
  • Cost: €420K/month in legal team time

The fine-tuned agent solution:

  • Training data: 8,000 contracts reviewed by legal team (Swedish and English)
  • Synthetic generation: Expanded to 40,000 examples with variations
  • Supervised fine-tuning: GPT-4o on contract structure, term extraction, risk identification
  • Reinforcement fine-tuning: Model learned optimal clause importance weighting
  • Model selection: Started with GPT-4o, validated quality, distilled to GPT-4o-mini for production

Agent capabilities:

  • Extracts 47 standard contract terms (parties, dates, amounts, obligations)
  • Identifies 12 risk categories (termination rights, liability caps, indemnification)
  • Flags non-standard clauses for lawyer review
  • Generates executive summary (2-page distillation of 60-page contract)
  • Compares to firm's standard templates, highlights deviations

Results after 5 months:

  • Processing time: 2.5 hours → 8 minutes (agent) + 22 minutes (lawyer review) = 30 minutes total (-80%)
  • Monthly capacity: 500 → 3,200 contracts (6.4× improvement)
  • Backlog: Eliminated (can handle 3,500/month with capacity to spare)
  • Accuracy: 96% term extraction, 94% risk identification (validated by lawyers)
  • Error rate: 4% → 0.8% (agent + human review catches more issues)
  • Cost per contract: €120 (legal time) → €18 (agent + legal review) = -85%
  • Legal team reallocation: 80% routine review → 20% (shifted to complex negotiations, advisory, deal structuring)

Business impact: Deal velocity +42% (faster contract review enables quicker closings). Legal team satisfaction +significant (doing strategic work, not document drudgery). Contract risk detection +34% (agent finds clauses humans missed). Annual value: €3.8M in legal team productivity + faster deals enabling €12M additional investments closed. Fine-tuning investment: €85K = 45× ROI.

Implementation Roadmap: Fine-Tuning Your First Agent

Ready to fine-tune models in Microsoft Foundry? Here's how Technspire guides Swedish organizations:

1

Baseline Performance Assessment (1-2 weeks)

  • • Identify use case requiring fine-tuning (tool calling, data extraction, workflow execution)
  • • Measure baseline with best-effort prompt engineering (accuracy, latency, cost)
  • • Define success criteria (target accuracy, latency, cost reduction)
  • • Estimate ROI (cost of fine-tuning vs. expected savings/value)
  • • Validate data availability (need 1,000+ high-quality examples)
2

Training Data Preparation (3-4 weeks)

  • • Collect real examples (historical data with known-good outputs)
  • • Annotate data with expert labels (correct tool calls, extracted fields, classifications)
  • • Use synthetic data generation to expand dataset (10× multiplier)
  • • Split data: 80% training, 10% validation, 10% test
  • • Format as JSONL (input-output pairs)
  • • Quality assurance: review samples, ensure consistency
3

Model Selection and Training (2-3 weeks)

  • • Choose base model (GPT-4o for accuracy, GPT-4o-mini for cost, Llama-3 for control)
  • • Run fine-tuning in Foundry (developer tier for experimentation)
  • • Hyperparameter tuning (learning rate, epochs, batch size)
  • • Monitor training metrics (loss curves, validation accuracy)
  • • Test multiple model versions (compare accuracy vs. cost trade-offs)
  • • Select best performer for production
4

Validation and Testing (2-3 weeks)

  • • Test on held-out test set (measure accuracy, latency, cost)
  • • Compare to baseline (is fine-tuned model significantly better?)
  • • Edge case testing (adversarial inputs, unusual formats, error conditions)
  • • User acceptance testing (domain experts validate quality)
  • • Performance benchmarking (throughput, concurrency, scaling behavior)
  • • Document evaluation results and model limitations
5

Production Deployment (2-3 weeks)

  • • Deploy fine-tuned model to Foundry inference endpoint
  • • Canary rollout (5% → 25% → 100% of traffic)
  • • Monitor production metrics (accuracy, latency, error rates)
  • • Set up alerting for degradation (accuracy drops, latency spikes)
  • • Implement fallback to baseline model if issues detected
  • • Track business metrics (cost savings, throughput, user satisfaction)
6

Continuous Improvement (Ongoing)

  • • Collect production data (new examples with errors to learn from)
  • • Periodic retraining (monthly or quarterly with updated data)
  • • A/B testing (compare new model versions vs. current production)
  • • Explore reinforcement fine-tuning (if complex reasoning needed)
  • • Model distillation (once large model proven, distill to smaller for cost)
  • • Measure ROI continuously (track savings vs. training investment)

Why This Matters for Swedish Organizations

Sweden's organizations face unique drivers for fine-tuning adoption:

  • Language requirements: Swedish language AI needs fine-tuning on Swedish text. Generic models trained primarily on English underperform on Swedish documents, terminology, cultural context.
  • Regulatory compliance: GDPR, NIS2, AI Act—fine-tuned models can be deployed on-premises or in EU data centers with full data control. Generic API models send data to US clouds.
  • Industry specialization: Swedish strengths (manufacturing, healthcare, fintech, cleantech) require domain-specific agents. Fine-tuning teaches models Swedish industry terminology and workflows.
  • Cost efficiency: Smaller Swedish organizations can't afford $33M/year AI bills. Fine-tuning enables 80-90% cost reduction through smaller, faster models.
  • Competitive advantage: Agents that understand your specific business processes execute faster and more accurately than competitors using generic models.
  • Data sovereignty: Training data stays in Sweden. Fine-tuned models deployed in Swedish Azure regions. No data leaves EU.

Ready to Build Production-Ready Agents with Fine-Tuning?

Technspire helps Swedish organizations implement fine-tuning in Microsoft Foundry—from training data preparation to model deployment to production monitoring. Turn your AI prototypes into reliable, cost-effective agents that deliver measurable business value.

Schedule Your Fine-Tuning Strategy Assessment

Key Takeaways from BRK188

  • Fine-tuning transforms generic models into production-ready agents with 95%+ accuracy and 80-90% cost reduction
  • Microsoft Foundry provides end-to-end platform: synthetic data generation, supervised + reinforcement fine-tuning, automated deployment
  • Agentic Reinforcement Fine-Tuning (RFT) teaches models optimal tool usage and reasoning strategies (+9-19 point accuracy gains)
  • Use case validation critical: Fine-tune when accuracy <90%, tool calling errors >5%, or high cost/latency
  • Real-world results: Customer document management scaled to 2M docs/day, $27M annual savings, 98.7% accuracy
  • Developer training tier enables low-cost experimentation before production deployment
  • Open-source models supported: Llama, Mistral, Phi alongside Azure OpenAI for cost/control flexibility
  • Organizations report 40-90% cost reduction and 3-7× throughput improvement with fine-tuned agents

Fine-tuning isn't optional for production agents—it's the difference between a demo that impresses and a system that delivers value. Microsoft Foundry makes fine-tuning accessible: synthetic data generation solves the training data challenge, reinforcement fine-tuning enables optimal reasoning, and automated deployment gets models to production fast. For Swedish organizations building agents that must handle Swedish language, comply with EU regulations, and operate cost-effectively at scale, fine-tuning in Foundry is the path from prototype to production.

Ready to Transform Your Business?

Let's discuss how we can help you implement these solutions and achieve your goals with AI, cloud, and modern development practices.

No commitment required • Expert guidance • Tailored solutions