概念
Customization cost tradeoffs
Five ways to adapt a model, from cheapest to costliest, and when each one is the answer.
本课尚未翻译,暂以英文显示。
In-context learning
- Cost
- Lowest: longer prompts
- Data needed
- A few examples
- Use it when
- A task needs a clear format
RAG
- Cost
- Low: vector store and retrieval
- Data needed
- Your documents
- Use it when
- Facts are private or change
Fine-tuning
- Cost
- Medium: training, then custom model capacity
- Data needed
- Labeled examples
- Use it when
- Style or skill must change
Distillation
- Cost
- Medium to high: training pays off in cheaper calls
- Data needed
- Teacher model outputs
- Use it when
- You need speed and lower cost
Pre-training
- Cost
- Highest: massive compute
- Data needed
- Huge raw data sets
- Use it when
- Almost never
| Approach | Cost | Data needed | Use it when |
|---|---|---|---|
| In-context learning | Lowest: longer prompts | A few examples | A task needs a clear format |
| RAG | Low: vector store and retrieval | Your documents | Facts are private or change |
| Fine-tuning | Medium: training, then custom model capacity | Labeled examples | Style or skill must change |
| Distillation | Medium to high: training pays off in cheaper calls | Teacher model outputs | You need speed and lower cost |
| Pre-training | Highest: massive compute | Huge raw data sets | Almost never |
1 / 3
In-context learning
- Cost
- Lowest: longer prompts
- Data needed
- A few examples
- Use it when
- A task needs a clear format
RAG
- Cost
- Low: vector store and retrieval
- Data needed
- Your documents
- Use it when
- Facts are private or change
| Approach | Cost | Data needed | Use it when |
|---|---|---|---|
| In-context learning | Lowest: longer prompts | A few examples | A task needs a clear format |
| RAG | Low: vector store and retrieval | Your documents | Facts are private or change |
2 / 3
Fine-tuning
- Cost
- Medium: training, then custom model capacity
- Data needed
- Labeled examples
- Use it when
- Style or skill must change
Distillation
- Cost
- Medium to high: training pays off in cheaper calls
- Data needed
- Teacher model outputs
- Use it when
- You need speed and lower cost
| Approach | Cost | Data needed | Use it when |
|---|---|---|---|
| Fine-tuning | Medium: training, then custom model capacity | Labeled examples | Style or skill must change |
| Distillation | Medium to high: training pays off in cheaper calls | Teacher model outputs | You need speed and lower cost |
3 / 3
Pre-training
- Cost
- Highest: massive compute
- Data needed
- Huge raw data sets
- Use it when
- Almost never
| Approach | Cost | Data needed | Use it when |
|---|---|---|---|
| Pre-training | Highest: massive compute | Huge raw data sets | Almost never |
是什么
A general foundation model often needs help to fit your business. There are five main ways, and they differ a lot in cost, effort and data needed.
In-context learning puts instructions and examples in the prompt: no training, you pay a little more per call for the longer prompt. RAG adds retrieved documents to the prompt: it needs a vector store but no training. Fine-tuning trains the model on labeled examples to change its style or skill: it needs good data in Amazon S3 and training time.
是什么
In Amazon Bedrock a custom model can run on Provisioned Throughput (reserved capacity). Some customized models, such as newer Amazon Nova models, can also run on demand, where you pay per use. Distillation trains a small student model from a large teacher: you pay to train, then save on every call. Pre-training builds a model from scratch on huge data sets: the highest cost by far.
Rule of thumb: start at the cheap end and move up only when it is not enough.
要记住
- Cheapest to costliest: in-context learning, RAG, fine-tuning, distillation, pre-training.
- In-context learning: examples in the prompt, no training.
- RAG: fresh or private facts, no training.
- Fine-tuning: teaches a style or skill, needs labeled data. In Amazon Bedrock a custom model can run on Provisioned Throughput. Some models also support on-demand use.
要记住
- Distillation: a smaller, faster model, so lower cost per call.
- Pre-training: from scratch, huge data and compute, rarely the right answer.
考试中
- “Lowest-cost way to improve answers” points to prompt engineering or in-context learning, then RAG.
- “Model must know changing company data” points to RAG, not fine-tuning.
- “Most expensive and data-hungry approach” points to pre-training.
- “Reserved capacity for a custom model in Amazon Bedrock” points to Provisioned Throughput. “Pay per use for a customized model” can point to on-demand deployment, where the model supports it.
别和这些弄混
- Retrieval Augmented Generation (RAG)Look up facts first, add them to the prompt, then let the model answer from them.
- Fine-tuning methodsWays to adapt a pre-trained model: instruction tuning, domain adaptation, transfer learning and continued pre-training.
- Model distillationA large teacher model trains a small student model that is faster and cheaper to run.