Amazon Bedrock · CreateModelCustomizationJob, DISTILLATION, teacherModelConfig, Provisioned Throughput · 2026-11-27 · Bedrock Model Distillation arc
Amazon Bedrock Model Distillation for MCP Servers: Training Data, Job Configuration, and Production Deployment
Four Bedrock Model Distillation arc pages synthesised into a complete production playbook for MCP server developers — covering the distillation API overview (CreateModelCustomizationJobCommand with customizationType: "DISTILLATION", required teacherModelConfig block, student base model selection with ListFoundationModels, IAM trust policy and permission policy, full async lifecycle), training data preparation (prompt-only JSONL where Bedrock calls the teacher automatically, UTF-8 without BOM constraint, 32k char per-prompt limit that silently drops exceeded lines, minimum 1,000 prompts, pre-generating teacher completions with ConverseCommand at temperature 0, extracting prompts from CloudWatch Logs, JSONL line-by-line validator), customization job parameters (all hyperparameter values are strings not numbers, epochCount/batchSize/learningRateMultiplier ranges, earlyStoppingThreshold and earlyStoppingPatience as a mandatory pair, cost estimation formula, job status lifecycle and failure reasons), and Provisioned Throughput deployment (CreateProvisionedThroughputCommand, polling GetProvisionedModelThroughput until InService, using the provisioned model ARN not the custom model ARN in ConverseCommand.modelId, gradual teacher/student traffic split, model units sizing, commitment renewal tracking). Twelve consolidated production gotchas at the end.
Why distillation matters for high-volume MCP tool handlers
Many MCP servers include tool handlers that run narrow, repetitive tasks at scale — classifying a support ticket, extracting a date range from a user query, normalising an address, detecting the intent behind a tool call. These tasks do not require the full reasoning capability of a large foundation model, but running Claude 3 Sonnet on every one of them at thousands of calls per day adds up quickly both in cost and in latency.
Amazon Bedrock Model Distillation solves this directly. You collect the prompts that represent your production workload, tell Bedrock which large model (the "teacher") should generate golden answers for each prompt, and train a small model (the "student") on those teacher outputs. The student learns to replicate the teacher's behaviour on exactly your workload — without you needing to annotate a single example by hand.
The result is a custom student model that you serve through Provisioned Throughput. For classification and extraction tasks, typical distillation outcomes are 3–10× lower latency and 70–90% lower cost per inference call compared to the teacher, with minimal quality loss on the production distribution the student was trained on.
Distillation is a four-phase workflow: prepare training data → start a customisation job → wait for completion → provision and deploy. Each phase has its own traps. This guide walks through all four.
Part 1 — The distillation API overview
Distillation uses the Bedrock control-plane client, not the runtime client. These are separate packages that are easy to confuse because their names look similar:
# Control-plane — job management, model lifecycle, provisioned throughput
npm install @aws-sdk/client-bedrock
# Runtime — inference only (ConverseCommand, InvokeModel)
npm install @aws-sdk/client-bedrock-runtime
Import CreateModelCustomizationJobCommand from @aws-sdk/client-bedrock. The runtime package does not export it and will silently return undefined if you try — no TypeScript error, just a missing command at runtime.
import {
BedrockClient,
CreateModelCustomizationJobCommand,
GetModelCustomizationJobCommand,
ListFoundationModelsCommand,
} from "@aws-sdk/client-bedrock";
// Control-plane client — reuse across the job lifecycle
const bedrockClient = new BedrockClient({
region: process.env.AWS_REGION ?? "us-east-1",
});
The minimum viable distillation job call requires eight fields. The most commonly missed is teacherModelConfig — Bedrock rejects the call with ValidationException: teacherModelConfig is required for DISTILLATION without it:
const response = await bedrockClient.send(
new CreateModelCustomizationJobCommand({
// Required for distillation — not FINE_TUNING or CONTINUED_PRE_TRAINING
customizationType: "DISTILLATION",
jobName: "mcp-classifier-distill-2026-11",
customModelName: "mcp-classifier-lite-v1",
// Student base — must be a supported distillation base (see ListFoundationModels below)
baseModelIdentifier: "amazon.titan-text-lite-v1:0:4k",
// Teacher — the large model that generates golden completions from your prompts
teacherModelConfig: {
teacherModelIdentifier:
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0",
// Max tokens the teacher outputs per training prompt — set too low and completions are truncated
maxResponseLengthForInference: 256,
},
// Training data: S3 URI of a JSONL file of {"prompt": "..."} lines
trainingDataConfig: {
s3Uri: "s3://my-bucket/distill-training/prompts.jsonl",
},
outputDataConfig: {
s3Uri: "s3://my-bucket/distill-output/mcp-classifier/",
},
roleArn: "arn:aws:iam::123456789012:role/BedrockCustomizationRole",
})
);
const jobArn = response.jobArn!;
console.log("Distillation job started:", jobArn);
The teacher and student do not need to be from the same provider. Using Claude 3 Sonnet as teacher and Amazon Titan Text Lite as student is a common pattern. To get the authoritative list of student base models supported for distillation in your region, use ListFoundationModels with the byCustomizationType filter:
const models = await bedrockClient.send(new ListFoundationModelsCommand({
byCustomizationType: "DISTILLATION",
}));
for (const m of models.modelSummaries ?? []) {
console.log(m.modelId, m.modelName);
}
// amazon.titan-text-lite-v1:0:4k Amazon Titan Text Lite
// amazon.titan-text-express-v1:0:8k Amazon Titan Text Express
// meta.llama3-8b-instruct-v1:0 Meta Llama 3 8B (if granted in your region)
The IAM role you pass to roleArn needs three things: a trust policy that lets bedrock.amazonaws.com assume it, bedrock:InvokeModel on the teacher model ARN, and s3:GetObject/s3:PutObject on the training and output S3 paths. Without bedrock:InvokeModel on the teacher, the job starts successfully but then fails during training with AccessDeniedException calling teacher model.
The job runs asynchronously and takes 2–8 hours for typical dataset sizes. Poll with GetModelCustomizationJobCommand every 60 seconds:
async function waitForDistillationJob(jobArn: string): Promise<string> {
while (true) {
const job = await bedrockClient.send(
new GetModelCustomizationJobCommand({ jobIdentifier: jobArn })
);
switch (job.status) {
case "Completed":
return job.outputModelArn!; // the custom model ARN, not yet invocable
case "Failed":
throw new Error(`Job failed: ${job.failureMessage}`);
case "Stopped":
throw new Error("Job was stopped externally.");
default:
// Starting | InProgress | Stopping — keep polling
await new Promise((r) => setTimeout(r, 60_000));
}
}
}
The outputModelArn returned when the job completes is the custom model ARN. It is not yet invocable — you must provision it through Provisioned Throughput before any inference call will succeed. See Part 4 for deployment details.
Part 2 — Training data preparation
The training file is a JSONL where each line is a JSON object with a prompt field. Completions are optional — if you omit them, Bedrock calls the teacher model for each prompt during the job to generate golden answers:
// prompts.jsonl — prompt-only lines (teacher generates completions during the job)
{"prompt": "Classify this support ticket: I cannot log into my account after the password reset."}
{"prompt": "Classify this support ticket: My invoice shows charges I did not authorize."}
{"prompt": "Classify this support ticket: The API returns 503 errors on the embeddings endpoint."}
{"prompt": "Classify this support ticket: How do I add a team member to my organization?"}
When you want deterministic training targets — a fixed label set for a classifier, or curated outputs for sensitive domains — pre-generate completions yourself and include the completion field. Bedrock uses your provided completion directly and skips the teacher call for that line:
// mixed.jsonl — prompt+completion for deterministic labels; prompt-only for open-ended
{"prompt": "Classify: cannot log in", "completion": "account"}
{"prompt": "Classify: unauthorized invoice charge", "completion": "billing"}
{"prompt": "Classify: API returns 503"}
{"prompt": "Classify: request a refund", "completion": "billing"}
Four data constraints catch MCP server builders off-guard:
- UTF-8 without BOM — a UTF-8 BOM (EF BB BF) on the first byte of the file makes the first JSON object unparseable and fails the entire job before training begins. Many Windows text editors add a BOM silently. Strip it with
iconv -f UTF-8-BOM -t UTF-8or by writing the file from Node.js (which never adds a BOM tocreateWriteStreamin'utf8'mode). - 32,000 character prompt limit — prompts exceeding 32k characters are silently dropped from training. The job succeeds, but those examples are listed in the job's output statistics as skipped. For long-document tasks, truncate or chunk prompts before writing them to the JSONL.
- Minimum 1,000 prompts — submitting fewer than 1,000 valid examples returns
ValidationExceptionbefore the job starts. The floor is 1,000, but the target for a good classifier should be 5,000–10,000. - No blank lines — an empty line anywhere in the file causes a parse error at that position and aborts the job. Blank lines may appear when writing files line-by-line and forgetting to filter empty strings from your input list.
The highest-quality prompts come from real production traffic. If your MCP server logs tool input to CloudWatch Logs, extract those entries directly:
import {
CloudWatchLogsClient,
FilterLogEventsCommand,
} from "@aws-sdk/client-cloudwatch-logs";
import { createWriteStream } from "fs";
const logsClient = new CloudWatchLogsClient({ region: "us-east-1" });
async function extractPromptsFromLogs(params: {
logGroupName: string;
toolName: string;
startTime: number;
endTime: number;
outputPath: string;
}): Promise<number> {
const writer = createWriteStream(params.outputPath, { encoding: "utf8" });
let count = 0;
let nextToken: string | undefined;
do {
const response = await logsClient.send(
new FilterLogEventsCommand({
logGroupName: params.logGroupName,
filterPattern: `{ $.tool = "${params.toolName}" }`,
startTime: params.startTime,
endTime: params.endTime,
nextToken,
})
);
for (const event of response.events ?? []) {
try {
const parsed = JSON.parse(event.message ?? "");
const prompt = parsed.input?.text ?? parsed.input?.ticket ?? parsed.input?.query;
if (typeof prompt === "string" && prompt.length > 10 && prompt.length < 32000) {
writer.write(JSON.stringify({ prompt }) + "\n");
count++;
}
} catch { /* skip malformed entries */ }
}
nextToken = response.nextToken;
} while (nextToken);
await new Promise<void>((r) => writer.end(r));
return count;
}
When pre-generating teacher completions to get deterministic labels, call ConverseCommand with temperature: 0 for consistent output and batch calls to control throughput:
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
const runtimeClient = new BedrockRuntimeClient({ region: "us-east-1" });
const TEACHER_MODEL_ID = "anthropic.claude-3-sonnet-20240229-v1:0";
const SYSTEM_PROMPT = `You are a support ticket classifier.
Respond with exactly ONE word from this list: billing, technical, account, general.
No explanation, no punctuation — just the category word.`;
async function generateTeacherCompletion(prompt: string): Promise<string> {
const response = await runtimeClient.send(
new ConverseCommand({
modelId: TEACHER_MODEL_ID,
system: [{ text: SYSTEM_PROMPT }],
messages: [{ role: "user", content: [{ text: prompt }] }],
inferenceConfig: { maxTokens: 10, temperature: 0 },
})
);
return (
response.output?.message?.content
?.filter((b) => b.text)
.map((b) => b.text)
.join("")
.trim() ?? ""
);
}
// Batch with bounded concurrency to stay within rate limits
async function buildDistillationDataset(prompts: string[], outputPath: string) {
const writer = createWriteStream(outputPath, { encoding: "utf8" });
const CONCURRENCY = 10;
for (let i = 0; i < prompts.length; i += CONCURRENCY) {
const batch = prompts.slice(i, i + CONCURRENCY);
const completions = await Promise.all(batch.map(generateTeacherCompletion));
for (let j = 0; j < batch.length; j++) {
if (completions[j]) {
writer.write(JSON.stringify({ prompt: batch[j], completion: completions[j] }) + "\n");
}
}
if ((i / CONCURRENCY) % 10 === 0) console.log(`${i + batch.length}/${prompts.length}`);
}
await new Promise<void>((r) => writer.end(r));
}
Always validate the JSONL locally before uploading to S3. A line-by-line validator catches blank lines, BOM issues, non-string prompt fields, and length violations before the job runs:
async function validateDistillationDataset(filePath: string) {
const { createInterface } = await import("readline");
const { createReadStream } = await import("fs");
const rl = createInterface({ input: createReadStream(filePath), crlfDelay: Infinity });
let valid = 0, invalid = 0, tooLong = 0, lineNum = 0;
for await (const line of rl) {
lineNum++;
if (line.trim() === "") { invalid++; continue; }
let obj: unknown;
try { obj = JSON.parse(line); }
catch { invalid++; continue; }
const record = obj as { prompt?: unknown; completion?: unknown };
if (typeof record.prompt !== "string") { invalid++; continue; }
if (record.prompt.length > 32000) { tooLong++; continue; }
valid++;
}
if (valid < 1000) throw new Error(`Only ${valid} valid lines — need at least 1000`);
console.log(`Valid: ${valid} Invalid: ${invalid} Too long (dropped): ${tooLong}`);
}
Upload to S3 in the same region as your distillation job — cross-region S3 access returns an AccessDeniedException that looks like an IAM problem but is actually a region mismatch.
Part 3 — Customization job parameters
The hyperParameters map has one universal rule that overrides everything else: all values are strings, even when they represent numbers. Sending an integer like epochCount: 2 (not in quotes) returns ValidationException: hyperParameters values must be strings. TypeScript type definitions may show Record<string, string> but the error message in production is the first time many developers notice the constraint.
// All hyperParameter values MUST be strings
const hyperParameters: Record<string, string> = {
// Full passes over training data: "1"–"10", default "2"
epochCount: "2",
// Examples per gradient update: "1"–"8", default "1"
batchSize: "1",
// Multiplier on the base model's default LR: "0.1"–"10.0", default "1.0"
// "1.0" means "use the default" — not "use rate 1.0"
learningRateMultiplier: "1.0",
// Early stopping — MUST set both or neither:
earlyStoppingThreshold: "0.001", // min loss improvement to count as progress
earlyStoppingPatience: "2", // epochs with no improvement before stopping
};
Setting only earlyStoppingThreshold without earlyStoppingPatience returns ValidationException: earlyStoppingThreshold and earlyStoppingPatience must both be set or both omitted. The error is accurate — treat them as an indivisible pair. When you are not using validation data (the typical case for a first run), omit both and let the job run for the full epochCount.
The maxResponseLengthForInference field lives inside teacherModelConfig, not in hyperParameters. It caps how many tokens the teacher generates per training prompt. Setting it too low truncates the teacher's completions before the student sees full training targets, which degrades quality silently — the job succeeds but the student model learns from incomplete golden outputs. Set it based on your task type:
// maxResponseLengthForInference guidance by task type
const RESPONSE_LENGTH = {
classification: 50, // single word or short phrase
extraction: 512, // structured JSON output
summarisation: 1024, // paragraph-length summaries
openEnded: 2048, // multi-sentence responses
};
A full job call with every configurable field:
const response = await bedrockClient.send(
new CreateModelCustomizationJobCommand({
jobName: "mcp-classifier-distill-2026-11-27",
customModelName: "mcp-classifier-lite-v1",
customizationType: "DISTILLATION",
baseModelIdentifier: "amazon.titan-text-lite-v1:0:4k",
teacherModelConfig: {
teacherModelIdentifier:
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0",
maxResponseLengthForInference: 256,
},
roleArn: "arn:aws:iam::123456789012:role/BedrockCustomizationRole",
trainingDataConfig: { s3Uri: "s3://my-bucket/training/prompts.jsonl" },
outputDataConfig: { s3Uri: "s3://my-bucket/output/mcp-classifier-v1/" },
hyperParameters: {
epochCount: "2",
batchSize: "1",
learningRateMultiplier: "1.0",
earlyStoppingThreshold: "0.001",
earlyStoppingPatience: "2",
},
// Optional: validation set for per-epoch loss metrics
// validationDataConfig: {
// validators: [{ s3Uri: "s3://my-bucket/validation/val-prompts.jsonl" }],
// },
jobTags: [{ key: "Project", value: "MCPClassifier" }],
})
);
When a job fails, failureMessage from GetModelCustomizationJobCommand tells you why. The most common causes and their root issues:
const FAILURE_REASONS = {
"Failed to read training data":
"S3 URI wrong, or IAM role lacks s3:GetObject on the training path",
"Invalid JSONL format at line N":
"Malformed JSON, blank line, or UTF-8 BOM in the training file",
"Insufficient training examples":
"Fewer than 1,000 valid prompts in the training file",
"AccessDeniedException calling teacher model":
"IAM role lacks bedrock:InvokeModel on the teacher model ARN",
"Invalid hyperParameter value":
"A hyperParameter value is out of range, or was sent as a number not a string",
"teacherModelConfig is required for DISTILLATION":
"customizationType is DISTILLATION but teacherModelConfig was omitted",
"baseModelIdentifier is not supported for DISTILLATION":
"Chosen student base model does not support distillation customisation",
};
Estimate cost before starting. Teacher invocations dominate for open-ended tasks; compute cost dominates for classification where teacher outputs are single words:
function estimateDistillationCost(params: {
promptCount: number;
avgPromptTokens: number;
avgTeacherOutputTokens: number;
teacherInputPricePerKToken: number; // e.g. Claude 3 Sonnet: $0.003
teacherOutputPricePerKToken: number; // e.g. Claude 3 Sonnet: $0.015
trainingComputeHours: number;
computePricePerHour: number;
}) {
const teacherIn = (params.promptCount * params.avgPromptTokens / 1000) * params.teacherInputPricePerKToken;
const teacherOut = (params.promptCount * params.avgTeacherOutputTokens / 1000) * params.teacherOutputPricePerKToken;
const compute = params.trainingComputeHours * params.computePricePerHour;
return { teacherIn: teacherIn.toFixed(2), teacherOut: teacherOut.toFixed(2), compute: compute.toFixed(2),
total: (teacherIn + teacherOut + compute).toFixed(2) };
}
// 10,000 prompts, 100 tokens avg each, 200 token teacher output, 2 compute hours
const est = estimateDistillationCost({
promptCount: 10_000, avgPromptTokens: 100, avgTeacherOutputTokens: 200,
teacherInputPricePerKToken: 0.003, teacherOutputPricePerKToken: 0.015,
trainingComputeHours: 2, computePricePerHour: 2.0,
});
// { teacherIn: "3.00", teacherOut: "30.00", compute: "4.00", total: "37.00" }
If you pre-generate teacher completions yourself and include the completion field in every JSONL line, Bedrock skips all teacher calls during the job. That eliminates the teacher cost component entirely and makes the total cost predictable before submission.
Part 4 — Provisioned Throughput deployment
The outputModelArn from a completed distillation job is a custom model ARN, not a foundation model ARN. Calling ConverseCommand with it directly returns AccessDeniedException: Custom models require Provisioned Throughput. You must create a Provisioned Throughput resource first:
import {
CreateProvisionedThroughputCommand,
GetProvisionedModelThroughputCommand,
} from "@aws-sdk/client-bedrock";
async function createProvisionedThroughput(params: {
customModelArn: string;
provisionedModelName: string;
modelUnits?: number;
}): Promise<string> {
const response = await bedrockClient.send(
new CreateProvisionedThroughputCommand({
modelId: params.customModelArn,
provisionedModelName: params.provisionedModelName,
modelUnits: params.modelUnits ?? 1,
commitmentDuration: "OneMonth", // "OneMonth" or "SixMonths"
})
);
return response.provisionedModelArn!;
}
// Poll until the PT resource is InService (10–30 minutes)
async function waitForProvisionedThroughput(provisionedModelArn: string): Promise<void> {
while (true) {
const pt = await bedrockClient.send(
new GetProvisionedModelThroughputCommand({ provisionedModelId: provisionedModelArn })
);
console.log(`PT status: ${pt.status}`);
if (pt.status === "InService") break;
if (pt.status === "Failed") throw new Error(`PT failed: ${pt.failureMessage}`);
await new Promise((r) => setTimeout(r, 30_000));
}
}
// Full deployment sequence
const customModelArn = await waitForDistillationJob(jobArn);
const provisionedModelArn = await createProvisionedThroughput({
customModelArn,
provisionedModelName: "mcp-classifier-lite-pt-v1",
modelUnits: 1,
});
await waitForProvisionedThroughput(provisionedModelArn);
console.log("Ready:", provisionedModelArn);
Store the provisionedModelArn in an environment variable or SSM Parameter Store. Use it in ConverseCommand.modelId — not the custom model ARN, not the foundation model ID, the provisioned model ARN. The ARN format is arn:aws:bedrock:REGION:ACCOUNT_ID:provisioned-model/RESOURCE_ID — it includes your account ID, unlike foundation model ARNs.
Use a gradual traffic split rather than switching all traffic at once. This validates student model quality in production while keeping the teacher as a fallback:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
const runtimeClient = new BedrockRuntimeClient({ region: "us-east-1" });
const TEACHER_MODEL_ID = "anthropic.claude-3-sonnet-20240229-v1:0";
const STUDENT_MODEL_ARN = process.env.DISTILLED_MODEL_ARN ?? "";
// 0 = all teacher, 100 = all student — increase over time as you gain confidence
const STUDENT_TRAFFIC_PERCENT = Number(process.env.STUDENT_TRAFFIC_PERCENT ?? "0");
function selectModel(): { modelId: string; isStudent: boolean } {
if (!STUDENT_MODEL_ARN || STUDENT_TRAFFIC_PERCENT === 0) {
return { modelId: TEACHER_MODEL_ID, isStudent: false };
}
const useStudent = Math.random() * 100 < STUDENT_TRAFFIC_PERCENT;
return { modelId: useStudent ? STUDENT_MODEL_ARN : TEACHER_MODEL_ID, isStudent: useStudent };
}
const server = new McpServer({ name: "support-server", version: "1.0.0" });
server.tool(
"classify_support_ticket",
{ ticket: z.string().describe("Support ticket text to classify") },
async ({ ticket }) => {
const { modelId, isStudent } = selectModel();
const start = Date.now();
const response = await runtimeClient.send(
new ConverseCommand({
modelId,
messages: [
{
role: "user",
content: [
{
text: `Classify this support ticket into one of: billing, technical, account, general.\n\nTicket: ${ticket}\n\nCategory:`,
},
],
},
],
inferenceConfig: { maxTokens: 20, temperature: 0, stopSequences: ["\n"] },
})
);
const category =
response.output?.message?.content
?.filter((b) => b.text)
.map((b) => b.text)
.join("")
.trim() ?? "general";
// Log for quality monitoring — compare student vs teacher labels offline
console.log(JSON.stringify({
model: isStudent ? "student" : "teacher",
latencyMs: Date.now() - start,
result: category,
ticket: ticket.slice(0, 100),
}));
return { content: [{ type: "text", text: category }] };
}
);
Recommended rollout schedule: 5% student for 24 hours → compare labels between teacher and student on the same tickets → increase to 25% if agreement rate is above 95% → 100% if 25% shows no degradation over 48 hours. If the student diverges from the teacher on more than 5% of production tickets, roll back by setting STUDENT_TRAFFIC_PERCENT=0.
Add a startup check so your MCP server falls back to the teacher model gracefully when the PT resource is not yet available:
import {
BedrockClient,
GetProvisionedModelThroughputCommand,
} from "@aws-sdk/client-bedrock";
async function checkDistilledModelReady(): Promise<boolean> {
const ptArn = process.env.DISTILLED_MODEL_ARN;
if (!ptArn) {
console.warn("DISTILLED_MODEL_ARN not set — using teacher for all calls");
return false;
}
try {
const pt = await bedrockClient.send(
new GetProvisionedModelThroughputCommand({ provisionedModelId: ptArn })
);
if (pt.status === "InService") return true;
console.warn(`Distilled model ${pt.status} — falling back to teacher`);
return false;
} catch (err) {
console.error("Could not check distilled model status:", err);
return false;
}
}
// At server startup — fast single describe call, no inference cost
const distilledModelReady = await checkDistilledModelReady();
PT commitments renew automatically at the end of each period. Bedrock sends no renewal reminders. Mark the commitmentExpirationTime from GetProvisionedModelThroughputCommand in your team calendar. If the model's quality fell below expectations, delete the PT resource with DeleteProvisionedModelThroughputCommand before the renewal date to avoid another month of charges — after traffic has been shifted back to the teacher model.
Twelve consolidated production gotchas
- Wrong SDK package —
CreateModelCustomizationJobCommandis in@aws-sdk/client-bedrock(control-plane), not@aws-sdk/client-bedrock-runtime(inference). Importing from the wrong package givesundefinedat runtime with no TypeScript error. teacherModelConfigis required for DISTILLATION — omitting it causesValidationException: teacherModelConfig is required for DISTILLATION. Sending the same call withcustomizationType: "FINE_TUNING"would succeed (fine-tuning does not need a teacher), which is why the error is confusing the first time.- UTF-8 BOM kills the whole job — a BOM (EF BB BF) on the first byte of the JSONL makes the first line unparseable and fails the entire job before training starts. The error message references "Invalid JSONL format at line 1", which points directly at the BOM but only if you know what a BOM is. Write training files from Node.js using
createWriteStream(path, {encoding: "utf8"})to avoid adding one. - 32k char limit silently drops prompts — prompts exceeding 32,000 characters are dropped without failing the job. The job output statistics show how many lines were skipped. Validate prompt lengths before upload.
- Minimum 1,000 prompts enforced before job starts — fewer than 1,000 valid examples returns
ValidationExceptionbefore any compute is billed. The floor is 1,000; production-quality distillation needs 5,000–50,000 depending on task complexity. - All hyperparameter values are strings —
{epochCount: 2}(integer) returnsValidationException: hyperParameters values must be strings. Use{epochCount: "2"}. This applies to every hyperparameter key. earlyStoppingThresholdandearlyStoppingPatiencemust both be set or both omitted — setting one without the other returnsValidationException. Treat them as an indivisible pair.maxResponseLengthForInferencetruncates teacher outputs — this field inteacherModelConfigcaps how many tokens the teacher generates per training prompt. Setting it too low produces truncated golden completions, and the student model learns from them silently. Use at least 512 for extraction tasks, 2048 for open-ended generation.- Job names are account+region scoped — reusing a job name while a job with that name is
InProgressreturnsConflictException. Use a timestamp suffix like-2026-11-27to avoid collisions across runs. - Use
provisionedModelArnnotcustomModelArnin ConverseCommand — using the custom model ARN directly returnsAccessDeniedException: Custom models require Provisioned Throughput. The provisioned model ARN format isarn:aws:bedrock:REGION:ACCOUNT:provisioned-model/ID— it includes your account ID. - PT takes 10–30 minutes to reach InService —
CreateProvisionedThroughputCommandreturns immediately but the resource is in"Creating"state. Tool handlers that try to invoke the model during this window receive errors. PollGetProvisionedModelThroughputCommanduntilstatus === "InService"before shifting traffic. - PT commitments renew automatically — the minimum commitment is
OneMonthand it renews unless you delete the resource first. Bedrock does not send renewal reminders. Mark thecommitmentExpirationTimein your calendar. No cross-region inference for distilled models either — the provisioned model ARN must match the region where you created the PT.
Monitor your distilled MCP server endpoint from the outside
Once your distilled model is live behind Provisioned Throughput, its failure modes differ from standard on-demand inference. The PT endpoint can become "Failed" due to AWS infrastructure issues, and your MCP tool handlers start returning errors that look like model timeouts until you check PT status manually. During a gradual traffic migration, you also need to compare teacher and student latency in production — not in a local benchmark.
AliveMCP monitors your MCP server health, response time, and tool call error rates from an external vantage point — independent of CloudWatch metrics inside your AWS account. You know immediately when tool call latency spikes, before users notice the difference between teacher and student model responses.