AI Glossary / Causal inference and experimentation / Beginner

L 1 loss

Definition

L1 loss measures prediction error using the absolute difference between a predicted value and its observed target. For one example it is |prediction − target|. Across examples, the absolute errors may be summed or averaged; the average is mean absolute error. L1 loss gives each additional unit of error the same additional penalty. The supplied title “L 1 loss” refers to this absolute-error concept, not to a penalty on model weights.

What it means

If a delivery estimate is three minutes too early or three minutes too late, its absolute error is three minutes either way. The sign disappears, so early and late mistakes do not cancel each other when results are combined.

This makes the loss easy to interpret when the target has familiar units. Its symmetry is also a modeling choice. A business might care more about underestimating demand than overestimating it, in which case ordinary L1 loss does not express the full cost. Choosing a loss means choosing how errors are valued, not merely selecting a convenient equation for training.

How it works

For each example, subtract the observed target from the prediction and take the absolute value. Sum the results for total absolute loss or divide by the number of examples for mean absolute error. State which reduction is used, especially when comparing datasets or batches of different sizes.

During optimization, changing the prediction by one unit toward the target reduces the single-example loss by one until it reaches zero. The absolute-value function has a corner at zero, so its ordinary derivative is undefined there; optimization methods can handle an appropriate subgradient convention.

When choosing a single constant prediction to minimize total absolute error, a median of the observations is optimal. This illustrates the kind of center favored by the loss, distinct from the mean favored by squared error.

Three practical examples

1. Arrival-time forecasting: a team measures average absolute timing error in minutes, alongside separate summaries of early and late predictions.

2. Sensor-value reconstruction: engineers compare reconstructed and measured temperatures using absolute differences to keep the reported metric in temperature units.

3. Demand-model comparison: an analyst evaluates typical forecast error magnitude using mean absolute error, while separately examining costly underpredictions and unusual demand peaks.

Think of it this way

Think of measuring how far a dart lands from a target along a ruler. A miss to the left and an equally large miss to the right both have the same distance. The analogy is limited: prediction errors may have unequal practical consequences, and many targets or outputs can require different scaling. Absolute distance alone does not decide what an error costs.

Worked example

Actual delivery times are 10, 14, and 18 minutes; predictions are 12, 11, and 25. Signed prediction errors are 2, −3, and 7 minutes. Absolute errors are 2, 3, and 7, giving total L1 loss 12 minutes and mean absolute error 12/3 = 4 minutes.

If the last prediction changes from 25 to 28, its absolute error rises from 7 to 10. Total loss rises by three, exactly matching the additional error magnitude. Squared error would increase that item's contribution from 49 to 100, giving a much larger incremental penalty.

For a separate constant-prediction example, observations [1, 2, 9] have median 2. Predicting 2 gives total absolute error 1 + 0 + 7 = 8; predicting their mean 4 gives 3 + 2 + 5 = 10.

Illustrative case study

Fictional case: Willow Deliveries reports average signed timing error close to zero and assumes its estimates are dependable. Customers still experience substantial misses in both directions. An analyst shows that early and late errors have canceled in the signed average.

The team adds mean absolute error to describe magnitude, keeps signed error to track direction, and reviews large misses separately. It also discovers that late estimates and early estimates cause different operational problems, prompting a discussion about the training objective. The lesson is that L1 provides a useful error summary, while business consequences may require additional measures or a different loss design.

Common misconceptions and mistakes

Do not confuse L1 loss with L1 regularization. The former compares predictions with targets; the latter penalizes absolute parameter values. They can appear in the same training objective but serve different purposes.

Avoid saying L1 ignores outliers. A large residual still adds a large absolute error, although it receives less emphasis than under a squared-error penalty.

Do not compare total losses across unequal sample counts without accounting for size. Also avoid mixing output units casually: a numerical error of ten means something different for minutes, meters, and currencies.

Business use

L1 loss and mean absolute error are useful when error magnitude in the target's units is an understandable and relevant quality measure. Their linear penalty can be attractive when extreme residuals should not dominate as strongly as they would under squared loss.

Before selecting the objective, consider whether over- and underprediction have comparable costs and whether rare large mistakes need special attention. Report the metric with its units, sample definition, and aggregation rule. A lower average absolute error is evidence of improvement on that measure, not proof that every customer or operational case benefits.

People also ask

Is mean absolute error different from L1 loss?

It is the mean reduction of absolute errors. Some software calls that reduction L1 loss, so check whether the reported value is a sum or a mean.

Does L1 preserve the direction of errors?

No. Taking absolute values removes direction. Use a separate signed-error measure when direction matters.

Why is the median associated with L1?

A median minimizes the sum of absolute distances to a set of observed values when selecting one constant prediction.

Check your understanding

Predictions miss by −5 and +5 units. Is their mean absolute error zero?

Answer: No. Their signed mean error is zero, but their mean absolute error is (5 + 5)/2 = 5 units. The two calculations answer different questions.

Related terms

  • Mean Absolute Error
  • Residual
  • Loss function
  • Median
  • L2 loss
  • L1 regularization
  • Huber loss
  • quantile loss

Learn next

Calculate signed, absolute, and squared errors for five predictions in a familiar unit. Change one prediction to create a large miss and compare the summaries. Then write whether early and late errors have the same practical cost in the intended application before choosing a training objective.

More in Causal inference and experimentation

  • Item response theory - Item response theory (IRT) is a family of statistical models that relates responses to individual questions or tasks to an unobserved ability or trait and...
  • Jaccard similarity coefficient score - The Jaccard similarity coefficient score measures overlap between two sets by dividing the size of their intersection by the size of their union.
  • k-fold cross validation - K-fold cross validation is an evaluation procedure that divides data into k non-overlapping parts, or folds, and repeatedly trains a model on all but one...
  • L 2 loss - L2 loss commonly means squared prediction error: the square of the difference between a prediction and its observed target.
  • Label ranking average precision - Label ranking average precision, or LRAP, evaluates how well a model ranks the relevant labels for each example above irrelevant labels.
  • Labeled precision - Labeled precision is the proportion of predicted structures that match reference structures in both their structural identity and their label.

Sources

Primary references: Google Machine Learning Glossary, L1 loss, https://developers.google.com/machine-learning/glossary#l1-loss ; scikit-learn, Metrics and scoring, https://scikit-learn.org/stable/modules/model_evaluation.html . The absolute-error definition and median-target relationship were consulted. The supplied spelling is preserved, and this entry states sum-versus-mean conventions explicitly. All numerical values and the delivery case are original teaching illustrations.

Previous: KV cache Next: L 1 regularization

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer