Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the learning rate in machine learning?
The learning rate is a number that controls how much the model changes its knowledge after seeing new data. It decides the size of steps the model takes to learn.
Click to reveal answer
beginner
What happens if the learning rate is too high?
If the learning rate is too high, the model might jump around and never settle on a good solution. It can miss the best answer and perform poorly.
Click to reveal answer
beginner
Why is a very low learning rate not always good?
A very low learning rate makes the model learn very slowly. It takes a long time to improve and might get stuck before finding the best solution.
Click to reveal answer
intermediate
What is a learning rate schedule?
A learning rate schedule changes the learning rate during training. It can start high to learn fast, then lower to fine-tune the model carefully.
Click to reveal answer
intermediate
How can you find a good learning rate?
You can try different learning rates and watch how the model learns. Tools like learning rate range tests help find a rate that makes the model improve steadily.
Click to reveal answer
What does a learning rate control in training a model?
AThe amount of data used for training
BThe number of layers in the model
CThe size of steps the model takes to learn
DThe type of activation function
✗ Incorrect
The learning rate controls how big the model's updates are during training.
If the learning rate is too high, what is likely to happen?
AThe model might never settle on a good solution
BThe model learns very slowly
CThe model uses less memory
DThe model becomes simpler
✗ Incorrect
A high learning rate can cause the model to jump around and miss the best solution.
What is the purpose of a learning rate schedule?
ATo change the learning rate during training
BTo increase the number of training samples
CTo add more layers to the model
DTo change the loss function
✗ Incorrect
A learning rate schedule adjusts the learning rate over time to improve training.
Which is a sign that the learning rate might be too low?
AModel accuracy is very high immediately
BTraining loss jumps up and down
CModel uses less data
DTraining is very slow and stuck
✗ Incorrect
A low learning rate can cause slow progress and the model might get stuck.
How can you find a good learning rate?
AUse the biggest rate possible
BTry different rates and watch training progress
CAlways use a fixed rate of 0.1
DIgnore learning rate and focus on model size
✗ Incorrect
Testing different learning rates helps find one that works well for the model.
Explain why choosing the right learning rate is important for training a model.
Think about how fast or stable the model learns.
You got /4 concepts.
Describe what a learning rate schedule does and why it might help.
Consider how changing speed helps when learning something new.
You got /4 concepts.
Practice
(1/5)
1.
What does the learning rate control in training a computer vision model?
easy
A. The number of layers in the model
B. The size of the input images
C. How fast the model updates its knowledge
D. The type of activation function used
Solution
Step 1: Understand the role of learning rate
The learning rate determines how much the model changes its weights after seeing each example.
Step 2: Connect learning rate to model updates
A higher learning rate means faster updates, while a lower rate means slower updates.
Final Answer:
How fast the model updates its knowledge -> Option C
Quick Check:
Learning rate controls update speed = C [OK]
Hint: Learning rate = speed of model learning updates [OK]
Common Mistakes:
Confusing learning rate with model size
Thinking learning rate changes input data
Mixing learning rate with activation functions
2.
Which of the following is the correct way to set a learning rate of 0.01 using PyTorch's SGD optimizer?
import torch.optim as optim
optimizer = optim.SGD(model.parameters(), lr=___)
easy
A. 0.01
B. 0.1
C. "0.01"
D. learning_rate
Solution
Step 1: Check the expected type for learning rate
The learning rate parameter expects a float number, not a string or variable name.
Step 2: Identify the correct float value for 0.01
Using 0.01 as a float sets the learning rate correctly.
Final Answer:
0.01 -> Option A
Quick Check:
Learning rate as float = 0.01 [OK]
Hint: Use float numbers, not strings or variables, for lr [OK]
Common Mistakes:
Using string "0.01" instead of float 0.01
Passing undefined variable learning_rate
Setting lr to 0.1 by mistake
3.
Consider this training loop snippet for a vision model:
learning_rate = 0.5
for epoch in range(3):
loss = train_one_epoch(model, data, learning_rate)
print(f"Epoch {epoch+1} loss: {loss:.2f}")
If the learning rate is too high, what is the most likely output behavior?
medium
A. Loss becomes zero immediately
B. Loss stays constant
C. Loss steadily decreases each epoch
D. Loss fluctuates or increases wildly
Solution
Step 1: Understand effect of high learning rate
A very high learning rate like 0.5 can cause the model to overshoot the best weights, making training unstable.
Step 2: Predict loss behavior with unstable training
Loss will not steadily decrease but will jump up and down or increase.
Final Answer:
Loss fluctuates or increases wildly -> Option D
Quick Check:
High lr causes unstable loss = A [OK]
Hint: High learning rate causes unstable or rising loss [OK]
Common Mistakes:
Assuming loss always decreases regardless of lr
Thinking loss becomes zero immediately
Confusing constant loss with stable training
4.
Given this code snippet, identify the error related to learning rate usage:
optimizer = torch.optim.Adam(model.parameters(), lr=0.001)
for epoch in range(5):
loss = train(model, data)
optimizer.step()
optimizer.zero_grad()
medium
A. optimizer.step() called before loss.backward()
B. Learning rate is too high for Adam optimizer
C. optimizer.zero_grad() should be called after optimizer.step()
D. Learning rate should be set inside the loop
Solution
Step 1: Check optimizer usage order
Before calling optimizer.step(), gradients must be computed by loss.backward().
Step 2: Identify missing backward call
The code misses loss.backward(), so optimizer.step() updates without gradients.
Final Answer:
optimizer.step() called before loss.backward() -> Option A
Quick Check:
Missing loss.backward() before step = B [OK]
Hint: Call loss.backward() before optimizer.step() [OK]
Common Mistakes:
Thinking learning rate 0.001 is too high for Adam
Believing zero_grad() order is wrong here
Assuming learning rate must change each epoch
5.
You want to train a deep vision model on a new dataset. You start with a learning rate of 0.1 but notice training loss does not decrease. What is the best next step?
hard
A. Remove the learning rate parameter from the optimizer
B. Decrease the learning rate to 0.01 and try again
C. Keep the learning rate at 0.1 and train longer
D. Increase the learning rate to 1.0 for faster learning
Solution
Step 1: Analyze why loss does not decrease
A high learning rate like 0.1 can cause the model to skip the best weights, preventing loss decrease.
Step 2: Choose a safer learning rate adjustment
Lowering the learning rate to 0.01 allows smaller, stable updates to improve training.
Final Answer:
Decrease the learning rate to 0.01 and try again -> Option B
Quick Check:
Lower lr if loss stuck = D [OK]
Hint: Lower learning rate if loss doesn't drop [OK]