# 熵（信息论）

**熵**在信息论中是随机变量的期望信息量：对于概率为 \( p_1, \ldots, p_n \) 的离散分布，它是 \( H(X) = -\sum_i p_i \log p_i \)，即结果的平均不确定性。克劳德·香农（Claude Shannon）在1948年的论文《通信的数学理论》（*A Mathematical Theory of Communication*）中引入了这个量，把它写作 \( H = -\sum p_i \log p_i \)，并明确将它与统计力学中的玻尔兹曼H函数联系起来；同一篇论文首次使用了“比特”一词<sup>[1](https://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf)</sup>。使用以2为底的对数时，熵以比特计量，并且是描述该随机变量平均所需比特数的下界<sup>[2](https://pages.hmc.edu/ruye/book2/ElementsofInformationTheory.pdf)</sup>。其实际意义由香农编码定理确定：任何无损码平均而言都不能把信源压缩到其熵以下<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | \( H(X) = -\sum_i p_i \log_2 p_i \)；各结果的期望信息，以比特计<sup>[4](https://web.mit.edu/6.02/www/s2012/handouts/23.pdf)</sup> |
| 公平硬币 | 一个二元变量的熵介于0与1香农（Sh）之间，仅当 \( p = 1/2 \) 时达到1<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup> |
| 压缩极限 | 信源可被可靠编码的最小速率等于 \( H(X) \)<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup> |
| 单位 | 1奈特 \( = \log_2 e \approx 1.44 \) 比特；1班（哈特利） \( = \log_2 10 \approx 3.32 \) 比特；1字节 = 8比特<sup>[5](https://threeplusone.com/pubs/on_information.pdf)</sup> |
| 微分熵 | \( h(X) = -\int \rho(x) \log \rho(x)\, dx \)；它可以为负，对于常数则为 \( -\infty \)<sup>[6](https://arxiv.org/html/2503.02921)</sup><sup> • </sup><sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup> |
| 最大熵 | 在均值与方差固定时为高斯分布，\( h = \log\sqrt{2\pi\sigma^2} + \tfrac{1}{2}\log e \)<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup> |
| 估计偏差 | 代入估计量有负偏差，需要 \( n \log n \) 个样本才能达到极小极大估计量用 \( n \) 个样本达到的效果<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup> |

## 定义、公理与性质

熵是为取值为 \( x_i \)、概率为 \( p_i \) 的离散随机变量定义的。约定 \( 0 \log 0 = 0 \) 由连续性保证，因为当 \( x \to 0 \) 时 \( x \log x \to 0 \)<sup>[2](https://pages.hmc.edu/ruye/book2/ElementsofInformationTheory.pdf)</sup>。这个公式并非任意：A. I. 辛钦（A. I. Khinchin）在1957年证明，四条公理确立了这种函数形式的唯一性；常被用作公理的性质包括非负性（\( H(P) \ge 0 \)）、可扩展性、对称性，以及在固定 \( n \) 下的连续性<sup>[8](https://ar5iv.labs.arxiv.org/html/2503.15660)</sup><sup> • </sup><sup>[9](https://www.mdpi.org/entropy/papers/e10030261.pdf)</sup>。

进一步的结构性质是可加性，\( H(P \times Q) = H(P) + H(Q) \)；次可加性，\( H(X, Y) \le H(X) + H(Y) \)；以及强可加性，即链式法则 \( H(X, Y) = H(X) + H(Y \mid X) \)<sup>[9](https://www.mdpi.org/entropy/papers/e10030261.pdf)</sup>。链式法则给出香农直接陈述的一个性质：知道 \( x \) 绝不会增加 \( y \) 的不确定性；除非 \( x \) 与 \( y \) 独立（此时不变），否则它会减少<sup>[1](https://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf)</sup>。

## 相关量：联合熵、条件熵、互信息、交叉熵与KL散度

互信息度量两个变量共享的信息。离散情形下 \( I(X; Y) = H(X) - H(X \mid Y) \)，连续情形下 \( I(X; Y) = h(X) - h(X \mid Y) \)<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。

**KL散度。** 相对熵或库尔贝克-莱布勒散度，\( D(A \parallel B) = \sum_x P(A_x) \ln \frac{P(A_x)}{P(B_x)} \)，度量两个分布之间的差异。它在离散和连续情形下都非负，但它不是度量：它不对称，也不满足三角不等式<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup><sup> • </sup><sup>[5](https://threeplusone.com/pubs/on_information.pdf)</sup>。它有一种编码成本解读：当消息实际按分布 \( A \) 到达时，用对 \( B \) 最优的编码来编码消息，平均每条消息要多花 \( D(A \parallel B) \) 奈特<sup>[5](https://threeplusone.com/pubs/on_information.pdf)</sup>。

**交叉熵。** 交叉熵是使用对 \( P(B_x) \) 最优的编码方案时，识别以概率 \( P(A_x) \) 发生的事件平均所需的比特数；当 \( A \) 的熵固定时，最小化交叉熵等价于最小化相对熵<sup>[5](https://threeplusone.com/pubs/on_information.pdf)</sup>。它始终非负，但同样不对称，也不是真正的度量<sup>[8](https://ar5iv.labs.arxiv.org/html/2503.15660)</sup>。

## 微分熵与最大熵原理

对于密度为 \( \rho \)、支撑集为 \( S \) 的连续随机变量，微分熵用积分代替求和：\( h(X) = -\int_S \rho(x) \log \rho(x)\, dx \)<sup>[6](https://arxiv.org/html/2503.02921)</sup>。与离散情形不同，它没有非负性：可以是负实数<sup>[8](https://ar5iv.labs.arxiv.org/html/2503.15660)</sup><sup> • </sup><sup>[6](https://arxiv.org/html/2503.02921)</sup>。对于长度小于1的区间上的均匀分布，它会变成负数；对于确定性常数 \( X = c \)，它等于 \( -\infty \)，而常数的离散熵只是0<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。由于这些原因，微分熵不能赋予“信息量”的解释；连续变量的精细量化需要任意高的编码速率<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。

**最大熵。** E. T. 杰恩斯（E. T. Jaynes）利用香农的框架建立了最大熵原理：最不偏不倚的概率分配，是在可用信息的约束下使熵最大的那个分配<sup>[8](https://ar5iv.labs.arxiv.org/html/2503.15660)</sup>。由此得到的分布由约束决定。对于均值 \( \mu \) 和方差 \( \sigma^2 \) 固定的连续变量，最大值由正态分布取得，其值为 \( \log\sqrt{2\pi\sigma^2} + \tfrac{1}{2}\log e \)<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。

## 实践中的熵估计

代入（最大似然）估计量用经验频率代替 \( p_i \)，当 \( n \to \infty \) 时几乎必然收敛到 \( H(X) \)，但在有限样本下它有负偏差：除确定性情形外，\( E[\hat{H}] < H(X) \)<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup>。在大字母表上偏差可观，因为 \( f(p) = p \log p \) 在0处的右导数无穷大，所以小概率的经验估计中的误差会转化为大误差<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup>。

样本量要求有精确的界限。要匹配极小极大估计量用 n 个样本达到的精度，代入方法需要 n log n 个样本。<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup> 多布鲁申（Dobrushin）1958年的想法是把符号分为频繁和不频繁两类，对后者取出现间隔时间对数的平均，用 \( 2n \) 次观测达到代入估计量用 \( n \log n \) 次观测获得的性能<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup>。对于无限支撑的分布，安托斯（Antos）和孔托扬尼斯（Kontoyiannis）证明，除非限制概率质量函数类，否则对任意估计量序列，最坏情况收敛速率都可以任意慢<sup>[7](https://www.mdpi.com/1099-4300/21/8/720)</sup>。在机器学习中，常用估计量对高维样本往往无效，这限制了信息论方法；近期的应对包括基于矩阵的 LogDet 估计量，其存储量线性增长<sup>[10](https://dl.acm.org/doi/10.1016/j.neucom.2025.131520)</sup>，以及 REMEDI（ICML 2024），它将对自适应基模型的交叉熵最小化与估计这些模型相对于数据密度的相对熵偏差结合起来<sup>[11](https://proceedings.mlr.press/v235/nilsson24a.html)</sup>。

## 用数字说明

- 公平掷硬币的熵恰好为1比特<sup>[2](https://pages.hmc.edu/ruye/book2/ElementsofInformationTheory.pdf)</sup>；任何二元变量的熵介于0和1香农（Sh）之间，仅在 \( p = 1/2 \) 时达到1<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。
- 对于在均匀分布下熵达到最大值的 \( M \) 元变量，冗余为 \( D(X, X^*) = \log M - H(X) \)，即最大可能熵与实际熵之间的差距<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。
- 香农1951年对印刷英语的研究把冗余表述为统计结构施加的约束，例如字母 E 的高频率，以及 H 倾向于跟在 T 后、V 倾向于跟在 Q 后<sup>[12](https://www.princeton.edu/~wbialek/rome/refs/shannon%5F51.pdf)</sup>。
- 使用词三元模型和布朗语料库（Brown Corpus）的一项1992年估计，通过交叉熵 \( H(P) \le H(P, M) \) 计算，给出印刷英语字符熵的上界为1.75比特<sup>[13](https://aclanthology.org/J92-1002.pdf)</sup>。

## 熵与其他不确定性度量的比较

熵不依赖于随机变量取值的度量结构，因此不能与方差比较，方差度量的是另一种不确定性<sup>[14](http://scholarpedia.org/article/Entropy)</sup>。方差描述取值空间中围绕均值的散布；熵描述结果有多不可预测。

雷尼（Rényi）族把香农熵推广为 \( H_q(X) = \frac{1}{1-q} \ln \left( \sum_x p(x)^q \right) \)，其中 \( q > 0 \)，\( q \ne 1 \)，并令 \( H_1(X) := \lim_{q \to 1} H_q(X) = H(X) \)<sup>[15](https://ar5iv.labs.arxiv.org/html/2202.03108)</sup>。雷尼在1960年引入它，目的是寻找保持独立事件可加性的最一般信息度量<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。作为 \( q \) 的函数，\( H_q \) 非增：\( H_0 \) 是哈特利熵 \( \ln|\Gamma| \)，\( H_2 = -\ln \sum_x p(x)^2 \) 是碰撞（二次）熵，\( H_\infty = -\ln(\max_x p(x)) \) 是最小熵<sup>[15](https://ar5iv.labs.arxiv.org/html/2202.03108)</sup>。最小熵，\( H_\infty(X) = -\log_2 \max_i P_X(x_i) \)，是最保守的不确定性度量，完全由最可能的结果决定，并且是密码学和随机性提取中所用的熵，在那里它量化可从信源提取的近乎均匀随机比特的数量<sup>[5](https://threeplusone.com/pubs/on_information.pdf)</sup>。察利斯熵（Tsallis entropy）最早由哈夫尔达（Havrda）和查尔瓦特（Charvát）引入，推广了玻尔兹曼-吉布斯统计力学，并已应用于重尾数据<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。

## 熵、热力学与第二定律

对于等概率结果，香农熵与玻尔兹曼的 \( S = k \log W \) 具有相同的对数形式，其中 \( k \) 是玻尔兹曼常数<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。共同的历史从路德维希·玻尔兹曼（Ludwig Boltzmann）和威拉德·吉布斯（Willard Gibbs）开始，他们在1875年前后把熵放入统计力学的概率框架，经过约翰·冯·诺依曼（John von Neumann）1932年向量子力学的推广，直到香农1948年把它引入概率论<sup>[14](http://scholarpedia.org/article/Entropy)</sup>。香农似乎是被冯·诺依曼说服，才把自己的量称为“熵”；冯·诺依曼已经在量子统计力学中给出了一个等价的迹形式熵。据称冯·诺依曼开玩笑说：“没有人真正知道熵到底是什么，所以在辩论中你总会占优势。”<sup>[16](https://arxiv.org/pdf/2407.08962)</sup><sup> • </sup><sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC8534765/)</sup>

这种联系不只是类比。利用热力学的利布-英瓦松（Lieb–Yngvason）公理框架，2016年《物理评论快报》（Physical Review Letters）的一篇论文严格连接了热力学熵和信息论熵<sup>[18](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.117.260601)</sup>。在利布-英瓦松的状态序下，平衡态的唯一热力学熵函数与冯·诺依曼熵一致，相应的非平衡量等于 \( H_{\min} \) 和 \( H_{\max} \)，因此在这个意义上，量子信息论可以看作热力学的一个实例<sup>[19](https://arxiv.org/html/1501.06920v2)</sup>。尽管如此，这两种熵有不同的操作定义：热力学熵按照克劳修斯（Clausius）的方式，通过给定温度下的热传递来定义；而香农熵刻画压缩长度，即存储数据所需的最小比特数<sup>[19](https://arxiv.org/html/1501.06920v2)</sup>。这种差异并不意味着一个对、一个错；它们有不同的用途<sup>[16](https://arxiv.org/pdf/2407.08962)</sup>。不同的熵概念在其他地方同样扮演不同角色：玻尔兹曼-吉布斯熵度量统计力学中的微观无序，柯尔莫哥洛夫-西奈（Kolmogorov–Sinai）熵度量动力系统中的伪随机性，拓扑熵度量拓扑动力学中的复杂性<sup>[15](https://ar5iv.labs.arxiv.org/html/2202.03108)</sup>。概率论教材中的一个提醒：“熵”常被宽松地用于本应称为过程的熵率的东西，而熵率与统计物理学的熵只有间接关系<sup>[20](https://www.stat.berkeley.edu/~aldous/205B/entropy_chapter.pdf)</sup>。

## 应用与近期进展

**压缩。** 香农第一编码定理指出，信源 \( X \) 可被可靠编码的最小速率等于 \( H(X) \)，这给出了任何数据压缩算法可能达到的最佳性能<sup>[3](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)</sup>。具体地说，无噪编码定理对霍夫曼（Huffman）编码给出 \( H(X) \le \bar{L} < H(X) + 1 \)，霍夫曼编码在唯一可译码中最小化平均码字长度；而通用伦佩尔-齐夫（Lempel–Ziv）压缩器在没有概率先验知识的情况下渐近达到熵界<sup>[15](https://ar5iv.labs.arxiv.org/html/2202.03108)</sup>。

**密码学。** 最小熵被用于研究哈希函数等密码原语、物理不可克隆函数（PUFs）等密码硬件，以及认证和秘密共享<sup>[21](https://www.mdpi.com/1099-4300/24/2/266)</sup>。

**机器学习。** 现代监督学习使用基于库尔贝克-莱布勒散度的交叉熵，作为训练分类器的代价函数<sup>[17](https://pmc.ncbi.nlm.nih.gov/articles/PMC8534765/)</sup>。

**自2023年以来。** 大语言模型已成为研究香农旧问题的工具。由于大语言模型返回完整的下一词元分布，而不是单一猜测，它可以在真实文本上玩香农的猜谜游戏，并直接计算大约 \( 10^3 \) 到 \( 10^4 \) 个词元序列上的条件熵估计；用模型对实际下一词元进行编码，得到的码长给出了文本条件熵的界<sup>[22](https://arxiv.org/html/2512.24969v1)</sup>。语义熵是计算采样得到的大语言模型响应的语义等价类上的香农熵，被用于不确定性量化；2025年的工作表明，在典型样本量下，标准离散语义熵会低估真实语义熵，原因是代入估计量的负偏差，并提出了一种借鉴种群生态学的覆盖调整字母表大小估计量，以减少这种偏差<sup>[23](https://arxiv.org/pdf/2509.14478)</sup>。对于整体大语言模型输出，按字母计算的香农熵很可能不是最佳估计；将输出建模为随机过程并使用熵率，可以计入词元之间的依赖关系<sup>[24](https://www.arxiv.org/pdf/2602.20052)</sup>。新的度量也在出现：外显复杂度（epiplexity）定义计算能力受限的观察者能从数据中提取的结构信息量，并用最终损失之上的损失曲线下面积作为启发式测量<sup>[25](https://arxiv.org/pdf/2601.03220)</sup>。

## References

1. [Claude E. Shannon (1948). A Mathematical Theory of Communication (full-text reprint)](https://people.math.harvard.edu/~ctm/home/text/others/shannon/entropy/entropy.pdf)
2. [Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (full text)](https://pages.hmc.edu/ruye/book2/ElementsofInformationTheory.pdf)
3. [Olivier Rioul (2018). This is IT: A Primer on Shannon's Entropy and Information Theory, Télécom Paris](https://perso.telecom-paristech.fr/rioul/publis/201811rioul.pdf)
4. [MIT 6.02 handout: Information, Entropy, and the Motivation for Source Codes](https://web.mit.edu/6.02/www/s2012/handouts/23.pdf)
5. [On Measures of Entropy and Information (monograph chapter)](https://threeplusone.com/pubs/on_information.pdf)
6. [Applications of Entropy in Data Analysis and Machine Learning: A Review (arXiv, 2025)](https://arxiv.org/html/2503.02921)
7. [Sergio Verdú (2019). Empirical Estimation of Information Measures: A Literature Guide. Entropy](https://www.mdpi.com/1099-4300/21/8/720)
8. [Entropy measures and their applications: A comprehensive review (2025, arXiv)](https://ar5iv.labs.arxiv.org/html/2503.15660)
9. [Axiomatic Characterizations of Information Measures. Entropy](https://www.mdpi.org/entropy/papers/e10030261.pdf)
10. [Understanding neural networks with logarithm determinant entropy estimator. Neurocomputing](https://dl.acm.org/doi/10.1016/j.neucom.2025.131520)
11. [REMEDI: Corrective Transformations for Improved Neural Entropy Estimation. ICML 2024](https://proceedings.mlr.press/v235/nilsson24a.html)
12. [Claude E. Shannon (1951). Prediction and Entropy of Printed English](https://www.princeton.edu/~wbialek/rome/refs/shannon%5F51.pdf)
13. [Peter F. Brown, Stephen A. Della Pietra, Robert L. Mercer (1992). An Estimate of an Upper Bound for the Entropy of English](https://aclanthology.org/J92-1002.pdf)
14. [Entropy. Scholarpedia](http://scholarpedia.org/article/Entropy)
15. [On entropy, entropy-like quantities, and applications (arXiv review)](https://ar5iv.labs.arxiv.org/html/2202.03108)
16. [On the naming and interpretation of Shannon entropy (arXiv, 2024)](https://arxiv.org/pdf/2407.08962)
17. [Entropy: From Thermodynamics to Information Processing (review, PMC)](https://pmc.ncbi.nlm.nih.gov/articles/PMC8534765/)
18. [Axiomatic Relation between Thermodynamic and Information-Theoretic Entropies. Physical Review Letters (2016)](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.117.260601)
19. [Axiomatic relation between thermodynamic and information-theoretic entropies (extended version, arXiv)](https://arxiv.org/html/1501.06920v2)
20. [David Aldous. Entropy chapter (UC Berkeley)](https://www.stat.berkeley.edu/~aldous/205B/entropy_chapter.pdf)
21. [The Odyssey of Entropy: Cryptography. Entropy (2022)](https://www.mdpi.com/1099-4300/24/2/266)
22. [Large language models and the entropy of English (arXiv)](https://arxiv.org/html/2512.24969v1)
23. [Revisiting discrete semantic entropy for LLM uncertainty quantification (arXiv)](https://arxiv.org/pdf/2509.14478)
24. [Entropy rates of LLM output (arXiv)](https://www.arxiv.org/pdf/2602.20052)
25. [Epiplexity: an information measure for computationally bounded observers (arXiv)](https://arxiv.org/pdf/2601.03220)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Random variables › Algebra and transformations of random variables › Functions of random variables

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/entropy-information-theory

English original: https://www.edgepedia.org/entropy-information-theory
