TL;DR
The coefficient of variation, or CV, is the standard deviation divided by the mean. It answers the question "how big is the spread compared with the typical size of the values?" Because the units cancel, the result is a plain number, often shown as a percentage.
That makes it useful for comparing variability between things measured in different units or at different scales, where the raw standard deviation would mislead you.
Where you'll see it: in quality control and lab reports to compare instrument precision, in finance to compare the volatility of assets with different prices, and in machine learning to check whether the work is spread evenly across parts of a system, such as the experts in a mixture-of-experts layer.
Intuition
Spread relative to size
A standard deviation of 5 means very different things depending on what is being measured. If a bridge deflects by 5 millimetres on average, that is small. If a sprinter's times vary by 5 seconds, that is huge. The number 5 alone does not tell you how much the values wobble. You also need to know how big the values are in the first place.
The CV fixes this by dividing by the typical size, the mean. A spread of 5 around a mean of 10 is a large relative wobble, a CV of one half. The same spread of 5 around a mean of 500 is tiny, a CV of one per cent. The arithmetic is simple, but the question it answers is the one people usually care about: is this variable steady or jumpy, given what it normally is?
Mean and variance give you the centre and the spread. The CV combines them into a single relative figure. It is not a different kind of measurement. It is the same spread, rescaled so that the result does not depend on the units.
flowchart LR
D[data values] --> M[mean: typical size]
D --> S[standard deviation: spread]
M --> R[divide spread by size]
S --> R
R --> CV[coefficient of variation: unit-free spread]
The math
Definition
For a random variable with mean and standard deviation , the coefficient of variation is
Here is the mean, the average value of , and is the standard deviation, the square root of the variance. The ratio has no units, because the units of and are the same and cancel.
For a sample of values with sample mean , the usual estimate is
Here is the sample standard deviation. The divisor is the usual correction for estimating the spread from a sample. Some texts use instead, and the choice matters only for small samples.
Two properties
The first property is scale invariance. If every value is multiplied by a constant , the mean becomes and the standard deviation becomes . The CV is unchanged:
Changing units, for example from metres to feet, leaves the CV alone. Changing the currency does too.
The second property is that the CV is defined only when the mean is not zero, and it is meaningful only when the variable is positive. If the mean is near zero, a small change in the mean makes the CV swing wildly. For a variable that takes both signs, the CV can be misleading and another measure is usually better.
Gaussian case
If with , the CV is . The bell curve has a fixed shape, so the CV alone tells you how wide that bell is relative to its centre. A CV of gives a narrow curve with almost all values within 30 per cent of the mean, since covers . A CV of gives a curve so wide that a large share of values would be negative, which is a warning that a Gaussian is a poor model for a positive quantity at that spread.
- CV = 0.2
- CV = 0.5
Worked examples
Two thermometers measure the same kind of quantity, but on different scales.
- Instrument A reads a mean of with standard deviation .
- Its CV is , or 5 per cent.
- Instrument B reads a mean of with standard deviation .
- Its CV is , or 15 per cent.
- Interpretation: B has the smaller absolute spread, against , but the larger relative spread. Judged by the size of its readings, B is the noisier instrument. Comparing raw standard deviations would have ranked them the other way.
Take five prices in dollars: .
- The mean is .
- The deviations from the mean are . Their squares are , summing to .
- The sample variance is , so .
- The CV is , or about 32 per cent.
- Now express the same prices in cents: . The mean is and the standard deviation is . The CV is . The number is the same, because multiplying by 100 cancels out.
A mixture-of-experts layer sends each token to one of four experts. In one batch the counts are . A perfectly even split would be .
- For the uneven counts, the mean is .
- The deviations are , with squares , summing to .
- The sample variance is , so .
- The CV is .
- For the even split the CV is . A larger CV means the experts are working unevenly, which is the quantity a load-balancing penalty tries to push toward zero.
Tradeoffs and failure modes
The CV is quick and scale-free, which makes it a good first look at variability. It has limits that matter in practice.
| Situation | Problem | Better choice |
|---|---|---|
| Mean near zero | CV explodes or flips sign | Use the standard deviation, or a measure centred on the median |
| Values can be negative | Ratio has no clear meaning | Use the standard deviation or the interquartile range |
| Small sample | Estimate of is noisy, so the CV is too | Report a confidence interval, or use more data |
| Skewed data | Mean and standard deviation are pulled by outliers | Use the median and the quartile coefficient of dispersion |
| Comparing variables with different natures | CV says nothing about shape | Look at the full distribution |
Two common mistakes are worth naming. The first is comparing CVs of variables whose means are on different natural scales, such as a temperature in degrees Celsius, where zero is arbitrary. Dividing by the mean is only meaningful when zero means "none of the quantity". The second is treating a low CV as proof that a measurement is accurate. The CV describes spread, not bias. A precise instrument with an offset has a small CV and is still wrong.
History
The coefficient of variation was introduced by the statistician Karl Pearson in the 1890s, as part of his work on biological variation and heredity. Pearson wanted a way to compare variability between traits measured in different units, and the ratio of the standard deviation to the mean gave him one. Biologists adopted it because it let them ask whether one population was more variable than another, independent of its typical size.
The term spread through statistics textbooks in the twentieth century and into engineering, finance and quality control, where it became a standard way to report relative error and volatility. In machine learning, the same quantity has reappeared as a diagnostic. Shazeer et al. (2017) used the square of the coefficient of variation, applied to per-expert importance and load values over a batch and scaled by a hand-tuned weight, as an auxiliary loss that pushes a sparsely-gated mixture-of-experts layer toward an even split across experts. Later work such as Switch Transformers uses a different balancing loss, but the goal is the same.
Check yourself
QuestionRecall: what does the coefficient of variation divide by what?Show answer
It divides the standard deviation by the mean. The result is a ratio with no units, which is why it can be compared across variables measured on different scales.
QuestionComputation: a dataset has mean and standard deviation . What is its CV, and what does it mean?Show answer
The CV is , or 24 per cent. The spread is about a quarter of the typical value. That is a moderate relative spread, and it is the figure to compare with other datasets of different size.
QuestionWhy: why does multiplying every value by 100 leave the CV unchanged?Show answer
Multiplying the values by multiplies the mean by and the standard deviation by . The ratio simplifies to , so the factor cancels. The CV depends only on the shape of the spread relative to the centre, not on the unit used to measure it.
QuestionApplied: a monitoring team sees that the CV of request latency for one server is , while the others are near . The mean latency for that server is also close to zero. What should they conclude first?Show answer
They should not conclude yet that the server is much more variable. Because the mean is close to zero, the CV is inflated, and a small change in the mean produces a large change in the ratio. They should check whether the mean is genuinely small or near zero because of a measurement issue, and compare the raw standard deviation as well. Once the mean is reliable, the CV can be used to compare servers again.
Sources
- Wikipedia, Coefficient of variation. https://en.wikipedia.org/wiki/Coefficient_of_variation
- Wikipedia, Standard deviation. https://en.wikipedia.org/wiki/Standard_deviation
- Shazeer, N. et al. (2017). Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. https://arxiv.org/abs/1701.06538