This content originally appeared on Level Up Coding – Medium and was authored by Akshay Kokane
Fine-Tune GPT Models Without Writing Code — A Step-by-Step Guide in Azure AI Foundry
A beginner-friendly walkthrough for non-technical users to create powerful, personalized AI solutions
You have a GPT-4.1 or 5 model that’s great at general answers — but when it writes for your business, it gets the tone wrong, misses key compliance terms, and forgets your style guide. You could hire a team of ML engineers… or, you could fine-tune it in under an hour with no code in Azure AI Foundry.
In this guide, you’ll learn:
- What fine-tuning is and why it matters for real-world use cases
- The three fine-tuning methods in Azure AI Foundry — and when to use each
- How I fine-tuned GPT-4.1 for financial advisory compliance without touching a line of code
- Step-by-step process to go from dataset to deployed custom model
1. What is Fine-Tuning (And Why It’s a Game-Changer)

Fine-tuning large language models is the process of adapting pre-trained models to perform better on specific tasks or domains. While general-purpose models like GPT or Claude are incredibly powerful, they may not always capture the nuanced requirements of specialized industries or unique business contexts.
The benefits of fine-tuning are substantial:
- Domain Expertise: Models can learn industry-specific terminology and concepts
- Improved Performance: Task-specific optimization leads to better accuracy and relevance
- Brand Consistency: Models can adopt your organization’s tone and communication style
- Compliance: Ensure outputs meet regulatory and policy requirements
- Cost Efficiency: Smaller, fine-tuned models can often outperform larger general models for specific tasks
2. Why Fine-Tuning in Azure AI Foundry Stands Out
Azure AI Foundry offers flexibility in how you train models: you can choose the serverless training mode, which abstracts away infrastructure management, or opt to manage your own infrastructure — such as VMs, GPUs, storage and other resources. The decision largely depends on your specific use case. For instance, if you are working with sensitive data and require full control over the environment — avoiding shared resources — you may prefer to bring your own infrastructure.
3. The Three Fine-Tuning Types You Can Use
Supervised Fine-Tuning (SFT)
This foundational technique trains models on input-output pairs, making it ideal for most fine-tuning scenarios. SFT excels at:
- Domain specialization and task performance optimization
- Style and tone adaptation
- Instruction following and language adaptation
Azure AI foundry uses Parameter Efficient Fine Tuning (PEFT) method for SFT. As per documentation, LoRA Technique is used for fine tuning the model.
In this fine-tuning type you need to have training data in form of system message, user message, and expected AI output.
{"messages":[
{"role":"system","content":"You are a financial documentation assistant for the investment advisory sector. Always respond in Markdown format with clearly labeled sections, using a formal and compliant tone."},
{"role":"user","content":"Draft a regulatory compliance statement for a new municipal bond fund launch."},
{"role":"assistant","content":"## Regulatory Compliance Statement\n\n### Product Overview\nThe ABC Municipal Bond Fund seeks to provide tax-exempt income through investments in U.S. municipal bonds issued for public infrastructure projects.\n\n### Applicable Regulations\n- SEC Regulation D\n- MSRB Rule G-17\n- IRS Tax Code Section 103 for municipal bond tax exemption.\n\n### Compliance Review Summary\nThe fund has undergone an internal compliance audit and independent legal review. All offering documents align with applicable securities regulations.\n\n### Risk Disclosures\n- Interest rate risk may impact bond prices.\n- Credit risk exists if municipal issuers face financial challenges.\n- Market liquidity risk may occur during periods of reduced trading activity.\n\n### Compliance Disclaimer\nThis statement is provided in accordance with U.S. securities laws and MSRB guidelines. Investors are advised to review the full prospectus before making investment decisions."}
]}
Direct Preference Optimization (DPO)
DPO trains models using comparative feedback without requiring a separate reward model. It’s perfect for:
- Improving response quality and safety
- Aligning with human preferences
- Optimizing subjective qualities like helpfulness and style
DPO is different that traditional RFT. Here the reward based fine-tuning is done. DPO is especially useful in scenarios where there’s no clear-cut correct answer, and subjective elements like tone, style, or specific content preferences are important. This approach also enables the model to learn from both positive examples (what’s considered correct or ideal) and negative examples (what’s less desired or incorrect).
Training data for this method looks something like,
{
"input": {
"messages": [{"role": "system", "content": ...}],
"tools": [...],
"parallel_tool_calls": true
},
"preferred_output": [{"role": "assistant", "content": ...}],
"non_preferred_output": [{"role": "assistant", "content": ...}]
}
Learn more about DPO here : https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/fine-tuning-direct-preference-optimization
Reinforcement Fine-Tuning (RFT)
Using reinforcement learning principles, RFT optimizes models based on reward signals. It’s best for:
- Complex optimization scenarios in objective domains
- Mathematics, chemistry, and physics applications
- Cases where clear right/wrong answers exist
The o4-mini reasoning model supports RFT based fine-tuning. This approach is more complex and need deeper knowledge about fine-tuning as compared to previous.
Learn more about RFT here: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/reinforcement-fine-tuning

GPT 5 models are still missing from this table, as they are recenly launched, but I believe they will have parity with GPT4.1 models for techqniues of fine-tuning.
For sample training data, refer this github repo — https://github.com/azure-ai-foundry/fine-tuning/tree/main
4. My Fine-Tuning Journey: GPT-4.1 for Financial Compliance
Azure AI Foundry simplifies fine-tuning into four clear steps:
- Define your use case: Choose between highly capable general-purpose models (GPT-4.1), cost-effective task-specific models (GPT-4.1-mini or nano), or complex reasoning models (o4-mini)
- Prepare your data: Start with 50–100 high-quality examples for initial testing, scaling to 500+ examples for production models
- Choose your technique: Begin with Supervised Fine-Tuning unless you have specific requirements for reasoning models or preference optimization
- Iterate and evaluate: Fine-tuning is iterative — start with a baseline, measure performance, and refine your approach based on results
The Use Case
For my project, I needed to fine-tune a model for support in financial sector. My requirements: model should always generate same report, with consistent report structure, tone, and sections. My training data have samples of all these 3 reports.

Once your fine-tuned model is ready, any time a user submits a request aligned with the trained requirements — such as “Generate a client meeting summary based on these meeting notes” — the model will consistently produce outputs in the same format and tone defined in the training data.
Pre-requsists:
- Azure Subscription
- Created Azure OpenAI or Azure AI Foundry resource
- Permission to fine-tunr and deploy model
The Process
Step 1: Define the Use Case Following Azure AI Foundry’s recommended approach, I identified that I needed a highly capable general-purpose model for investment advisory services. Given the complexity of financial analysis, regulatory compliance, and the need for nuanced investment recommendations, I chose GPT-4.1 as my base model for its superior reasoning capabilities and financial knowledge.
Step 2: Prepare the Data I started with 60 high-quality examples of investment advisory interactions for initial testing, following Azure’s recommendation of 50–100 examples. The dataset included 20 examples each for
- 20 Investment Recommendation Reports
- 20 Regulatory Compliance Statements
- 20 Client Meeting Summaries
I have my data prepated in JsonL format. I have used synthetic dataset.
Example training data:
{"messages":[
{"role":"system","content":"You are a financial documentation assistant for the investment advisory sector. Always respond in Markdown format with clearly labeled sections, using a formal and compliant tone."},
{"role":"user","content":"Draft a regulatory compliance statement for a new municipal bond fund launch."},
{"role":"assistant","content":"## Regulatory Compliance Statement\n\n### Product Overview\nThe ABC Municipal Bond Fund seeks to provide tax-exempt income through investments in U.S. municipal bonds issued for public infrastructure projects.\n\n### Applicable Regulations\n- SEC Regulation D\n- MSRB Rule G-17\n- IRS Tax Code Section 103 for municipal bond tax exemption.\n\n### Compliance Review Summary\nThe fund has undergone an internal compliance audit and independent legal review. All offering documents align with applicable securities regulations.\n\n### Risk Disclosures\n- Interest rate risk may impact bond prices.\n- Credit risk exists if municipal issuers face financial challenges.\n- Market liquidity risk may occur during periods of reduced trading activity.\n\n### Compliance Disclaimer\nThis statement is provided in accordance with U.S. securities laws and MSRB guidelines. Investors are advised to review the full prospectus before making investment decisions."}
]}
Step 3: Choose the Training Technique Azure AI Foundry offers three distinct training techniques, and I selected Supervised Fine-Tuning (SFT) because it was perfect for my investment advisory use case. SFT excels at domain specialization (financial markets), task performance (investment analysis), and instruction following (regulatory compliance). The technique trains the model on input-output pairs — in this case, market data inputs paired with appropriate investment advice outputs.




Step 4: Configuration Through the visual interface, I configured training parameters optimized for SFT, including:
- Learning rate and training epochs
- Validation split ratios
- Performance evaluation metrics
- Safety and compliance filters



Step 4: Deploy the fine-tuned model


Model training running for long? Check out this link for debugging the long running pipeline : https://learn.microsoft.com/en-us/answers/questions/2288674/openai-fine-tuning-has-been-running-for-more-than
Once you click on “Use This Model” and select the quota and deployment type, the model deployment will begin. Go to “Model + Endpoints” tab to see the progress.

6. Key Takeaways
- You don’t need to code to fine-tune an LLM in Azure AI Foundry.
- Choosing the right technique saves time and improves results.
- Structured datasets are the foundation of consistent outputs
- Garbage or low-quality training data don’t provide better result and reduce model output quality
7. What’s Next
Now you have the workflow to create your own domain-specialized LLM without touching a single line of code.
In my next post, I’ll show you how to evaluate and test fine-tuned models in Azure AI Foundry to make sure they’re safe, accurate, and production-ready.
What’s the first domain you’d fine-tune for? Drop it in the comments — I might feature it in a future demo.
Fine-Tune GPT Models Without Writing Code — A Step-by-Step Guide in Azure AI Foundry was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding – Medium and was authored by Akshay Kokane