Mean absolute error (MAE) is a regression loss measure that looks at the absolute value difference between a model’s predictions and ground truth, averaged across the dataset. Unlike mean square error (MSE), MAE is weighted on a linear scale and therefore does not put as much weight on outliers. That gives a more even read on typical error, but it also means a miss of ten counts the same as ten misses of one.
If you train forecasting, pricing, or demand models, MAE is often the first scalar you report after RMSE. It stays in the same units as the target, so stakeholders can read it without squaring anything in their heads. It also behaves predictably when a few rows have bad labels or extreme values you do not want the metric to chase.
Build better agents with Arize
Trace, evaluate, and learn. Build agents that work with Arize AX and start tracing your runs today.
Prefer open source? Try Arize Phoenix for self-hosted, open source agent observability.
Key takeaways
- MAE is the average of absolute residuals:
MAE = (1/n) * sum(|y_i - y_hat_i|). - MAE treats every unit of error equally. Large and small misses contribute linearly, unlike MSE or RMSE.
- MAE is always less than or equal to RMSE on the same predictions. The gap between them signals how uneven your errors are.
- MAE is scale dependent. Compare it to the target’s spread, to your baseline model, and to the previous production version.
- MAE applies to numeric regression targets. It does not score generated text, classification labels, or ranking quality on its own.
How MAE is calculated
For each row, compute the residual e_i = y_i - y_hat_i. Take the absolute value and average:
MAE = (1/n) * sum( |y_i - y_hat_i| )
Example: actual delivery times of 2.0, 5.0, and 4.0 hours against predictions of 3.0, 5.0, and 2.5. Residuals are 1.0, 0.0, and 1.5. MAE is (1.0 + 0.0 + 1.5) / 3 = 0.833 hours.
In Python with NumPy:
import numpy as np
mae = np.mean(np.abs(y_true - y_pred))
MAE is also called L1 loss when you use it as the objective during training. Minimizing L1 loss pushes the model toward the conditional median of the target rather than the conditional mean, which MSE and RMSE favor.
MAE compared to MSE and RMSE
All three metrics rank models similarly when errors are symmetric and well behaved, but they answer different questions about cost.
MSE squares residuals before averaging. One large miss can dominate the number. Use MSE or RMSE when big errors are disproportionately costly: capacity overruns, safety margins, service-level breaches.
MAE keeps error linear. Ten errors of size one contribute the same as one error of size ten. Use MAE when cost scales roughly with distance and when outliers or label noise should not steer the headline metric.
RMSE is the square root of MSE, so it returns to the target’s units. RMSE is always at least as large as MAE on the same data. When the ratio RMSE / MAE climbs, a handful of large residuals are carrying the story. Sort residuals descending before you retrain.
Mean absolute percentage error (MAPE) is the percentage equivalent of MAE. It expresses error relative to the actual value, which helps when targets vary widely in scale. MAPE inherits MAE’s linear treatment of magnitude but adds sensitivity near zero actuals, so the same caveats about outliers and bad rows apply in both metrics.
When MAE is the right choice
MAE fits problems where being off by five dollars is five times as bad as being off by one dollar, not twenty-five times worse. Common cases:
- Revenue or count forecasts where leadership wants “typical miss” in dollars or units.
- Noisy labels from sensors, crowdsourced tags, or rounded reporting. MAE does not let one suspect row rewrite the score.
- Monitoring dashboards where you track error drift over time. A stable MAE on a fixed holdout set is easy to explain in a release review.
Pair MAE with segment-level views. Aggregate MAE can hold steady while one cohort degrades, which is why production teams watch model and concept drift alongside the headline number. If training distribution shifts but MAE looks fine on yesterday’s aggregate, slice by region, product line, or customer tier before you ship.
Where MAE misleads
Symmetric treatment of over- and under-prediction. MAE treats +3 and -3 the same. If over-forecasting inventory is cheaper than stockouts, MAE hides that asymmetry. Use a weighted variant or a quantile loss aligned to business cost.
Scale dependence. MAE of 2 on temperature in Celsius and MAE of 2 on revenue in thousands are not comparable. Normalize, or report MAE as a fraction of a baseline such as the target’s standard deviation.
Zeros and small denominators in related metrics. MAE itself has no division by the target, but teams often pair it with MAPE. MAPE blows up when actuals are near zero. Keep MAE for the core regression score and treat percentage metrics as a secondary view.
Text and classification. MAE needs numeric predictions and numeric labels. An LLM’s answer string has neither. Numeric fields an agent extracts can use MAE; prose quality needs separate evaluators. That split shows up in NLP monitoring workflows where regression heads and classifiers share a pipeline but not one metric.
MAE in the model lifecycle
During training, log MAE on validation data each epoch alongside your loss. Before promotion, recompute MAE on a frozen holdout set and compare to the model in production. After deploy, track MAE on labeled backtests and proxy metrics where labels arrive late.
Store the holdout MAE with the model artifact in your registry. When someone asks whether version 14 regressed, you want the same split and the same preprocessing, not a fresh random sample. AI model lifecycle management practices treat that baseline as part of the release record, not an ad hoc notebook output.
FAQ
What is the formula for mean absolute error?
MAE = (1/n) * sum(|y_i - y_hat_i|). Average the absolute differences between predictions and actuals. The result uses the same units as the target.
What is a good MAE value?
There is no universal threshold. Compare MAE to predicting the mean of the target (which equals the mean absolute deviation from the mean), to RMSE on the same split, and to the previous model version. Improvement relative to your baseline matters more than the raw number.
What is the difference between MAE and mean absolute deviation?
Mean absolute deviation usually describes spread around a sample mean: (1/n) * sum(|x_i - x_bar|). MAE applies the same calculation to prediction residuals. When you predict the constant mean for every row, your MAE equals the mean absolute deviation of the target.
Should I use MAE or RMSE?
Use RMSE when large errors should count more than small ones. Use MAE when error cost is roughly linear and when outliers should not dominate the score. Reporting both is cheap and the ratio between them is informative.
Can MAE be used for time series forecasting?
Yes. Compute MAE on held-out future periods using the same horizon you run in production. Do not shuffle time series rows when you split. Walk-forward validation keeps the metric honest about what the model would have seen on deploy day.