<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>Kl-Divergence on k4i's blog</title><link>https://k4i.top/zh/tags/kl-divergence/</link><description>Recent content in Kl-Divergence on k4i's blog</description><generator>Hugo -- gohugo.io</generator><language>zh</language><managingEditor>sky_io@outlook.com (K4i)</managingEditor><webMaster>sky_io@outlook.com (K4i)</webMaster><copyright>All content is subject to the license of &lt;a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank"&gt;CC BY-NC-SA 4.0&lt;/a&gt; .</copyright><lastBuildDate>Tue, 14 Jul 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://k4i.top/zh/tags/kl-divergence/index.xml" rel="self" type="application/rss+xml"/><item><title>Entropy、Cross Entropy 和 KL Divergence：从编码代价理解模型训练</title><link>https://k4i.top/zh/posts/entropy-cross-entropy-kl/</link><pubDate>Tue, 14 Jul 2026 10:00:00 +0800</pubDate><author>sky_io@outlook.com (K4i)</author><atom:modified>Tue, 14 Jul 2026 10:00:00 +0800</atom:modified><guid>https://k4i.top/zh/posts/entropy-cross-entropy-kl/</guid><description>&lt;p&gt;很多机器学习概念第一次看起来像三套公式：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;entropy：\(H(P)\)&lt;/li&gt;
&lt;li&gt;cross entropy：\(H(P,Q)\)&lt;/li&gt;
&lt;li&gt;KL divergence：\(D_{\mathrm{KL}}(P\Vert Q)\)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;这里的字母首先是一种约定，而不是公式推导出来的变量名。Shannon 在信息论奠基论文中用 \(H\) 表示 entropy；&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;为什么选 &lt;code&gt;H&lt;/code&gt; 没有公认的唯一解释，因此把它记作历史符号最准确。cross entropy 仍然衡量平均编码代价，是 entropy 的推广，所以沿用 \(H(P,Q)\)：第一个参数是真实分布，第二个是用于编码的分布。KL 使用 \(D\)，是为了强调它衡量两个分布之间的 &lt;strong&gt;divergence（偏离程度）&lt;/strong&gt;；但 divergence 不等于 metric，KL 不对称，也不满足三角不等式。&lt;/p&gt;</description><dc:creator>K4i</dc:creator><media:content url="https://k4i.top//images/icons/math-operators.png" medium="image"><media:title type="html">featured image</media:title></media:content><category>deep-learning</category><category>information-theory</category><category>cross-entropy</category><category>kl-divergence</category><category>loss-function</category><category>AI</category></item><item><title>KL Divergence 为什么不是距离：方向一换，问题就变了</title><link>https://k4i.top/zh/posts/kl-divergence-not-a-distance/</link><pubDate>Tue, 07 Jul 2026 10:00:00 +0800</pubDate><author>sky_io@outlook.com (K4i)</author><atom:modified>Tue, 07 Jul 2026 10:00:00 +0800</atom:modified><guid>https://k4i.top/zh/posts/kl-divergence-not-a-distance/</guid><description>&lt;p&gt;KL divergence 最容易被误读成“两个分布之间的距离”。这个说法有一半对：它确实在比较两个分布；但另一半很危险：&lt;strong&gt;KL 不是距离，因为方向有意义。&lt;/strong&gt; 更准确地说，KL 虽然满足非负性，而且只有 \(P=Q\) 时才为 0，却不满足 metric 要求的对称性和三角不等式。&lt;/p&gt;</description><dc:creator>K4i</dc:creator><media:content url="https://k4i.top//images/icons/math-operators.png" medium="image"><media:title type="html">featured image</media:title></media:content><category>deep-learning</category><category>kl-divergence</category><category>cross-entropy</category><category>rlhf</category><category>information-theory</category><category>AI</category></item></channel></rss>