Notes

Quantile Loss

If you’re predicting a number, you’re not always trying to hit the “average” outcome. Sometimes you want a safe upper bound (like worst-case demand) or a conservative lower bound (like a minimum guaranteed revenue). Quantile loss is the training objective that makes a model aim for a chosen percentile of the target, not the mean.

What quantile loss is doing

Quantile loss (also called the pinball loss) is built for quantile regression. Pick a quantile level τ between 0 and 1 (e.g., 0.9 for the 90th percentile). For an error e = y - ŷ, the loss is asymmetric:

  • If the model underpredicts (y > ŷ), it pays a penalty proportional to τ · (y - ŷ).
  • If the model overpredicts (y < ŷ), it pays a penalty proportional to (1 - τ) · (ŷ - y).

This asymmetry forces the fitted predictions to land where roughly τ of the true outcomes fall below the prediction (and 1-τ above), which is exactly what a quantile means.

Why it matters in supervised regression

Using squared error trains you toward the conditional mean, which can be a bad decision target when costs are uneven. Quantile loss directly encodes “underpredicting is worse than overpredicting” (or vice versa), which matches real constraints like stockouts, SLA breaches, or risk limits.

Practical examples and where you’ll see it

  • Demand forecasting: train the 0.9 quantile to stock enough inventory 90% of the time.
  • Delivery-time estimates: predict the 0.95 quantile to give a reliable “arrives by” promise.
  • Credit risk / losses: model an upper quantile of loss to stress-test portfolios.

In practice, you’ll encounter it in gradient boosting libraries (e.g., LightGBM’s quantile objective) and in stats/ML toolkits that implement quantile regression.

Quantile loss (pinball loss) is an asymmetric regression loss that trains a model to predict a specified conditional quantile (e.g., the 0.9 quantile) by penalizing underestimates and overestimates with different weights set by the quantile level. It matters because it enables quantile regression and calibrated prediction intervals, supporting risk-sensitive decisions where the mean is insufficient.

Imagine you’re ordering groceries for a party. Running out is a big problem, but having a little extra isn’t so bad. You’d want a “penalty rule” that punishes under-ordering more than over-ordering. Quantile Loss is that kind of rule for AI predictions.

It’s used when a model predicts a number (like delivery time, house price, or future demand) and you care about being wrong in one direction more than the other. With Quantile Loss, you can train a model to aim for a chosen “percentile” (like the 90th), giving a cautious estimate that helps manage risk.