def adjust_lr(
        lr: float,
        lr_penalty: float,
        num_times: int,
        min_scale: float,
    ) -> float:
        """Adjusts LR.

        Multiplicatively scales down the LR by lr_penalty for each outlier
        that has occurred in the last `timeout` number of steps, capping the
        scaling to be no smaller than `min_scale`.

        Args:
            lr (float): Base learning rate
            lr_penalty (float): Scaling factor to multiply by for each outlier
            num_times (int): Number of outliers in the last `timeout` steps
            min_scale (float): Minimum scaling to apply to our LR.

        Returns:
            float: Scaled LR
        """
        return lr * max(min_scale, lr_penalty**num_times)
Adjusts LR.

        Multiplicatively scales down the LR by lr_penalty for each outlier
        that has occurred in the last `timeout` number of steps, capping the
        scaling to be no smaller than `min_scale`.

        Args:
            lr (float): Base learning rate
            lr_penalty (float): Scaling factor to multiply by for each outlier
            num_times (int): Number of outliers in the last `timeout` steps
            min_scale (float): Minimum scaling to apply to our LR.

        Returns:
            float: Scaled LR
        
llmfoundry/optim/adaptive_lion.py