Based on the MLA-C01 exam guideReport an error
Training an image classifier or a text generation model from scratch every time costs enormous amounts of data, time, and money. JumpStart is a hub collecting hundreds of pre-trained models and solution templates, where you can deploy proven models for image classification, object detection, text classification, summarization, text generation (including LLMs), and more in a few lines, or fine-tune them with your own data.
from sagemaker.jumpstart.model import JumpStartModel
# Deploy the pre-trained model as is
model = JumpStartModel(model_id='huggingface-text2text-flan-t5-base')
predictor = model.deploy()
response = predictor.predict({'inputs': 'Summarize this sentence: ...'})from sagemaker.jumpstart.estimator import JumpStartEstimator
# Fine-tune the pre-trained model with my data
estimator = JumpStartEstimator(model_id='huggingface-text2text-flan-t5-base')
estimator.fit({'training': 's3://my-bucket/my-data/'})
fine_tuned = estimator.deploy()JumpStart splits into two usage modes.
| Usage mode | Call flow | What is needed | When to choose |
|---|---|---|---|
| Deploy as is | JumpStartModel(...).deploy() | Nothing | When model performance is already sufficient for a general task |
| Fine-tune then deploy | JumpStartEstimator(...).fit() → .deploy() | My domain's labeled data | When domain specialization is needed, such as technical terms or in-house data |
On the exam, "quickly start with a proven model with almost no code" calls to mind JumpStart. If "specialize with my domain data" is added, it is fit → deploy.
The value of JumpStart lies in "reuse of representation learning". A model trained on large-scale data already knows general features (edges and textures in images, grammar and meaning in language). This knowledge is commonly useful for most downstream tasks. So instead of making it learn from scratch, bringing in a model that already knows is the key reason you get high performance even with little data and cost.
Transfer learning is a technique that carries knowledge learned in one task over to another related task. JumpStart fine-tuning is exactly an implementation of transfer learning. Typically, the front part of the pre-trained model (the general feature extractor) is left as is, and only the back part (the task-specific classification layer) is retrained with my data.
[Pre-trained model] already trained on large-scale data
Lower layers : general features like lines·edges·textures → freeze
Middle layers : partial shapes·structures → freeze or partially unfreeze
Output layer : classes of the original task → cut off and replace
│
▼
[My task] new output layer matching my number of classes ── train with my data
│
▼
High performance with little data and short timeThere are three key benefits.
How deeply to fine-tune splits on two factors: the amount of my data and domain similarity.
| Amount of labeled data | Similarity to the pre-training domain | Recommended approach |
|---|---|---|
| Small (hundreds per class) | High | Freeze the feature extractor and train only the output layer |
| Small | Low | Fine-tune some upper layers as well + use data augmentation together |
| Large | High | Fine-tune all layers with a low learning rate |
| Large | Low | Deep fine-tuning; in some cases training from scratch is also a candidate |
The reason for freezing the lower layers is that the knowledge those parts learn is reusable regardless of the task. Edges and textures in images and grammatical structure in language are needed in any task. Conversely, the output layer is tied directly to "the answer list of the original task" and cannot be reused, so it is cut off and a new one is attached. The less data you have, the more you must narrow the part you train anew to avoid overfitting.
Laying the three approaches out by cost and data requirements makes the selection criteria clear.
| Approach | Labeled data needed | Training cost·time | Domain specialization |
|---|---|---|---|
| Deploy the pre-trained model as is | None | Training cost 0 (inference cost only) | None |
| Fine-tuning (transfer learning) | Hundreds ~ thousands | Low ~ medium | High |
| Training from scratch | Tens of thousands ~ hundreds of thousands | High | Best only when data is sufficient |
⚠️ Pitfall: The answer to the scenario "I have little labeled training data (e.g., hundreds of images per class) but need an accurate image classifier" is transfer learning (fine-tuning a pre-trained model). Training a CNN from scratch would leave you far short of data. Conversely, if "data is very abundant and the domain is completely different from existing models", consider training from scratch or deeper fine-tuning. The amount of data and domain similarity are the decision criteria.
Here we gather in one place the cost-saving means that appeared scattered through this week. The exam asks comprehensively about "ways to reduce training cost".
Training cost = (resource unit price) × (amount of work to do)
│ │
│ └─ Reduce the amount of work
│ ├─ Transfer learning / JumpStart (don't learn from scratch)
│ ├─ Early stopping (AMT) (stop hopeless trials)
│ └─ max_run ceiling (block runaway training)
│
└─ Lower the unit price
├─ Managed Spot Training (+ checkpoints)
├─ Instances matched to the algorithm (CPU / GPU)
├─ Input mode (Pipe / Fast File)
└─ RecordIO-protobuf format| Means | Effect | Key condition |
|---|---|---|
| Managed Spot Training | Up to 90% savings | Can be interrupted → checkpoints required |
| Transfer learning / JumpStart | Reduces the amount of training itself | Use a pre-trained model |
| Early stopping (tuning) | Stops hopeless training | Early stopping in AMT |
| Appropriate instance selection | Prevents over-provisioning | CPU/GPU matched to the algorithm |
| Distributed training efficiency | Shortens time | FSx when I/O is the bottleneck |
| Input mode optimization | Reduces startup delay·disk | Pipe/Fast File for large volumes |
| Data format (RecordIO) | I/O efficiency | Large-volume streaming |
The two most powerful means are Spot training (reducing infrastructure unit price) and transfer learning/JumpStart (reducing the amount of training itself). These two are on different axes, so they can be used together — fine-tuning a pre-trained model on Spot instances stacks both savings.
# Example of cost optimization combining transfer learning + Spot
estimator = JumpStartEstimator(
model_id='huggingface-text2text-flan-t5-base',
use_spot_instances=True,
max_run=3600,
max_wait=7200,
checkpoint_s3_uri='s3://my-bucket/checkpoints/',
)⚠️ Pitfall: In "How do you reduce cost?", options to switch to a smaller instance are often mixed in. But if training takes proportionally longer, the total cost stays about the same or can even rise. Cost is unit price × time, so choosing by unit price alone is wrong. Conversely, moving up to a bigger GPU while GPU utilization is low is another classic wrong answer that spends money without shortening time.
Cost optimization becomes clear if you think of it in two branches. ① Lower the unit price: do the same work with cheaper resources — Spot, appropriate instance size, input mode. ② Reduce the amount of work: compute less in the first place — transfer learning (don't learn from scratch), early stopping (stop hopeless trials). If you distinguish whether an exam question is asking about "unit price" or "amount of work", the answer shows up quickly.
Surprisingly common waste in training cost is "resources left on after finishing" and "training that runs endlessly because of a wrong configuration". There are several safeguards.
max_run: Force-terminates training that exceeds a certain time to block runaway cost.Long-running training jobs can be checked periodically with code.
import boto3
from datetime import datetime, timedelta, timezone
sm = boto3.client('sagemaker')
# Training jobs in progress for more than 24 hours = runaway cost candidates
resp = sm.list_training_jobs(StatusEquals='InProgress', MaxResults=100)
cutoff = datetime.now(timezone.utc) - timedelta(hours=24)
for job in resp['TrainingJobSummaries']:
if job['CreationTime'] < cutoff:
print('Long-running:', job['TrainingJobName'], job['CreationTime'])One team launched a GPU notebook instance to experiment, forgot to turn it off on Friday evening, and left it running all weekend. A training job shuts down automatically when it finishes, but a notebook instance keeps billing until a person turns it off, so a single lapse burned hundreds of thousands of Korean won. Afterward, they applied an idle auto-shutdown lifecycle config so that the notebook turns itself off after a period of inactivity, preventing a recurrence.
| Symptom | Common cause | Action |
|---|---|---|
| Trained from scratch with few labels and accuracy is poor | Overfitting from insufficient data | Switch to fine-tuning a pre-trained model (transfer learning) |
| Performance actually dropped after fine-tuning | Shook all layers heavily with little data | Freeze the lower layers and lower the learning rate |
| Training cost keeps exceeding the budget | Only the unit price was addressed, the amount of work is unchanged | Reduce the training amount itself with transfer learning and add early stopping |
| Spot is on but the total elapsed time grew greatly | Retraining from scratch every time after reclamation | Specify checkpoint_s3_uri + check the script's resume logic |
| Charges keep coming though nobody is using anything | A notebook instance left on and neglected | Apply an idle auto-shutdown lifecycle config |
| Training has not finished for days | Training that does not converge because of a configuration error keeps running | Set a ceiling with max_run and periodically check in-progress jobs |
In the next post, we do a comprehensive review of this whole week (Model Development 1 — SageMaker Training).
Click a choice to reveal the answer and explanation.
Question 1
You want to quickly deploy a validated text summarization model as an inference endpoint with almost no coding. What is the most suitable SageMaker feature?
Question 2
You must build an accurate image classifier from a small number of labeled images, on the order of a few hundred per class. What is the most suitable approach?
Question 3
You want to fine-tune a pretrained LLM on your domain data while cutting training cost as much as possible. Training can be resumed even if interrupted. What is the most effective combination?
Question 4
When dividing training cost optimization measures into "lowering the unit price" and "reducing the amount of work itself," which of the following belongs to reducing the amount of work?
Question 5
You want to prevent the problem of continued billing while a GPU notebook instance launched for experiments sits unused because you forgot to shut it down. What is the most suitable measure?