class paddle.callbacks. ReduceLROnPlateau ( monitor='loss', factor=0.1, patience=10, verbose=1, mode='auto', min_delta=0.0001, cooldown=0, min_lr=0 ) [source]

Reduce learning rate when a metric of evaluation has stopped improving. Models often benefit from reducing the learning rate by a factor of 2-10 once learning stagnates. This callback monitors a quantity and if no improvement is seen for a ‘patience’ number of epochs, the learning rate is reduced.

  • monitor (str, optional) – Quantity to be monitored. Default: ‘loss’.

  • factor (float, optional) – factor by which the learning rate will be reduced. new_lr = lr * factor. Default: 0.1.

  • patience (int, optional) – Number of epochs with no improvement after which learning rate will be reduced. Default: 10.

  • verbose (int, optional) – The verbosity mode. 0: quiet, 1: update messages. Default: 1.

  • mode (str, optional) – one of {‘auto’, ‘min’, ‘max’}. In ‘min’ mode, the learning rate will be reduced when the quantity monitored has stopped decreasing. In ‘max’ mode, learning rate will reduce until monitored quantity stops increasing. In ‘auto’ mode, exact mode can be inferred by the name of monitor. If ‘acc’ in monitor, the mode will be considered as ‘max’, otherwise the mode will be set to ‘min’. Default: ‘auto’.

  • min_delta (int|float, optional) – threshold for measuring the new optimum, to only focus on significant changes. Default: 0.

  • cooldown (int, optional) – number of epochs to wait before resuming normal operation after lr has been reduced. Default: 0.

  • min_lr (float, optional) – lower bound on the learning rate. Default: 0.


import paddle
from paddle import Model
from paddle.static import InputSpec
from import LeNet
from import MNIST
from paddle.metric import Accuracy
from paddle.nn.layer.loss import CrossEntropyLoss
import as T
sample_num = 200
transform = T.Compose(
    [T.Transpose(), T.Normalize([127.5], [127.5])])
train_dataset = MNIST(mode='train', transform=transform)
val_dataset = MNIST(mode='test', transform=transform)
net = LeNet()
optim = paddle.optimizer.Adam(
    learning_rate=0.001, parameters=net.parameters())
inputs = [InputSpec([None, 1, 28, 28], 'float32', 'x')]
labels = [InputSpec([None, 1], 'int64', 'label')]
model = Model(net, inputs=inputs, labels=labels)
callbacks = paddle.callbacks.ReduceLROnPlateau(patience=3, verbose=1),
on_train_begin ( logs=None )

Called at the start of training.


logs (dict) – The logs is a dict or None.

on_eval_end ( logs=None )

Called at the end of evaluation.


logs (dict) – The logs is a dict or None. The logs passed by paddle.Model is a dict contains ‘loss’, metrics and ‘batch_size’ of last batch of validation dataset.