# L1 and L2 Loss

### L1 Loss vs L2 Loss

* **Robustness**: L1 > L2

  Intuitively speaking, since a L2-norm squares the error (increasing by a lot if error > 1), the model will see a much larger error than the L1-norm, so the model is much more sensitive to outliers.
* **Stability**: L2 > L1

  In the case of a more “outlier” point, both norms still have big change, but again the L1-norm has more changes in general.
* **Solution uniqueness**: Minimizing the L2 loss corresponds to calculating **the arithmetic mean**, which is unambiguous, while minimizing the L1 loss corresponds to calculating **the median**, which is ambiguous if an even number of elements are included in the median calculation, So L2 has unique solution while L1 has multiple solution
* Smooth l1 loss

![img](/files/skpb5aiIsUUOaPa9tUd1)

Smooth L1 loss that is less sensitive to outliers than the L2 loss used in R-CNN and SPPne.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ztlevi.gitbook.io/ml-101/loss/l1-and-l2-loss.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
