In probability theory and theoretical computer science, McDiarmid's inequality (named after Colin McDiarmid [1]) is a concentration inequality which bounds the deviation between the sampled value and the expected value of certain functions when they are evaluated on independent random variables. McDiarmid's inequality applies to functions that satisfy a bounded differences property, meaning that replacing a single argument to the function while leaving all other arguments unchanged cannot cause too large of a change in the value of the function.
Statement
A function
satisfies the bounded differences property if substituting the value of the
th coordinate
changes the value of
by at most
. More formally, if there are constants
such that for all
, and all
,

McDiarmid's Inequality[2]—Let
satisfy the bounded differences property with bounds
.
Consider independent random variables
where
for all
.
Then, for any
,
![{\displaystyle {\text{P}}\left(f(X_{1},X_{2},\ldots ,X_{n})-\mathbb {E} [f(X_{1},X_{2},\ldots ,X_{n})]\geq \varepsilon \right)\leq \exp \left(-{\frac {2\varepsilon ^{2}}{\sum _{i=1}^{n}c_{i}^{2}}}\right),}](./dcec32c891eaf7e6f8fb7c99d8749928ad1636e1.svg)
![{\displaystyle {\text{P}}(f(X_{1},X_{2},\ldots ,X_{n})-\mathbb {E} [f(X_{1},X_{2},\ldots ,X_{n})]\leq -\varepsilon )\leq \exp \left(-{\frac {2\varepsilon ^{2}}{\sum _{i=1}^{n}c_{i}^{2}}}\right),}](./7e8acf5ba6be8dd3cf27f282bc328b17bfd23a93.svg)
and as an immediate consequence,
![{\displaystyle {\text{P}}(|f(X_{1},X_{2},\ldots ,X_{n})-\mathbb {E} [f(X_{1},X_{2},\ldots ,X_{n})]|\geq \varepsilon )\leq 2\exp \left(-{\frac {2\varepsilon ^{2}}{\sum _{i=1}^{n}c_{i}^{2}}}\right).}](./a60a6951869cfdf72d6bf5c6f1f2f2b38abef530.svg)
Extensions
Unbalanced distributions
A stronger bound may be given when the arguments to the function are sampled from unbalanced distributions, such that resampling a single argument rarely causes a large change to the function value.
McDiarmid's Inequality (unbalanced)[3][4]—Let
satisfy the bounded differences property with bounds
.
Consider independent random variables
drawn from a distribution where there is a particular value
which occurs with probability
.
Then, for any
,
![{\displaystyle {\text{P}}(|f(X_{1},\ldots ,X_{n})-\mathbb {E} [f(X_{1},\ldots ,X_{n})]|\geq \varepsilon )\leq 2\exp \left({\frac {-\varepsilon ^{2}}{2p(2-p)\sum _{i=1}^{n}c_{i}^{2}+{\frac {2}{3}}\varepsilon \max _{i}c_{i}}}\right).}](./855bb934c5e7f34c95fa713da1fd5e828ad36d07.svg)
This may be used to characterize, for example, the value of a function on graphs when evaluated on sparse random graphs and hypergraphs, since in a sparse random graph, it is much more likely for any particular edge to be missing than to be present.
Differences bounded with high probability
McDiarmid's inequality may be extended to the case where the function being analyzed does not strictly satisfy the bounded differences property, but large differences remain very rare.
McDiarmid's Inequality (Differences bounded with high probability)[5]—Let
be a function and
be a subset of its domain and let
be constants such that for all pairs
and
,

Consider independent random variables
where
for all
.
Let
and let
.
Then, for any
,

and as an immediate consequence,

There exist stronger refinements to this analysis in some distribution-dependent scenarios,[6] such as those that arise in learning theory.
Sub-Gaussian and sub-exponential norms
Let the
th centered conditional version of a function
be

so that
is a random variable depending on random values of
.
McDiarmid's Inequality (Sub-Gaussian norm)[7][8]—Let
be a function.
Consider independent random variables
where
for all
.
Let
refer to the
th centered conditional version of
.
Let
denote the sub-Gaussian norm of a random variable.
Then, for any
,
![{\displaystyle {\text{P}}\left(f(X_{1},\ldots ,X_{n})-m\geq \varepsilon \right)\leq \exp \left({\frac {-\varepsilon ^{2}}{32e\left\|\sum _{k\in [n]}\|f_{k}(X)\|_{\psi _{2}}^{2}\right\|_{\infty }}}\right).}](./40a7e2c7fc75956f303ed25c04ee7b1bf107ca93.svg)
McDiarmid's Inequality (Sub-exponential norm)[8]—Let
be a function.
Consider independent random variables
where
for all
.
Let
refer to the
th centered conditional version of
.
Let
denote the sub-exponential norm of a random variable.
Then, for any
,
![{\displaystyle {\text{P}}\left(f(X_{1},\ldots ,X_{n})-m\geq \varepsilon \right)\leq \exp \left({\frac {-\varepsilon ^{2}}{4e^{2}\left\|\sum _{k\in [n]}\|f_{k}(X)\|_{\psi _{1}}^{2}\right\|_{\infty }+2\varepsilon e\max _{k\in [n]}\left\|\|f_{k}(X)\|_{\psi _{1}}\right\|_{\infty }}}\right).}](./70ee2d217ef648fe22a5cf860623582e53091c4c.svg)
Refinements to McDiarmid's inequality in the style of Bennett's inequality and Bernstein inequalities are made possible by defining a variance term for each function argument. Let
![{\displaystyle {\begin{aligned}B&:=\max _{k\in [n]}\sup _{x_{1},\dots ,x_{k-1},x_{k+1},\dots ,x_{n}}\left|f(x_{1},\dots ,x_{k-1},X_{k},x_{k+1},\dots ,x_{n})-\mathbb {E} _{X_{k}}f(x_{1},\dots ,x_{k-1},X_{k},x_{k+1},\dots ,x_{n})\right|,\\V_{k}&:=\sup _{x_{1},\dots ,x_{k-1},x_{k+1},\dots ,x_{n}}\mathbb {E} _{X_{k}}\left(f(x_{1},\dots ,x_{k-1},X_{k},x_{k+1},\dots ,x_{n})-\mathbb {E} _{X_{k}}f(x_{1},\dots ,x_{k-1},X_{k},x_{k+1},\dots ,x_{n})\right)^{2},\\{\tilde {\sigma }}^{2}&:=\sum _{k=1}^{n}V_{k}.\end{aligned}}}](./312deb5dc1b54e6b3c651089e825980a2443a6a6.svg)
McDiarmid's Inequality (Bennett form)[4]—Let
satisfy the bounded differences property with bounds
.
Consider independent random variables
where
for all
. Let
and
be defined as at the beginning of this section.
Then, for any
,
![{\displaystyle {\text{P}}(f(X_{1},\ldots ,X_{n})-\mathbb {E} [f(X_{1},\ldots ,X_{n})]\geq \varepsilon )\leq \exp \left(-{\frac {\varepsilon }{2B}}\log \left(1+{\frac {B\varepsilon }{{\tilde {\sigma }}^{2}}}\right)\right).}](./7704caf7a037657bf4a425383f9885ca8a7596e6.svg)
McDiarmid's Inequality (Bernstein form)[4]—Let
satisfy the bounded differences property with bounds
. Let
and
be defined as at the beginning of this section.
Then, for any
,
![{\displaystyle {\text{P}}(f(X_{1},\ldots ,X_{n})-\mathbb {E} [f(X_{1},\ldots ,X_{n})]\geq \varepsilon )\leq \exp \left(-{\frac {\varepsilon ^{2}}{2\left({\tilde {\sigma }}^{2}+{\frac {B\varepsilon }{3}}\right)}}\right).}](./ea6a82ec74188846989046b43328b95a5eaa0a12.svg)
Proof
The following proof of McDiarmid's inequality[2] constructs the Doob martingale tracking the conditional expected value of the function as more and more of its arguments are sampled and conditioned on, and then applies a martingale concentration inequality (Azuma's inequality).
An alternate argument avoiding the use of martingales also exists, taking advantage of the independence of the function arguments to provide a Chernoff-bound-like argument.[4]
For better readability, we will introduce a notational shorthand:
will denote
for any
and integers
, so that, for example,

Pick any
. Then, for any
, by triangle inequality,
![{\displaystyle {\begin{aligned}&|f(x_{1\rightharpoondown n})-f(x'_{1\rightharpoondown n})|\\[6pt]\leq {}&|f(x_{1\rightharpoondown \,n})-f(x'_{1\rightharpoondown (n-1)},x_{n})|+c_{n}\\\leq {}&|f(x_{1\rightharpoondown n})-f(x'_{1\rightharpoondown (n-2)},x_{(n-1)\rightharpoondown n})|+c_{n-1}+c_{n}\\\leq {}&\ldots \\\leq {}&\sum _{i=1}^{n}c_{i},\end{aligned}}}](./e8a3d4618dccde1175f60e840012985638c2eb28.svg)
and thus
is bounded.
Since
is bounded, define the Doob martingale
(each
being a random variable depending on the random values of
) as
![{\displaystyle Z_{i}:=\mathbb {E} [f(X_{1\rightharpoondown n})\mid X_{1\rightharpoondown i}]}](./d282a3f3a353ad3afae9d483afcc6fbc0e62f27b.svg)
for all
and
, so that
.
Now define the random variables for each
![{\displaystyle {\begin{aligned}U_{i}&:=\sup _{x\in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},x,X_{(i+1)\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)},X_{i}=x]-\mathbb {[} f(X_{1\rightharpoondown (i-1)},X_{i\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}],\\L_{i}&:=\inf _{x\in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},x,X_{(i+1)\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)},X_{i}=x]-\mathbb {[} f(X_{1\rightharpoondown (i-1)},X_{i\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}].\\\end{aligned}}}](./6308d303b73a83754d872be0edcc317e817bea53.svg)
Since
are independent of each other, conditioning on
does not affect the probabilities of the other variables, so these are equal to the expressions
![{\displaystyle {\begin{aligned}U_{i}&=\sup _{x\in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},x,X_{(i+1)\rightharpoondown n})-f(X_{1\rightharpoondown (i-1)},X_{i\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}],\\L_{i}&=\inf _{x\in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},x,X_{(i+1)\rightharpoondown n})-f(X_{1\rightharpoondown (i-1)},X_{i\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}].\\\end{aligned}}}](./b12e9453887e3a63e513cc3eb6d88641987f6fe0.svg)
Note that
. In addition,
![{\displaystyle {\begin{aligned}U_{i}-L_{i}&=\sup _{u\in {\mathcal {X}}_{i},\ell \in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},u,X_{(i+1)\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}]-\mathbb {E} [f(X_{1\rightharpoondown (i-1)},\ell ,X_{(i+1)\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}]\\[6pt]&=\sup _{u\in {\mathcal {X}}_{i},\ell \in {\mathcal {X}}_{i}}\mathbb {E} [f(X_{1\rightharpoondown (i-1)},u,X_{(i+1)\rightharpoondown n})-f(X_{1\rightharpoondown (i-1)},l,X_{(i+1)\rightharpoondown n})\mid X_{1\rightharpoondown (i-1)}]\\&\leq \sup _{x_{u}\in {\mathcal {X}}_{i},x_{l}\in {\mathcal {X}}_{i}}\mathbb {E} [c_{i}\mid X_{1\rightharpoondown (i-1)}]\\[6pt]&\leq c_{i}\end{aligned}}}](./f4575c944d2aa6f26072f96a149dac22fa66cf81.svg)
Then, applying the general form of Azuma's inequality to
, we have
![{\displaystyle {\text{P}}(f(X_{1},\ldots ,X_{n})-\mathbb {E} [f(X_{1},\ldots ,X_{n})]\geq \varepsilon )=\operatorname {P} (Z_{n}-Z_{0}\geq \varepsilon )\leq \exp \left(-{\frac {2\varepsilon ^{2}}{\sum _{i=1}^{n}c_{i}^{2}}}\right).}](./4a5a67a03307a7983380121343d55e057618ac43.svg)
The one-sided bound in the other direction is obtained by applying Azuma's inequality to
and the two-sided bound follows from a union bound.
See also
References
- ^ McDiarmid, Colin (1989). "On the method of bounded differences". Surveys in Combinatorics, 1989: Invited Papers at the Twelfth British Combinatorial Conference: 148–188. doi:10.1017/CBO9781107359949.008. ISBN 978-0-521-37823-9.
- ^ a b
Doob, J. L. (1940). "Regularity properties of certain families of chance variables" (PDF). Transactions of the American Mathematical Society. 47 (3): 455–486. doi:10.2307/1989964. JSTOR 1989964.
- ^ Chou, Chi-Ning; Love, Peter J.; Sandhu, Juspreet Singh; Shi, Jonathan (2022). "Limitations of Local Quantum Algorithms on Random MAX-k-XOR and Beyond". 49th International Colloquium on Automata, Languages, and Programming (ICALP 2022). 229. Schloss Dagstuhl – Leibniz-Zentrum für Informatik: 41:13. arXiv:2108.06049. doi:10.4230/LIPIcs.ICALP.2022.41. Retrieved 8 July 2022.
- ^ a b c d Ying, Yiming (2004). "McDiarmid's inequalities of Bernstein and Bennett forms" (PDF). City University of Hong Kong. Retrieved 10 July 2022.
- ^ Combes, Richard (2015). "An extension of McDiarmid's inequality". arXiv:1511.05240 [cs.LG].
- ^ Wu, Xinxing; Zhang, Junping (April 2018). "Distribution-dependent concentration inequalities for tighter generalization bounds". Science China Information Sciences. 61 (4): 048105:1–048105:3. arXiv:1607.05506. doi:10.1007/s11432-017-9225-2. S2CID 255199895. Retrieved 10 July 2022.
- ^ Kontorovich, Aryeh (22 June 2014). "Concentration in unbounded metric spaces and algorithmic stability". Proceedings of the 31st International Conference on Machine Learning. 32 (2): 28–36. arXiv:1309.1007. Retrieved 10 July 2022.
- ^ a b Maurer, Andreas; Pontil, Pontil (2021). "Concentration inequalities under sub-Gaussian and sub-exponential conditions" (PDF). Advances in Neural Information Processing Systems. 34: 7588–7597. Retrieved 10 July 2022.