概念 · 基于 AIF-C01
Model distillation
In Bedrock, choose a teacher and a student, supply prompts or logs, and trade a little quality for speed and cost.
本课尚未翻译,暂以英文显示。
你在AI Practitioner中已学过
- Teacher: large and capable. Student: small and fast.
- The student trains on the teacher’s answers.
- Training costs once. The savings repeat on every call.
- 1You provide prompts, or logged prompts and responses.
- 2The teacher writes the answers.
- 3Bedrock fine-tunes the student on them. The result is your distilled model.
分步说明
- 1You provide prompts, or logged prompts and responses.
- 2The teacher writes the answers.
- 3Bedrock fine-tunes the student on them. The result is your distilled model.
The distillation job.
Your prompts
- Teacher answers
- Generated
- Extra cost
- Teacher calls
Logged prompts only
- Teacher answers
- Generated again
- Extra cost
- Teacher calls
Logged prompts and responses
- Teacher answers
- Reused from the logs
- Extra cost
- None for the teacher
| Input | Teacher answers | Extra cost |
|---|---|---|
| Your prompts | Generated | Teacher calls |
| Logged prompts only | Generated again | Teacher calls |
| Logged prompts and responses | Reused from the logs | None for the teacher |
是什么
In Amazon Bedrock you pick a teacher model whose accuracy you want and a smaller student model to fine-tune, and you give use-case prompts as JSONL files in Amazon S3. Bedrock generates the teacher’s answers, using data synthesis techniques to make them more varied, and fine-tunes the student on them. Only you can use the result. You can add a few labeled prompt and response pairs as golden examples that steer the teacher.
是什么
If you already run the teacher in production, use invocation logs: turn on invocation logging, and Bedrock reads logged prompts, with or without the logged responses. With prompt and response pairs it reuses teacher answers you already paid for, and the teacher in the job must match the model in the log. You can filter logs by request metadata. With prompts only, it asks the teacher again.
Costs: you pay for the teacher’s inference when Bedrock generates responses, at the on-demand rate, and for the student’s training. Then you serve the student, which is cheaper and faster per call. Synthesis can grow the data set to as many as 15,000 prompt and response pairs.
是什么
The student only matches the teacher on the focused task. If the task shifts a lot or needs broad skill, the distilled model falls short, so measure quality before you switch.
要记住
- Needs a teacher, a student, and prompts in S3 as JSONL.
- Option: prompts from invocation logs, with or without teacher responses.
- Reusing logged responses avoids paying for teacher calls again.
- Teacher inference during generation is billed at on-demand rates.
- Result: lower latency and cost per call on the focused task.
要记住
- Check quality on your task before switching.
考试中
- “Cut cost and latency while keeping the quality of a large model on one task” points to distillation.
- “Production logs already hold the large model’s answers” points to distillation from invocation logs.
- “A smaller model answers broad new questions poorly” shows the limit of distillation: it fits a focused task.
本任务内容 · 2.2
- Built-in algorithms for tabular data
- Built-in algorithms: clustering, dimensionality reduction, anomaly
- Built-in algorithms: text, sequence and forecasting
- Built-in algorithms: image and video
- Training jobs, script mode and ML libraries
SageMaker AMT
- Reducing training time
- Distributed training and HyperPod
- Overfitting, underfitting and catastrophic forgetting
- Combining models
- Epochs, steps, batch size and learning rate
- Task-specific prompt engineering
- Fine-tuning and continued pre-training in Bedrock
- PEFT, LoRA and fine-tuning on SageMaker
- Model distillation
- Optimizing retrieval and embedding models