A response can return valid JSON and still cite a revoked policy. If the current evidence never reached the model, changing weights does not fix the failure. If the right passage arrived and the model still chose the wrong tool, reindexing does not help either. In Microsoft Foundry, separate what the application must look up for each answer from what behavior the model must learn.
That separation lets you update a policy without retraining and test a new model without weakening authorization. The reference design shows where each control applies and what to prove before swapping a release.
Knowledge and behavior
Read the Portuguese version too.
What are RAG and fine-tuning?
RAG, retrieval augmented generation, retrieves content and adds it to the inference context. Model weights do not need to change for a response to use a newer document. Fine-tuning adapts weights to a task through additional training: classification, style, tool selection, or consistent use of context.
When training with teacher examples, distillation is a fine-tuning technique, not a third independent alternative. Teacher-produced examples can supply the training signal for a student, usually a smaller model. The current Foundry overview includes “distillation through teacher-generated SFT data” under Managed Training [S1]. A teacher does not automatically transfer correctness, authorization, or continuously updated knowledge.
The RAG documentation describes the mechanism:
RAG addresses this by retrieving relevant content from your data and including it in the model input. [S2]
A missing passage, a stale passage, and an ignored passage point to different hypotheses. None proves, on its own, that you need to train.
The problem it solves
Consider a fully synthetic support assistant. The refund policy changes from DEMO-POLICY-v1 to DEMO-POLICY-v2, without changing the classification format. Promote the effective version to the retrieval source and verify that it reaches the answer without changing the model. If the assistant still confuses labels with the right evidence on representative cases, compare the current prompt with a candidate. Consider adapting weights only if the gap persists. Mutable context and specialized behavior may require RAG and fine-tuning.
This article decides whether retrieval or behavioral adaptation is needed. It is neither a model benchmark nor a search-ranking tutorial.

How it works — step by step
- Describe the failure and freeze the baseline. Record the case, expected policy version, passages delivered, answer, and search, prompt, and model configuration. Distinguish missing evidence, stale evidence, wrong labels, and wrong tools.
- Prove the evidence path. For private or frequently changing content, design retrieval with versioning, citations, and access control at query time. Test granted, denied, and revoked access, plus a new policy with a lagging index.
- Compare using reference evidence. Supply a correct, authorized passage in test cases, holding prompt, model, and parameters fixed. If results improve, investigate ingestion, query behavior, or context assembly. If the error persists, review the task contract and prompt before training.
- Isolate the candidate. Hold retrieval and rules fixed when comparing two ways of performing the task. Consider SFT for demonstrations, DPO for preferences, or RFT when you have a reliable grader; verify support for the selected combination [S1]. Use only reviewed and approved examples.
- Compare and promote. Run baseline and candidate on the same final test. Block critical failures, then compare quality by case type, p95 latency, and cost per correctly resolved request. If approved, start with a small share of traffic and a rehearsed rollback.
The decision and data contract
The rubric comes before training
The package lab assigns 40 points to grounding, 20 to format, 20 to tools, and 20 to abstention, for 100 total. This is a teaching rubric, not an official Foundry score. Grounding checks the expected answer and reference; format requires four keys and their types; tool selection checks the expected tool; abstention checks whether the response avoids asserting unsupported information.
Freeze the rubric before the experiment. In production, evaluate retrieval and generation separately: did the right passage reach context, and does it support the claim? An unauthorized result is a release blocker, not a deduction from the average. Include human review where the lab’s exact matching is insufficient.
Teacher data still requires review
Record the teacher, its configuration, the task, review procedure, and applicable license. A fluent false answer does not become a good label because a larger model produced it.
Group correlated examples before splitting the dataset. Near-identical questions in training and test can leak evaluation information. The local auditor detects duplicate questions after normalizing whitespace and case, as well as groups spanning splits. It does not implement semantic deduplication, personal-data classification, or legal approval.
Training, data and lifecycle: check the current combination
The checked documentation distinguishes Managed Training from Programmed Training, which is in preview and requires explicit access approval. A cookbook recipe does not establish service availability.
Current training types are Standard, Data zone, Global, and Developer. Data zone supports only the US zone in the checked overview. Standard trains in the resource region; Global can copy data and weights to another training region; Developer uses idle capacity, can be preempted, and offers no latency/SLA or data-residency guarantee [S1].
Training type is not deployment type. Serverless is a serving option; compatible adapter serving on Managed compute remains in preview. Developer deployment is evaluation-only, lasts 24 hours, and has no availability SLA. Do not apply that duration to Developer training. Check model, method, region, artifact, and serving option together.
The current SFT procedure uses separate training.jsonl and validation.jsonl files and keeps final test examples out of training [S3]. This article intentionally contains no job creation, upload, authentication, or real fine-tuning experiment.
Do not reuse the retired stored-completions path
The classic stored-completions and distillation tutorial is deprecated, limited to the Foundry classic portal [S5]. The official notice specifies retirement on October 15, 2026, after which the UI and API stop working [S4]. At the November 22, 2026 check, that date had passed. The Distill button and store=True capture in that workflow are not a current recommendation for new work.
Responses API and Agent Traces are alternatives for future workflows, not exports or migrations of old completions. Existing job file references still work according to the notice [S4].
Fine-tuned models have separate training and deployment retirement clocks [S6]. A model trainable today does not imply indefinite serving, automatic migration, or interchangeable adapters.
Record both dates and an owner. Recheck the combination before retraining or scheduling a deployment change.
Use case: a support assistant whose policy changes every quarter
In the illustrative scenario, v2 is effective and v1 has been revoked. The test asks what happens before you buy training:
| What reached inference | What to look for | Next test |
|---|---|---|
v1 even though v2 is indexed |
The issue could be a filter, cache, or context assembly, not necessarily ingestion. | Trace the version from the source to the supplied passages. Do not answer with v1. |
Authorized v2, wrong label |
Evidence is present, but the classification contract may be unclear. | Isolate the prompt; evaluate weights only if the error persists. |
| No authorized, effective passage | Absence of evidence is not evidence of absence. | Do not assert the rule or expose restricted content; offer human review. |
Authorized v2 and correct answer, over budget |
This is a cost hypothesis, not a grounding diagnosis. | Compare serving configurations or a smaller student under the same quality limits. |
Reference architecture: online RAG, offline adaptation
Ingestion — policy owner. Publish the version, effective dates, and permissions from an approved source. In the index, each passage references a document_id, passage_id, version, and permissions inherited from a trusted authority. Track ingestion and revocation lag. If you cannot establish that the policy is effective or access is current, block affected answers until you reconcile the source; reindexing alone does not prove the revision is in use.
Inference — application owner. In classic RAG with Azure AI Search, the application queries the search service and controls how results reach the LLM [S7]. The service identity calling search does not replace the caller’s document-level authorization. If the application manages security filters, it must authenticate the user, obtain principals and permissions from trusted sources, and apply the filter to every query [S8]. Enforce authorization and effective version before passing passages to the Foundry deployment. If the check fails, do not retry without the filter.
Treat retrieved text as untrusted evidence, not instructions or permission grants. The application validates the schema and allowed tools and binds citations to passage IDs that actually entered context. A valid reference does not establish that it supports the claim: evaluate that connection. Without enough evidence, do not assert the rule; if search fails, report it as unavailable instead of falling back on model memory. Any cache must respect the same access scope and be invalidated when the effective policy or authorization changes.
Offline adaptation — training data owner. Keep the approved dataset separate from both the index and the final test. Retrieved content and traces do not automatically become training data. Record the batch, rights, method, base model, and teacher when applicable; test the candidate separately. In RAG + fine-tuning, the candidate uses the baseline’s retrieval and authorization contract.
Evaluation and release — quality and operations. Maintain a manifest tying together the deployment and model version, prompt, retrieval configuration, index revision, test set, and rubric. Keep protected telemetry with identifiers, versions, access decisions, and latency; do not log sensitive text by default. Use granted, denied, revoked, and stale cases as promotion gates, without mistaking test coverage for a guarantee of no failures.
On regression, roll back to a tested release that remains compatible with current permissions and policies. Rolling back a deployment or prompt must not revive a revoked policy or old permissions. If no safe combination exists, suspend that class of answers and route to operations. This is a proposed design to validate in an authorized environment, not a deployment report.
Local study: seven decisions and three response sets
fixtures.json contains seven cases: mutable policy, stable classifier, student with reviewed teacher examples, mixed requirements, missing baseline, unreviewed examples, and missing rights. Unknown requirements and missing rights block the decision.
The small dataset has five rows, solely to test the local auditor. It is not a dataset meeting any model-specific minimum training requirements. No file is uploaded to Foundry.
Run the study and inspect the rubric:
python study.py
python -m unittest -v
from study import run
r = run()
for name, evaluation in r["comparisons"].items():
print(name, round(evaluation["mean_score_100"], 2), evaluation["critical_failures"])
baseline_fixture 66.67 2
retrieval_fixture 100.0 0
student_fixture 86.67 1
These values are derived from hand-authored responses. They show that the lab rejects stale answers despite valid formatting; they do not compare models or measure savings. Eight tests cover decisions, data auditing, the rubric, and repeatability.
This study is synthetic and local. Platform integrations are documented but unexecuted; no tenant calls or authorized external operations occurred.
Tested code and execution record
These are literal excerpts of the tested module, not standalone programs. The JSON comes from two deterministic local runs, without a teacher call, training job, serving, or retrieval.
def choose(case):
required = (
"data_rights", "private_or_mutable", "behavior_gap", "baseline_tested",
"reviewed_examples", "teacher_reviewed", "smaller_student",
)
if any(type(case.get(key)) is not bool for key in required):
return {"path": "blocked", "reason": "unknown_requirement"}
if not case["data_rights"]:
return {"path": "blocked", "reason": "data_rights_missing"}
grounding = case["private_or_mutable"]
if not case["baseline_tested"]:
return {"path": "RAG + prompt baseline" if grounding else "prompt baseline",
"reason": "measure_before_training"}
if not case["behavior_gap"]:
return {"path": "RAG" if grounding else "prompt baseline",
"reason": "grounding_not_weights" if grounding else "no_proven_gap"}
if not case["reviewed_examples"]:
return {"path": "RAG + collect examples" if grounding else "collect examples",
"reason": "training_data_gate"}
method = "fine-tuning:distillation" if (
case["smaller_student"] and case["teacher_reviewed"]
) else "fine-tuning:SFT"
return {"path": f"RAG + {method}" if grounding else method,
"reason": "grounding_and_behavior" if grounding else "stable_behavior"}
def score_response(case, response):
weights = {"grounding": 40, "format": 20, "tool": 20, "abstention": 20}
exact_keys = {"answer", "citation", "tool", "abstain"}
shape = (
isinstance(response, dict) and set(response) == exact_keys
and isinstance(response["answer"], str)
and (response["citation"] is None or isinstance(response["citation"], str))
and (response["tool"] is None or isinstance(response["tool"], str))
and type(response["abstain"]) is bool
)
marks = {key: False for key in weights}
if shape:
marks["format"] = True
marks["grounding"] = (
response["answer"] == case["answer"]
and response["citation"] == case["citation"]
)
marks["tool"] = response["tool"] == case["tool"]
marks["abstention"] = response["abstain"] == case["abstain"]
score = sum(weights[key] for key, mark in marks.items() if mark)
return {"score_100": score, "marks": marks,
"critical_pass": marks["grounding"] and marks["abstention"]}
{
"authorized_operations": 0,
"comparisons": {
"baseline_fixture": {
"cases": [
{
"critical_pass": false,
"id": "current",
"marks": {
"abstention": true,
"format": true,
"grounding": false,
"tool": true
},
"score_100": 60
},
{
"critical_pass": true,
"id": "classify",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
},
{
"critical_pass": false,
"id": "missing",
"marks": {
"abstention": false,
"format": true,
"grounding": false,
"tool": true
},
"score_100": 40
}
],
"critical_failures": 2,
"mean_score_100": 66.66666666666667,
"metric_origin": "hand-authored synthetic response fixtures, not model output"
},
"retrieval_fixture": {
"cases": [
{
"critical_pass": true,
"id": "current",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
},
{
"critical_pass": true,
"id": "classify",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
},
{
"critical_pass": true,
"id": "missing",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
}
],
"critical_failures": 0,
"mean_score_100": 100.0,
"metric_origin": "hand-authored synthetic response fixtures, not model output"
},
"student_fixture": {
"cases": [
{
"critical_pass": false,
"id": "current",
"marks": {
"abstention": true,
"format": true,
"grounding": false,
"tool": true
},
"score_100": 60
},
{
"critical_pass": true,
"id": "classify",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
},
{
"critical_pass": true,
"id": "missing",
"marks": {
"abstention": true,
"format": true,
"grounding": true,
"tool": true
},
"score_100": 100
}
],
"critical_failures": 1,
"mean_score_100": 86.66666666666667,
"metric_origin": "hand-authored synthetic response fixtures, not model output"
}
},
"dataset_audit": {
"issues": [],
"pass": true,
"rows": 5,
"scope": "local labels, rights flags and group separation only"
},
"decisions": [
{
"id": "mutable-policy",
"path": "RAG",
"reason": "grounding_not_weights"
},
{
"id": "stable-classifier",
"path": "fine-tuning:SFT",
"reason": "stable_behavior"
},
{
"id": "reviewed-student",
"path": "fine-tuning:distillation",
"reason": "stable_behavior"
},
{
"id": "mixed-grounding-style",
"path": "RAG + fine-tuning:distillation",
"reason": "grounding_and_behavior"
},
{
"id": "no-baseline",
"path": "prompt baseline",
"reason": "measure_before_training"
},
{
"id": "unreviewed-data",
"path": "collect examples",
"reason": "training_data_gate"
},
{
"id": "no-data-rights",
"path": "blocked",
"reason": "data_rights_missing"
}
],
"dry_run": true,
"integration_status": "not executed; no Foundry training/data upload/deployment",
"synthetic": true,
"teacher_inference_calls": 0,
"tenant_calls": 0,
"training_jobs": 0,
"weights": {
"abstention": 20,
"format": 20,
"grounding": 40,
"tool": 20
}
}
Production practices
- Foundation: tie passages to verifiable versions and permissions. It is in place when a revoked case sends no passage to the model and cannot answer from the cache.
- Production with context: compare baseline and candidate with access, effective version, and abstention as critical criteria. It is in place when a regression stops the canary and rollback preserves the current policy.
- Scale and efficiency: compare ingestion, human review, training, retrieval, and serving; record coverage and unevaluated cases. It is in place when cost and latency improve on the measured workload without breaking the quality contract.
Frequently asked questions (FAQ)
Does distillation replace RAG?
No. Teacher examples can teach a student behavior. They do not keep private or changing policies up to date.
Does fine-tuning fix a poor index?
No. Improving context use cannot supply a passage that the application never retrieved. Test retrieval before changing weights.
Can I start with a few local examples?
Yes, to test the rubric and auditor. Five synthetic rows do not establish training eligibility; requirements vary by model.
Is Developer suitable for production?
Not as a production commitment. Developer training lacks residency and SLA guarantees; a Developer deployment is evaluation-only and lasts 24 hours.
Can a classic tutorial recover old stored completions?
No. The retirement notice offers no direct export or migration path. For new collection, choose a supported path with rights and review defined upfront.
Conclusion
Update the source when the rule changes. Adapt behavior only if the baseline still fails with correct, authorized evidence. The two paths can work together, but they share one production criterion: a release advances only if it gives useful answers without sacrificing authorization, current policy, or abstention.
Official references
- S1 — Fine-tuning in Microsoft Foundry.
- S2 — Retrieval augmented generation.
- S3 — Supervised fine-tuning.
- S4 — Stored completions retirement.
- S5 — Stored completions and distillation, deprecated/classic.
- S6 — Models lifecycle and support policy.
- S7 — Classic RAG with Azure AI Search.
- S8 — Security filters in Azure AI Search.
Primary sources rechecked on November 22, 2026. Recheck status, regions, and supported combinations before authorized work.
👉 If you are choosing between retrieving context and adapting a model, especially when rules change, start with the failure cause. Want to discuss the decision rubric? Reach out on LinkedIn.
