Train a LoRA adapter in VS Code using the AI Toolkit and improve Phi Silica for your use case.
Use Low Rank Adaptation (LoRA) to fine-tune the Phi Silica model and improve accuracy for a specific task. You will generate a dataset, run a cloud fine-tuning job, and download the adapter for inference.
Create two JSONL files (one JSON object per line):
Each line must be a JSON object with a messages array. Every message needs:
role: user or assistantcontent: message text{"messages": [{"content": "Hello, how do I reset my password?", "role": "user"}, {"content": "To reset your password, go to settings and click 'Reset Password'.", "role": "assistant"}]}
{"messages": [{"content": "Can you help me find nearby restaurants?", "role": "user"}, {"content": "Sure! Here are restaurants near you...", "role": "assistant"}]}
{"messages": [{"content": "What is the weather today?", "role": "user"}, {"content": "Sunny with a high of 25°C.", "role": "assistant"}]}
In VS Code, open AI Toolkit → Model Tools → Fine-tuning, then select New Project.
Choose microsoft/phi-silica from the Model Catalog and click Next.
Pick a project folder and a project name. A new VS Code window will open for the project.
Choose LoRA from the Method list.
Under Data, select your train.json and test.json files.
Click Run with Cloud, select your Microsoft account, choose a subscription, then pick a resource group.
Default settings are a good baseline. If you need tuning, explore small sweeps:
| Parameter | Suggested Range | Why it matters |
|---|---|---|
| learning_rate | 1e-4 → 1e-2 | Too high = unstable, too low = slow learning |
| lora_dropout | 0 → 0.5 | Helps reduce overfitting |
| weight_decay | 1e-5 → 1e-1 | Regularizes training |
| train/test samples | More = better | Improves generalization and metrics stability |
If a parameter is missing in the UI, edit <project>/microsoft/phi-silica/lora/lora.yaml manually.
Keep it short (1–2 sentences). If you need structured output (JSON, tables), use a two-sentence prompt: the first sentence describes the response in plain language, the second enforces the format.