<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Some stuff &#187; entropy</title>
	<atom:link href="http://blog.yhuang.org/?feed=rss2&#038;tag=entropy" rel="self" type="application/rss+xml" />
	<link>https://blog.yhuang.org</link>
	<description>here.</description>
	<lastBuildDate>Wed, 27 Aug 2025 08:50:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>entropy of English</title>
		<link>https://blog.yhuang.org/?p=1900</link>
		<comments>https://blog.yhuang.org/?p=1900#comments</comments>
		<pubDate>Sun, 15 Sep 2024 20:26:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bits]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[entropy]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[scaling]]></category>
		<category><![CDATA[Shannon]]></category>

		<guid isPermaLink="false">//blog.yhuang.org/?p=1900</guid>
		<description><![CDATA[This video on model scaling highlights an interesting point, which is to use the best models (nowadays LLM&#8217;s) to estimate the entropy rate of the source, in this case, the English language. This isn&#8217;t a new idea at all and empirical entropy measurements have been done in the past. What&#8217;s interesting is that past estimates [...]]]></description>
			<content:encoded><![CDATA[<p>This video on model scaling highlights an interesting point, which is to use the best models (nowadays LLM&#8217;s) to estimate the entropy rate of the source, in this case, the English language. This isn&#8217;t a new idea at all and empirical entropy measurements have been done in the past.</p>
<p><object type="application/x-shockwave-flash" width=560 height=315 data="//www.youtube.com/v/5eqRuVp65eY?start=509"><param name="movie" value="//www.youtube.com/v/5eqRuVp65eY?start=509" /><param name="FlashVars" value="playerMode=embedded" /></object></p>
<p>What&#8217;s interesting is that past estimates of bits per word of English have been way, way higher. Shannon&#8217;s <a href="https://cs.stanford.edu/people/eroberts/courses/soco/projects/1999-00/information-theory/entropy_of_english_9.html#:~:text=One%20possible%20way%20of%20calculating,or%20the%20entropy%20of%20English.">original estimates</a> are <strong>11.82</strong> bits per word, for example, or 2.62 bits per letter.<br />
<span id="more-1900"></span><br />
Some more recent estimates are understandably lower, like referenced in <a href="https://linguistics.stackexchange.com/a/8481/14936">this Stackoverflow answer</a>, which reports <strong>5.7</strong> bits per word. In this video we have the notion that the entropy of English is either undetectably low (which is impossible and suggests model overfit), or quite low, like 1.69 bits <em>per token</em> in <a href="https://arxiv.org/pdf/2203.15556">this DeepMind paper</a>.</p>
<p><img src="wp-content/uploads/images/deepmind_chichilla_entropy.png" width=100% border=0 /></p>
<p>Now, this video plays fast and loose with the units of what&#8217;s reported, so we need to be careful. What&#8217;s a token you say? <a href="https://genai.stackexchange.com/a/35">This Stackoverflow answer</a> says for several models it is &#8220;approximately 4 characters or 3/4 of a word&#8221;. This paper uses a research model called Chinchilla, and doesn&#8217;t say what is a token, but let&#8217;s take it to be the conventional 3/4 of a word. That makes the DeepMind result really <strong>2.25</strong> bits per word.</p>
<p>Then the next plot showing OpenAI&#8217;s GPT-4 performance from their <a href="https://arxiv.org/pdf/2303.08774">Technical Report</a> is even more extreme, showing, so far as I can tell from the graph, between 1.2 and 1.3 bits per word. Let&#8217;s say <strong>1.25</strong> bits per word then. At that entropy rate, each word disambiguates only about 2.4 possibilities on average!</p>
<p><img src="wp-content/uploads/images/openai_gpt4_entropy.png" width=100% border=0 /></p>
<p>That seems very, very low but &#8230; plausible. Perhaps a model of natural language semantic unit (not necessarily a word) tends to distinguish among 2 opposing possibilities, for easy mental processing, you know things like black vs. white, high vs. low, large vs. small. The extra 0.4 possibilities may be grammatical information that attaches as free-rider onto English words. Any lower than 2 possibilities per word seems improbably low and inefficient as a communication mechanism. So if these models are for real, we must be getting very very close to the true lower bound here, and consequently, optimal model performance on English language modeling. It also nicely confirms Shannon&#8217;s thesis (in my attribution) that any source is statistical, and merely by using larger and larger contexts, its generation can be arbitrarily realistic.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=1900</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>data structure problem</title>
		<link>https://blog.yhuang.org/?p=854</link>
		<comments>https://blog.yhuang.org/?p=854#comments</comments>
		<pubDate>Fri, 09 Mar 2012 04:50:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[entropy]]></category>
		<category><![CDATA[fraction]]></category>
		<category><![CDATA[mathbb]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[structure]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=854</guid>
		<description><![CDATA[Another problem by fakalin. A data structure has the entropy bound if all queries have amortized time , where is the fraction of the time that key is queried. It has the working-set property if the time to search for an element is , where is the number of elements queried since the last access [...]]]></description>
			<content:encoded><![CDATA[<p>Another problem by fakalin.</p>
<blockquote><p>A data structure has the entropy bound if all queries have amortized time \(O(\sum_k p_k \log 1/p_k)\), where \(p_k\) is the fraction of the time that key \(k\) is queried. It has the working-set property if the time to search for an element \(x_i\) is \(O(\log t_i)\), where \(t_i\) is the number of elements queried since the last access to \(x_i\). Prove that the working-set property implies the entropy bound.</p></blockquote>
<p>This isn&#8217;t really a data structure problem, per se.<br />
<span id="more-854"></span><br />
The general intuition here is that, if the waiting time between two queries to a key \(k\) is \(t(k)\), then key \(k\) ends up taking up about a \(p_k = 1/t(k)\) fraction of the queries, and therefore the average query time is about \(\sum_{k\in K} 1/t(k) (\log t(k))\).</p>
<p>While this is exactly true for evenly spaced-out queries, the general case only requires a slight modification using any of the rudimentary convex inequalities such as:</p>
<p><strong>Jensen&#8217;s inequality:</strong> If \(f\) is a convex function and \(X\) is a random variable, then \(\mathbb{E}f(X)\ge f(\mathbb{E}X)\).</p>
<p>(The proof just uses the definition of what a convex function is. Furthermore, if we recognize that \(-\log x\) is a convex function, then we get \(\mathbb{E}\log(X)\le \log(\mathbb{E}X)\), which restates the well-known fact that the geometric mean is less than or equal to the arithmetic mean of a collection of real numbers.)</p>
<p>Now, let \(N\) be the total number of queries. Let \(n(k)\) be the number of queries on key \(k\). Let \(t_i(k)\) be the time between the \(i\)th query on key \(k\) and the previous query on the same key. Let \(\bar{a}(k)< C \sum_{i=1}^{n(k)} \log t_i(k) / n(k)\) (for some \(C>0\)) be the <em>average</em> query time looking up key \(k\), as guaranteed by the working-set property (*). Let \(\bar{t}(k) = \sum_{i=1}^{n(k)} t_i(k) / n(k)\) be the <em>average</em> time between queries for key \(k\).</p>
<p>Note that we must have \(\bar{t}(k) \le N/n(k)\). Furthermore, \(p_k = n(k)/N\) by definition, hence \(\bar{t}(k) \le 1/p_k\) (**). The average query time over all keys is therefore:</p>
<p>\(\sum_k \bar{a}(k) n(k) / N\)<br />
\(< \sum_k [C \sum_{i=1}^{n(k)} \log t_i(k) / n(k)] [n(k) / N]\), by (*)<br />
\(\le C \sum_k [\log \sum_{i=1}^{n(k)} t_i(k) / n(k)] [n(k) / N]\), by Jensen&#8217;s inequality<br />
\(= C \sum_k [\log \bar{t}(k)] p_k\)<br />
\(\le C \sum_k p_k \log 1/p_k\), by (**)</p>
<p>∎</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=854</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
