---
date: '2024-01-11'
description: in information theory
id: Entropy
modified: 2026-06-05 15:08:29 GMT-04:00
tags:
  - seed
title: Entropy
created: '2024-01-11'
published: '2024-01-11'
pageLayout: default
slug: thoughts/Entropy
permalink: https://aarnphm.xyz/thoughts/Entropy.md
generator:
  quartz: v4.6.0
  hostedProvider: Cloudflare
  baseUrl: aarnphm.xyz
full: https://aarnphm.xyz/llms-full.txt
---
<article class="twitter-post" data-twitter-source="https://x.com/karpathy/status/1632800082679705600"><span class="twitter-post-badge" role="img" aria-label="Twitter post" title="Twitter post"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="64 64 896 896" fill="currentColor" stroke="none" stroke-width="0" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M928 254.3c-30.6 13.2-63.9 22.7-98.2 26.4a170.1 170.1 0 0075-94 336.64 336.64 0 01-108.2 41.2A170.1 170.1 0 00672 174c-94.5 0-170.5 76.6-170.5 170.6 0 13.2 1.6 26.4 4.2 39.1-141.5-7.4-267.7-75-351.6-178.5a169.32 169.32 0 00-23.2 86.1c0 59.2 30.1 111.4 76 142.1a172 172 0 01-77.1-21.7v2.1c0 82.9 58.6 151.6 136.7 167.4a180.6 180.6 0 01-44.9 5.8c-11.1 0-21.6-1.1-32.2-2.6C211 652 273.9 701.1 348.8 702.7c-58.6 45.9-132 72.9-211.7 72.9-14.3 0-27.5-.5-41.2-2.1C171.5 822 261.2 850 357.8 850 671.4 850 843 590.2 843 364.7c0-7.4 0-14.8-.5-22.2 33.2-24.3 62.3-54.4 85.5-88.2z"></path></svg></span><header class="twitter-post-header"><span class="twitter-post-author">@karpathy</span><time datetime="2023-03-06">2023-03-06</time><a class="twitter-post-source" href="https://x.com/karpathy/status/1632800082679705600" target="_blank" rel="noopener noreferrer" aria-label="Open original post (opens in a new tab)" title="Open original post" data-skip-icons="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M7 17 17 7M7 7h10v10"></path></svg></a></header><div class="twitter-post-body">
			
				
					<p>In particular, "good, aligned, conversational AI" is just one of many possible different rollouts. Finetuning / alignment tries to "collapse" and control the entropy to that region of the simulator. Jailbreak prompts try to knock the state into other logprob ravines.</p>
				
			
			
		</div></article>

idea: quantifies average level of uncertainty information associated with a variable’s potential states or possible outcome.

> \[!definition\] Definition 1.
>
> Given a discrete random variable $X$, which takes a value in a set $\mathcal{X}$ distributed according to $p : \mathcal{X} \to [0,1]$, the entropy $H(X)$ is defined as
>
> $$
> H(X) \coloneqq - \sum_{x \in \mathcal{X}} p(x) \log p(x)
> $$

Base 2 gives unit of “bits” (or “shannons”), while natural base gives “natural units” (or “nat”), and base 10 gives unit of “dits” (or “bans”, or “hartleys”)

## The Waluigi Effect

[_source_](https://www.lesswrong.com/posts/D7PumeYTDPfBTp3i7/the-waluigi-effect-mega-post)

talks more about the semiotic phenomena which arise within LLMs, and how hallucination come to be.

## joint

_measure of uncertainty associated with a set of variables_

namely, the joint _Shannon entropy_,

> \[!definition\] Definition 2. joint _Shannon entropy_
>
> in bits, of two discrete random variable $X$ and $Y$ with images $\mathcal{X}$ and $\mathcal{Y}$ is defined as:
>
> $$
> H(X,Y) = - \sum_{x \in \mathcal{X}} \sum_{y \in \mathcal{Y}} P(x,y) \log_2 [P(x,y)]
> $$
>
> where $P(x,y)$ is the joint probability of both $X$ and $Y$ occurring together.

For more than two random variables, this expands onto:

$$
H(X_{1},\ldots,X_{n}) = - \sum_{x_{1} \in \mathcal{X}_{1}} \cdots \sum_{x_{n} \in \mathcal{X}_{n}} P(x_{1},\ldots,x_{n}) \log_2 [P(x_{1},\ldots,x_{n})]
$$

