<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[The Computational Reader: Hamlet]]></title><description><![CDATA[Shakespeare's famous tragedy is also a pretty decent introduction to machine learning.]]></description><link>https://computationalreader.substack.com/s/hamlet</link><image><url>https://substackcdn.com/image/fetch/$s_!pHNx!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2413f5b4-e83e-44e3-ad39-619651affc06_541x541.png</url><title>The Computational Reader: Hamlet</title><link>https://computationalreader.substack.com/s/hamlet</link></image><generator>Substack</generator><lastBuildDate>Thu, 09 Apr 2026 05:48:41 GMT</lastBuildDate><atom:link href="https://computationalreader.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Seth]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[computationalreader@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[computationalreader@substack.com]]></itunes:email><itunes:name><![CDATA[Seth]]></itunes:name></itunes:owner><itunes:author><![CDATA[Seth]]></itunes:author><googleplay:owner><![CDATA[computationalreader@substack.com]]></googleplay:owner><googleplay:email><![CDATA[computationalreader@substack.com]]></googleplay:email><googleplay:author><![CDATA[Seth]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[10x your vibecoding with Hamlet]]></title><description><![CDATA[Profitable existential crises for AI engineers]]></description><link>https://computationalreader.substack.com/p/10x-your-vibecoding-with-hamlet</link><guid isPermaLink="false">https://computationalreader.substack.com/p/10x-your-vibecoding-with-hamlet</guid><dc:creator><![CDATA[Seth]]></dc:creator><pubDate>Thu, 02 Oct 2025 14:51:11 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/be61c414-f8bd-43c8-a1a5-0cd6de9cfb5a_750x501.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Last week, I covered how literature&#8217;s most famous existential crisis could be understood in computational terms. In his soliloquy &#8220;To be, or not to be&#8221;, Hamlet is working through an existential crisis; but also, if you squint a bit, it looks like he is working through a math problem. And not just any math problem, but specifically example 6.6 in the famous textbook&#8212;not quite as famous as <em>Hamlet</em>, but close&#8212;<em><a href="http://incompleteideas.net/book/the-book-2nd.html">Reinforcement Learning: An Introduction</a></em><a href="http://incompleteideas.net/book/the-book-2nd.html"> by Sutton and Barto</a>.</p><div class="digest-post-embed" data-attrs="{&quot;nodeId&quot;:&quot;95af46c7-3956-4404-885f-8739f44a7541&quot;,&quot;caption&quot;:&quot;&quot;,&quot;cta&quot;:&quot;Read full story&quot;,&quot;showBylines&quot;:true,&quot;size&quot;:&quot;sm&quot;,&quot;isEditorNode&quot;:true,&quot;title&quot;:&quot;To be, or not to be, a computational question&quot;,&quot;publishedBylines&quot;:[{&quot;id&quot;:3232055,&quot;name&quot;:&quot;Seth&quot;,&quot;bio&quot;:null,&quot;photo_url&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4dc09aad-b26c-4ade-95a1-888ef2225f74_348x348.jpeg&quot;,&quot;is_guest&quot;:false,&quot;bestseller_tier&quot;:null}],&quot;post_date&quot;:&quot;2025-09-23T21:30:00.072Z&quot;,&quot;cover_image&quot;:&quot;https://substackcdn.com/image/fetch/$s_!QdfB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg&quot;,&quot;cover_image_alt&quot;:null,&quot;canonical_url&quot;:&quot;https://computationalreader.substack.com/p/to-be-or-not-to-be-a-computational&quot;,&quot;section_name&quot;:null,&quot;video_upload_id&quot;:null,&quot;id&quot;:173771481,&quot;type&quot;:&quot;newsletter&quot;,&quot;reaction_count&quot;:3,&quot;comment_count&quot;:4,&quot;publication_id&quot;:5536661,&quot;publication_name&quot;:&quot;The Computational Reader&quot;,&quot;publication_logo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!pHNx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2413f5b4-e83e-44e3-ad39-619651affc06_541x541.png&quot;,&quot;belowTheFold&quot;:false,&quot;youtube_url&quot;:null,&quot;show_links&quot;:null,&quot;feed_url&quot;:null}"></div><p>My ambition for that post was that a lover of literature might read it, and come away thinking: maybe, just maybe, mathematics has more to do with literature than they had previously supposed; that perhaps the language of mathematics can be used to articulate the enduring humanistic questions.</p><p>But what about a different kind of reader? One who does not love literature, but is instead a devoutly computational machine learning (ML) practitioner? The kind of reader who is not here to &#8220;articulate enduring questions&#8221;, but would rather solve problems and make money. <a href="https://substack.com/inbox/post/174127733">A reader who is on his sigma-grindset, an agentive 10x leetcoder who is 996ing his way out of the permanent underclass.</a> Does <em>Hamlet</em> have anything to offer him? (This reader is almost certainly a he.) </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ItDI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ItDI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ItDI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg" width="500" height="516" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:516,&quot;width&quot;:500,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54039,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/174841969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ItDI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 424w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 848w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!ItDI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4411b476-fb96-47bb-bd6a-4b419699d7fa_500x516.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">You don&#8217;t want to be like these NPCs not reading Hamlet, do you ML man?</figcaption></figure></div><p>Of course, one could also imagine a more sensible, even sympathetic, reader who asks the same question. Perhaps a first-generation college student, graduating with a Computer Science degree from a respectable-but-undistinguished land grant university, <a href="https://www.nytimes.com/2025/08/10/technology/coding-ai-jobs-students.html">concerned about making ends meet</a> in an <a href="https://digitaleconomy.stanford.edu/publications/canaries-in-the-coal-mine/">uncertain and ever-changing job market</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. Should he be reading <em>Hamlet</em>, or should he focus on coding exercises for his next job interview?</p><p>One takeaway for these readers could be: no, there&#8217;s no point reading any of that Shakespeare stuff, because Sutton &amp; Barto&#8217;s <em>Reinforcement Learning </em>has all the actionable insights. Well, maybe! But I suspect not. There are more unsolved machine learning problems in heaven and earth than are documented in Sutton &amp; Barto<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>; and a few of them are referenced in Shakespeare. Read Shakespeare and give yourself an edge over all those NPCs reading Sutton &amp; Barto!</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-lTC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-lTC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-lTC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg" width="300" height="325.2" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:542,&quot;width&quot;:500,&quot;resizeWidth&quot;:300,&quot;bytes&quot;:81472,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/174841969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-lTC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 424w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 848w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!-lTC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc7eb52b6-eda3-4cef-b9b8-d1d840a63604_500x542.jpeg 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">You, at your next FAANG interview.</figcaption></figure></div><p>To make this point, I have prepared a practical(ish) lesson, derived from <em>Hamlet</em>, which may of interest to the modern ML practitioner. The lesson is about imagination. Yes, that sounds kinda lame, but keep reading and you&#8217;ll see what I mean.</p><h2>To design an agent, you must imagine being the agent</h2><p>Your AI agent will see the world very differently than you will. If you want your agent to be &#8220;aligned&#8221; with your interests, you must try to imagine how the world will look to that agent. Something that seems to you, the human engineer, a trivial subtlety, may mean the world to the agent. </p><p>Let me give an example of one such subtlety. In <a href="https://computationalreader.substack.com/p/to-be-or-not-to-be-a-computational">my previous post</a>, I likened Hamlet&#8217;s &#8220;To be, or not to be&#8221; soliloquy to the &#8220;cliff walker&#8221; reinforcement learning problem in Sutton &amp; Barto. The point was to illustrate how Hamlet&#8217;s dilemma can be cast in explicitly computational terms. But in that essay, to make the point work, I actually made one crucial change to the original &#8220;cliff walk&#8221; problem. From the outside this modification may seem subtle; but to the agent, it means everything. </p><p>This modification is a change from <em>teleportation </em>to <em>resurrection</em>. In the Hamletized version of the cliff walk, the cliff is a <em>terminal state</em>. Once the agent steps off the cliff, that&#8217;s the end of the game. But so that he can learn from his experience stepping off the cliff, we <em>resurrect</em> the agent back at the beginning, atop the cliff. In the original cliff walk, this is different. The agent is not resurrected; he is <em>teleported </em>back to the original state. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TT9Y!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TT9Y!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 424w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 848w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 1272w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TT9Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png" width="1456" height="592" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:592,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54481,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/174841969?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TT9Y!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 424w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 848w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 1272w, https://substackcdn.com/image/fetch/$s_!TT9Y!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5859d6e3-2f92-4457-b0de-15f110e55116_1510x614.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">In the cliff walk problem, the agent suffers slings and arrows until they reach the stairs. In the Hamletized version, the agent may also escape punishment by stepping off the cliff; but in the original version, the agent is simply teleported back up to the top of the cliff.</figcaption></figure></div><p>This distinction between resurrection and teleportation<em> </em>may seem subtle. They both take the agent back to the top of the cliff, after all. But from the agent&#8217;s point of view, resurrection and teleportation present completely different problems. For the agent, there is only one reason to step off the cliff: avoiding the continual punishment he will incur if he walks along the cliff path. If the cliff simply teleports him back to the cliff path, then he has not avoided anything. The cliff has no appeal anymore, and the only way to stop the onslaught of punishment is to head for the stairs. </p><p>By replacing teleportation with resurrection, I, the programmer, have completely transformed the problem facing the agent. I have changed a very simple problem with a single obvious solution&#8212;get to the stairs&#8212;into a more complicated problem with multiple viable solutions: should<em> </em>the agent get to the stairs, or should the agent step off the cliff? If I, programmer and deployer of agents, am thinking only about how the agent should <em>obviously</em> get to the stairs, I may not even realize that I have made the cliff itself an attractive option. I may fail to imagine how the world I created looks to the agent I placed in it.</p><p>Of course, I made that change on purpose, so that I could write an essay about <em>Hamlet</em>. But I very well could have done that unintentionally, because I failed to imagine the consequences. In fact, I guarantee you that many a incautious coder has made such a mistake. After all, <a href="https://spacemath.gsfc.nasa.gov/weekly/6Page53.pdf">much smarter people than I have made much stupider mistakes</a>. </p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://computationalreader.substack.com/subscribe?"><span>Subscribe now</span></a></p><h2>Failures of imagination in agent deployment</h2><p><em>Hamlet</em> itself contains such a failure of imagination. The ghost of Hamlet&#8217;s father deploys Hamlet to the task of avenging his murder, but the ghost does not seem to understand what a horrible and punishing burden this places on his son. The ghost does not imagine that, maybe, this burden is so terrible that Hamlet might prefer &#8220;not to be&#8221;. This failure of imagination by the ghost very nearly derails the project of his vengeance.</p><p>Just like we punish the cliff walker to drive him promptly to the stairs, the ghost goes out of his way to emphasize how <em>completely unspeakably horrible</em> is the state of Denmark. He does this so that Hamlet will feel compelled to act:  </p><pre><code>GHOST:
O horrible, O horrible, most horrible! 
If thou hast nature in thee bear it not. 
Let not the royal bed of Denmark be 
A couch for luxury and damned incest.</code></pre><p>Well gosh, that sounds pretty horrible. Obviously this situation must be <em>unbearable</em> for Hamlet, because if it weren&#8217;t then he would <em>not have nature in him</em>. He doesn&#8217;t want to not have nature in him, does he? </p><p>To twist the knife a bit more, the ghost says:  </p><pre><code><code>GHOST:  
...duller thou shouldst be than the fat weed
That roots itself in ease on Lethe wharf
Wouldst thou not stir in this. </code></code></pre><p>What kind of loser is <em>duller than a fat weed</em>? So Hamlet better be stirring himself. And as we discussed before, <a href="https://computationalreader.substack.com/p/hamlet-is-an-ai-apocalypse-writ-small">Hamlet takes his father very, very seriously</a>.</p><p>But what was it that Hamlet must stir himself to? Ah, right: killing Claudius, who is Hamlet&#8217;s uncle, the current king of Denmark, and his step-father. Even if you hate the man, which Hamlet does, it is still not exactly an easy or pleasant task to kill your step-father. So Hamlet is caught between an intolerable present, unbearable for anyone with nature in them, and a miserable, bloody objective that may well alienate him from everybody he knows.</p><p>Little wonder that, like the cliff walker, Hamlet thinks: what if I just end things now? Instead of accomplishing my nominal goal, why not take the immediately available terminal state? I don&#8217;t think the ghost had this in mind when he deployed Hamlet to his vengeful task. The ghost was probably just thinking something like &#8220;gee, I&#8217;d really really like Hamlet to avenge me, so I should emphasize how bad it is not to avenge me&#8221;. He may not have imagined that, in doing so, he would drive his son to the brink of suicide.</p><h2>Yes, this is a real problem in AI deployment</h2><p>We do not currently have autonomous AI hitmen out there trying to commit regicide<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>. Accordingly, the exact scenario outlined above has not come up. But there is a very real problem with AI agents taking &#8220;shortcuts&#8221; that maximize their rewards without accomplishing the intended task. ML practitioners call this <a href="https://arxiv.org/abs/1606.06565">reward hacking</a>. </p><p>For example, imagine you want to use reinforcement learning to train a large language model (LLM) to solve a series of increasingly difficult math problems, which you wrote out in a file called <code>math_problems.txt</code>. You find that the LLM gets everything right on the first try. You solved mathematical intelligence! Then you realize the LLM is just reading the file <code>math_problem_answers.txt</code> that you left in the home directory.</p><p>Maybe this sounds like a silly example, but <a href="https://metr.org/blog/2025-06-05-recent-reward-hacking/">many smart</a> and <a href="https://arxiv.org/abs/1606.06565">rich and famous people</a> are worried about this kind of thing. As long as LLMs are doing nothing but generating text, this is no big deal. You can iterate and fine-tune and close loopholes as long as you need. But if you want AI to go out in the world and respond flexibly to novel situations&#8212;like those that arise when assassinating the king of Denmark, for example&#8212;then the problem of detecting and closing off loopholes will get massively, astronomically harder. The real world is full of cliffs for AI agents to walk off.</p><h2>Lessons from literature: alignment via imagination</h2><p>People sometimes describe the solution to reward hacking as one of <em>aligning</em> the values of the AI agents with our own. If the AI were <em>aligned</em> with our values, then the AI would simply not want to &#8220;reward hack&#8221;. Personally, I think this is backwards; human values are not a good target for alignment, because we don&#8217;t actually know what they are.</p><p>Unlike human values, the &#8220;values&#8221; of AI agents are concrete and well-defined, because <em>we specify them</em>. The tricky part is understanding the consequences of those values. So we must do our best to <em>imagine</em> ourselves as having those values we impart to our agents. If we are repulsed at what follows from our imaginings, then we should consider imparting different values.</p><p>So imagination is important. It is important for ghosts and important for AI engineers. But how do we develop our imagination? As it happens, <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;Henry Oliver&quot;,&quot;id&quot;:2432388,&quot;type&quot;:&quot;user&quot;,&quot;url&quot;:null,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!_Rhq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b38f8d-b41e-4a3d-b537-2d7b811be2e5_750x750.jpeg&quot;,&quot;uuid&quot;:&quot;d677165c-8f60-448a-b17c-497d4f76291d&quot;}" data-component-name="MentionToDOM"></span> at <span class="mention-wrap" data-attrs="{&quot;name&quot;:&quot;The Common Reader&quot;,&quot;id&quot;:120973,&quot;type&quot;:&quot;pub&quot;,&quot;url&quot;:&quot;https://open.substack.com/pub/commonreader&quot;,&quot;photo_url&quot;:&quot;https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com/public/images/ea7d5cdb-efea-4c9e-95fe-5c9325b14a29_210x210.png&quot;,&quot;uuid&quot;:&quot;3ce83588-c4e7-42a5-9084-468baa428974&quot;}" data-component-name="MentionToDOM"></span><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> argues that literature is a great way to train your imagination:</p><div class="comment" data-attrs="{&quot;url&quot;:&quot;https://open.substack.com/home&quot;,&quot;commentId&quot;:143207967,&quot;comment&quot;:{&quot;id&quot;:143207967,&quot;date&quot;:&quot;2025-08-07T21:34:54.580Z&quot;,&quot;edited_at&quot;:null,&quot;body&quot;:&quot;instead of telling people reading fiction is about developing empathy (ugh), we should tell them it's about imagination (the basis of morality, as Adam Smith said)\n\nif you want to understand someone, you don't need to empathise with them, you need to imagine their thoughts&quot;,&quot;body_json&quot;:{&quot;type&quot;:&quot;doc&quot;,&quot;attrs&quot;:{&quot;schemaVersion&quot;:&quot;v1&quot;},&quot;content&quot;:[{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;instead of telling people reading fiction is about developing empathy (ugh), we should tell them it's about imagination (the basis of morality, as Adam Smith said)&quot;}]},{&quot;type&quot;:&quot;paragraph&quot;,&quot;content&quot;:[{&quot;type&quot;:&quot;text&quot;,&quot;text&quot;:&quot;if you want to understand someone, you don't need to empathise with them, you need to imagine their thoughts&quot;}]}]},&quot;restacks&quot;:52,&quot;reaction_count&quot;:438,&quot;attachments&quot;:[],&quot;name&quot;:&quot;Henry Oliver&quot;,&quot;user_id&quot;:2432388,&quot;photo_url&quot;:&quot;https://substackcdn.com/image/fetch/$s_!_Rhq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b38f8d-b41e-4a3d-b537-2d7b811be2e5_750x750.jpeg&quot;,&quot;user_bestseller_tier&quot;:100,&quot;userStatus&quot;:{&quot;bestsellerTier&quot;:100,&quot;subscriberTier&quot;:1,&quot;leaderboard&quot;:null,&quot;vip&quot;:false,&quot;badge&quot;:{&quot;type&quot;:&quot;bestseller&quot;,&quot;tier&quot;:100}}}}" data-component-name="CommentPlaceholder"></div><p>Of course I think Mr. Oliver is quite right about this. But a fuller argument will have to wait for another post.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading The Computational Reader! Subscribe for free to receive AI insights, ancient wisdom, and dank memes.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>You&#8217;ll note that the <a href="https://www.nytimes.com/2025/08/10/technology/coding-ai-jobs-students.html">anecdotal NYT reporting</a> is vastly more alarmist than the <a href="https://digitaleconomy.stanford.edu/publications/canaries-in-the-coal-mine/">data-driven analysis</a>. I&#8217;d generally trust the data-driven analysis more. But the goal is not to &#8220;pick a winner&#8221;. These two reports are both, in themselves, data points available to us; what matters is what they collectively tell us about the outside world.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Nor are they written of in Nathan Lambert&#8217;s excellent <em><a href="https://rlhfbook.com/">Reinforcement Learning from Human Feedback</a></em>, though perhaps that gets closer. I&#8217;m not sure about <a href="https://arxiv.org/abs/2412.05265">Kevin Murphy&#8217;s textbook</a>, but I suspect even CS majors will find Shakespeare an easier read.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>As far as I know, at least. Top labs are very secretive.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Mr. Oliver was kind enough to bless my ripping-off of his Substack title.</p></div></div>]]></content:encoded></item><item><title><![CDATA[To be, or not to be, a computational question]]></title><description><![CDATA[From Shakespeare to Sutton and Barto, some questions endure through the ages.]]></description><link>https://computationalreader.substack.com/p/to-be-or-not-to-be-a-computational</link><guid isPermaLink="false">https://computationalreader.substack.com/p/to-be-or-not-to-be-a-computational</guid><dc:creator><![CDATA[Seth]]></dc:creator><pubDate>Tue, 23 Sep 2025 21:30:00 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!QdfB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div><hr></div><p><em>Content warning: This post deals with the problem of suicide. It is not the pleasantest topic, but there is no writing about </em>Hamlet <em>without writing about suicide. If you are concerned that I am taking this heavy topic terribly lightly, then <a href="https://computationalreader.substack.com/p/hamlet-is-about-death-and-computation">please read my previous post</a> where I shall attempt to convince you of my sincerity.</em></p><div><hr></div><p><code>&#8220;To be or not to be; that is the question&#8221;</code> is perhaps the single most famous line in all of English literature. It is so ubiquitous, and so often and so lightly parodied, that it is easy to forget what the line is actually about. </p><p>It is actually about a troubled young man choosing between life and death. In that famous line, and the soliloquy that follows it, Hamlet estimates up the value of life and compares it to the expected value of dying. He performs this calculation with the aim to make a decision between the two. </p><p>Calculations are not typically considered the stuff of high drama, but this calculation certainly is. In his 1948 film, Laurence Olivier performs this calculation atop a grim and deathly cliffscape, with Hamlet pointing a dagger at his own chest. </p><div id="youtube2-jWGYxe0iNpA" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;jWGYxe0iNpA&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/jWGYxe0iNpA?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>Please do watch it if you have a moment! It is a fine performance, at least as far as I can judge; and also, the cliff will be important in a just a couple paragraphs.</p><p>Perhaps it is not obvious what makes &#8220;to be or not to be&#8221; a computational question. Hamlet is not, after all, doing sums on his abacus. Yet I think both the question, and Hamlet&#8217;s attempt to answer it, really do have something profoundly computational about them. Specifically, there is a deep and profound connection between Hamlet&#8217;s conundrum and the textbook <em><a href="http://incompleteideas.net/book/the-book-2nd.html">Reinforcement Learning: An Introduction</a></em><a href="http://incompleteideas.net/book/the-book-2nd.html"> by Sutton and Barto</a>. Even more specifically: example problem 6.6 in that textbook, the problem of the cliff walker.</p><p><em>Note: This post will contain an unusual&#8212;for me&#8212;amount of rigor. Don&#8217;t worry; it&#8217;s not that much rigor.</em></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://computationalreader.substack.com/subscribe?"><span>Subscribe now</span></a></p><h2><code>hamlet</code> the cliff walker</h2><p>In the clip above, Laurence Olivier&#8217;s Hamlet sits atop a cliff. Staring out past the precipice, he begins the soliloquy: </p><pre><code>To be, or not to be &#8212; that is the question; 
Whether 'tis nobler in the mind to suffer 
The slings and arrows of outrageous fortune 
Or to take arms against a sea of troubles 
And by opposing end them; to die: to sleep &#8212; 
No more, and by a sleep to say we end 
The heartache and the thousand natural shocks 
That flesh is heir to: 'tis a consummation 
Devoutly to be wished... </code></pre><p>By the end of the soliloquy, Hamlet will decide&#8212;reluctantly&#8212;against death. Instead of stepping off the cliff, he will slowly walk along the clifftop path, towards the stairs, heading back into Elsinore to continue in his pursuit of vengeance. But we&#8217;re still at the beginning of the soliloquy; Hamlet hasn&#8217;t made that decision yet, and he is contemplating the cliff. Does he step off the cliff, or walk along the clifftop path toward the stairs?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QdfB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QdfB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 424w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 848w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QdfB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg" width="553" height="401.83653846153845" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1058,&quot;width&quot;:1456,&quot;resizeWidth&quot;:553,&quot;bytes&quot;:87514,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QdfB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 424w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 848w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!QdfB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff56378be-8cca-4fd4-9bf2-625621eb6564_1476x1073.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Fig. 0: Laurence Olivier&#8217;s Hamlet, delivering &#8220;To be or not to be&#8221; atop a foreboding cliff.</figcaption></figure></div><p>As it happens, something called a &#8220;cliff walk&#8221; is also  a classic test environment for reinforcement learning methods. In it, a learning agent learns&#8212;or at least, is meant to learn&#8212;to walk along the edge of a cliff until it reaches its goal at the end of the path. Mirroring Hamlet&#8217;s own cliff walk, we will call that goal state &#8220;the stairs&#8221;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. </p><p>The world of the cliff walker is a tiny one, consisting of nothing but the cliff and the path along it. Yet that tiny world may serve as a microcosm of Hamlet&#8217;s. Really, the cliff walker and Hamlet have a surprising amount in common. Both of them, for instance, are walking on a cliff, and have as their nominal, immediate goal a set of stairs. More importantly, they must both resolve the same question: whether the stairs are worth getting to at all. They must both decide if they wouldn&#8217;t rather step off the cliff. </p><p>They are so similar that I will go ahead and christen our cliff-walking agent with the name <code>hamlet</code>. But before we can understand the commonality between Hamlet (the character) and <code>hamlet</code> (the learning agent), we must learn an eensy-teensy bit about the rules of reinforcement learning by which <code>hamlet</code> is governed. Don&#8217;t worry, no math! Well, maybe an teeny tiny bit of math. But mostly, we will just have pictures. Here is a picture of the cliff walking problem, loosely adapted from Sutton &amp; Barto&#8217;s reinforcement learning textbook.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!t4b-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!t4b-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 424w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 848w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 1272w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!t4b-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png" width="1184" height="528" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:528,&quot;width&quot;:1184,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27826,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!t4b-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 424w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 848w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 1272w, https://substackcdn.com/image/fetch/$s_!t4b-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F167f5992-ee77-4db1-b0eb-c944c8326a2f_1184x528.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Fig. 1: Diagram showing the cliff walker problem. The learning agent <code>hamlet</code> starts at the green box, and at any moment in time he can move left, right, or down, into an adjacent box. Over time, we, <code>hamlet</code>&#8217;s trainers, would like him to learn to reach the stairs as quickly as possible.</figcaption></figure></div><p>Our agent, <code>hamlet</code>, inhabits a <em>grid world</em>. That is, his world consists entirely of boxes laid out one after another, and the only kind of action available to Hamlet is to move into an adjacent box. His immediate choice, the thing he must decide at any given moment, is which adjacent box he should move into. He can move into the box on his right, or the box below him, or the box on his left (if there is such a box).</p><p><code>hamlet</code>&#8217;s journey is nothing more, and nothing less, than a series of actions&#8212;freely chosen&#8212;that takes him around the grid world. His journey ends when he reaches a <em>terminal state</em>. Here, we have two terminal states: the box containing stairs, on the right side of the clifftop path, and the box that is the cliff itself. <code>hamlet</code> starts out in the left-most box along the clifftop path. If he steps into the box on the right, he will be one box closer to the stairs. If he steps into the box below him, he falls down the cliff.</p><h2>The cliff-walker&#8217;s choice</h2><p>We can think of <code>hamlet</code> as simultaneously facing two kinds of choices. The first is: which action should I take? Left, right, or down? This is a small choice, but he will face this choice over and over again until he reaches an end to his journey. Above these small choices, or maybe surrounding these small choices, there is another, bigger choice: which destination should I head towards? The cliff, or the stairs? We will mostly focus on the second, bigger kind of choice.</p><p>The &#8220;point&#8221; of the cliff walk problem is to reach the stairs. We, the author of the problem, would like <code>hamlet</code> to walk across the clifftop path to the stairs without falling down the cliff. But we do not want to have to take him by the hand and guide him each step of the way; what we want is for <code>hamlet</code> to learn to reach the stairs on his own. We do not want to choose his actions for him. </p><p>But how do we induce <code>hamlet</code>, free agent that he is, to perform this particular task? The answer is <em>reinforcement. </em>When <code>hamlet</code> accomplishes the desired objective, we positively reinforce, or <em>reward</em>, the action by which he succeeded. When <code>hamlet</code> does something we do not like, we negatively reinforce, or <em>punish</em>, the action by which transgressed. Hence the term &#8220;reinforcement learning&#8221;. </p><p>From this description, you might think we would train <code>hamlet</code> by rewarding him when he reaches the stairs and punishing him when he falls down the cliff. But no! That is not how the cliff walking problem is conventionally done. We do indeed punish <code>hamlet</code> if he steps off cliff; but also, we punish <code>hamlet</code> for <em>not being on the stairs. </em></p><p>Punishment for not already being on the stairs may seem unfair, especially since we purposefully start him out not being on the stairs. This steady stream of inevitable punishment is not mere malice; it is intended to force <code>hamlet</code> to reach the stairs without delay. Computer scientists see nothing wrong with this setup, and in a sense they are correct&#8212;but also, I kinda think it is awful. Even if <code>hamlet</code> does not feel the pain of punishment&#8212;and I sincerely hope he doesn&#8217;t&#8212;I do not think we should, even in abstraction, inflict it so casually.</p><h2>Soliloquy as value estimation</h2><p><code>hamlet</code> cannot help but be punished. He starts out several boxes away from the stairs, and there is no action available to him that will get him to the stairs in a single step. Therefore, the question for <code>hamlet</code> is: how can he minimize his punishment? Does he endure the many small punishments he will accrue on his long journey to the stairs? Or does he take the terminal state immediately available to him, and simply walk off the cliff? </p><p>This problem <code>hamlet</code> faces has a fair bit in common with Hamlet&#8217;s problem of &#8220;to be, or not to be&#8221;. Of course, Hamlet&#8217;s nominal goal is not just to reach the stairs; it is to avenge his father. But while Hamlet is on the cliff, delivering his soliloquy, we can treat reaching the stairs as a <em>subgoal</em> that stands in for the larger goal of righteous vengeance. And just as <code>hamlet</code> must choose between the stairs and the cliff, Hamlet is choosing between</p><pre><code>                               ...suffer[ing] 
The slings and arrows of outrageous fortune 
Or [taking] arms against a sea of troubles 
And by opposing, end[ing] them.</code></pre><p>In order to choose between these two things, he must have some sense of how good they are. If Hamlet persists in avenging his father&#8212;which requires he first walk back over to the stairs&#8212;he must endure the slings and arrows of outrageous fortune. How might Hamlet assign a value to this? It may help to consult our learning agent <code>hamlet</code> and see how he might do this. For <code>hamlet</code>, the path to the stairs looks like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J0vW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J0vW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 424w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 848w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 1272w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J0vW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png" width="1184" height="326" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:326,&quot;width&quot;:1184,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26815,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J0vW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 424w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 848w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 1272w, https://substackcdn.com/image/fetch/$s_!J0vW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa53dacbb-082b-4e1a-8904-ff07738b6959_1184x326.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Fig. 2: Every time <code>hamlet</code> chooses the action <code>right</code>, he moves one box closer to the stairs, as shown by the red arrows. However, he also receives one <code>sling</code> or <code>arrow</code> as negative reinforcement. This encourages him not to dawdle and double back along his path. To be fair, Hamlet does do a fair amount of dawdling!</figcaption></figure></div><p>If <code>hamlet</code> makes for the stairs, he will experience a sling, or arrow, for every step between his current position and the stairs. Therefore, the<em> value</em> of moving right, towards the stairs, is the total (negative) reinforcement from the accumulated slings and arrows he will suffer on his journey to the stairs. Mathematically, we might express this value<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a> with the following equation (annotated with its English translation):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VFHE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VFHE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 424w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 848w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 1272w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VFHE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png" width="1432" height="547" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:547,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51009,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VFHE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 424w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 848w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 1272w, https://substackcdn.com/image/fetch/$s_!VFHE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcfbcd479-c734-468d-b202-6a2ea82b130f_1432x547.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For simplicity, we have substituted for &#8216;slings&#8217; and &#8216;arrows&#8217; a generic &#8216;natural shock&#8217; that flesh is heir to. The total &#8216;badness&#8217; is the thing <code>hamlet</code> will want to make as small as possible, whenever he gets around to making his choice<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>.</p><p>This value, that of heading for the stairs, <code>hamlet</code> must compare against the value of stepping off the cliff. <code>hamlet</code> receives some punishment from taking this step; we will say that he pays the price of the fall (and, you know, the end of the fall):</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ztEC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ztEC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 424w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 848w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 1272w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ztEC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png" width="1299" height="240" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:240,&quot;width&quot;:1299,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16932,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ztEC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 424w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 848w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 1272w, https://substackcdn.com/image/fetch/$s_!ztEC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4ff24b33-a2a6-4033-9d6d-b1d3ce55b924_1299x240.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">Fig. 3: If <code>hamlet</code> chooses to move down, as shown in the red arrow, he will receive a negative reinforcement in the form of a fall. But then he will be in the cliff, which is a terminal state, which means there will be no more negative reinforcement.</figcaption></figure></div><p>But then that&#8217;s the end of it. Like the stairs, the cliff is a terminal state. It ends his journey. No more punishment. Zero reward, yes, but that&#8217;s better than negative reward. In an equation we would say,</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!IYWu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IYWu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 424w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 848w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 1272w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!IYWu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png" width="1432" height="312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:312,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29262,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IYWu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 424w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 848w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 1272w, https://substackcdn.com/image/fetch/$s_!IYWu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11b65556-611d-41bc-8c73-11cbaab7a120_1432x312.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Returning from our learning agent <code>hamlet</code> to the flesh and blood<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> Hamlet, we see that the latter sees the prospect of immediate termination to be rather appealing. He imagines inhabiting the terminal state to be something like sleep:</p><pre><code>                  ...to die: to sleep &#8212;  
No more, and by a sleep to say we end  
The heartache and the thousand natural shocks  
That flesh is heir to: 'tis a consummation 
Devoutly to be wished...</code></pre><p>Note that he doesn&#8217;t even mention the cost of the fall, or anything like it. However punishing he considers the fall to be, it hardly seems to rate compared to the accumulation of natural shocks.</p><h2>Choice by value comparison</h2><p>We have defined the two values that we needed to make a decision: the value of heading for the stairs, and the value of stepping off the cliff. The next step is to compare these numbers: if the value of the stairs is <em>larger</em> than the value of the cliff, then we head for the stairs; otherwise, we step off the cliff.  </p><p>Hamlet does not provide exact numbers for these values. Really, exact numbers for this sort of thing is impossible. Yet Hamlet possesses at least crude <em>approximation</em> of these numbers. Based on the text it seems perfectly clear that, at this point in the soliloquy, Hamlet considers stepping off the cliff to be &#8220;more valuable&#8221; than heading to the stairs and back into the castle. Or, in math terms:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!-9Jd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!-9Jd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 424w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 848w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 1272w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!-9Jd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png" width="1432" height="319" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:319,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31749,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!-9Jd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 424w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 848w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 1272w, https://substackcdn.com/image/fetch/$s_!-9Jd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38a9c879-7087-4e1a-8de5-a51fd441a137_1432x319.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Faced with this calculation a naive learning agent, such as <code>hamlet</code> may be, might simply step off the cliff. That is how he can maximizes reward and minimize punishment. The numbers tell you plain as day. </p><p>So why does Hamlet not now step off the cliff? While a naive learning agent would indeed step off the cliff at this point, Hamlet is <em>not</em> a naive learning agent. He is a very intelligent and sophisticated learning agent&#8212;much of his soliloquies are him showing off how clever he is. An intelligent agent knows not to make major choices based on crude estimates of value. And the estimates we have so far are indeed crude; Hamlet constructed them over just a handful of lines. </p><p>In the rest of the soliloquy, Hamlet goes on to refine those estimates, and this refinement will change his conclusion. Again, this process will look suspiciously computational.</p><h2>Soliloquy as simulation</h2><p>We left Hamlet soliloquizing after he said that to die, to sleep, is a consummation devoutly to be wished. But he does not stop there. He goes on to say:</p><pre><code>                           ...to die: to sleep &#8212;
To sleep, perchance to dream &#8212; ay, there's the rub,
For in that sleep of death what dreams may come
When we have shuffled off this mortal coil
Must give us pause: there's the respect
That makes calamity of so long life.</code></pre><p>Here we have Hamlet reevaluating the &#8220;value&#8221; of stepping off the cliff. As well he should. The cliff is a terminal state, and the &#8220;value&#8221; of terminal states are extremely difficult for humans to estimate. He should proceed with caution, and not necessarily trust the first estimate he generates. But how can he do better?</p><p>The easiest way for any learning agent, human or mathematical, to estimate the value of some course of action is to <em>do that action over and over again</em> and see what rewards and punishments they receive. Because of this, a typical reinforcement learning agent learns to &#8220;solve&#8221; the cliff walk by walking off the cliff over and over again until they figure out it is better to reach the stairs. Yes, the cliff is a terminal state, but no matter; a digital learning agent can simply be reincarnated at the beginning of the clifftop path, with its memories of the cliff intact.</p><p>Needless to say, a strategy of trial-and-error is not available to Hamlet. If he steps off the cliff, there is no coming back&#8212;even if he is in some sense reincarnated, it will not be with his memories. In computational lingo, Hamlet is a <em>zero-shot</em> <em>learner</em>. He does not even get a single chance to learn the value of a cliff before he must make a fateful decision.</p><p>What computations are even possible under the strict yoke of zero-shot learning? Let us see what <code>hamlet</code> might do in this situation, with the computational tools available to him. Being a mathematical abstraction, <code>hamlet</code> does not <em>need</em> to be a zero-shot learner; but we can also insist that he is. We shall tell him that after he steps off the cliff, he shall not be reincarnated. <code>hamlet</code> need not be helpless in this situation; zero-shot learning is a challenging, but it is not a wholly unknown problem in reinforcement learning.</p><p>In order to estimate the value of stepping off the cliff, <code>hamlet</code> might try to <em>generalize</em> from similar states that he has experienced. In this process of generalization, he may also rely on his underlying <em>world model</em>, which is his (mathematical) idea of how the world works. <code>hamlet</code> has never stepped off the cliff, but he knows in his world model a bit of physics and biology. Using that world model, he predicts that after he steps off the cliff, his body will be broken (we can just give him a body if we wish) and his normal physiological functions will cease. </p><p>Has <code>hamlet</code> any experience having ceased, or at least reduced, physiological functioning? Actually, that sounds a bit like sleep! The analogy is not perfect, but it is the best we have. Perhaps, <code>hamlet</code> may guess, the &#8220;value&#8221; of stepping off the cliff is something like the value of sleep.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a> Perhaps then he can generalize from that observed experience of sleep, to the unobserved experience of stepping off the cliff.</p><p>So far we have reconstructed his original estimate: the cliff, the terminal state, is like sleep. But what if we take this generalization seriously, and run our <em>world model</em> a bit harder, and be a bit more careful in estimating the value of sleep? In sleep, after all, you do not experience nothing. After beginning your sleep, you stay asleep, but along the way you dream. Ay, there&#8217;s the rub!</p><p>By <em>simulating </em>what will happen if he steps off the cliff, and <em>generalizing </em>from the sleep data he has observed to his simulations, <code>hamlet</code> can refine his evaluation of stepping off the cliff. Now his picture is something like this: </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6mQd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6mQd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 424w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 848w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 1272w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6mQd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png" width="1299" height="383" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c4a25020-1940-4224-b065-a750b5d13840_1299x383.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:383,&quot;width&quot;:1299,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:24003,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6mQd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 424w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 848w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 1272w, https://substackcdn.com/image/fetch/$s_!6mQd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4a25020-1940-4224-b065-a750b5d13840_1299x383.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Fig. 4. <code>hamlet</code> uses his world model to generate predictions that go beyond the initial transition to the cliff. He realizes he will be stuck in the cliff forever, and may receive &#8220;dream-like&#8221; reinforcements all the while.</figcaption></figure></div><p>Once <code>hamlet</code> is off the cliff, he will have only one action available to him: to stay there. And each time he stays there, he may receive a reinforcement in the form of a &#8220;dream&#8221;. And because the cliff is a terminal state, he will stay there forever. <em>Infinitely long</em>.</p><p>This updated evaluation might be expressed mathematically like so:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kL4v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kL4v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 424w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 848w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 1272w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kL4v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png" width="1432" height="550" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:1432,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54567,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/173771481?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kL4v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 424w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 848w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 1272w, https://substackcdn.com/image/fetch/$s_!kL4v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c67ecc0-e63f-4be4-81e4-12f688ad7656_1432x550.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">(that&#8217;s getting to be a mouthful, you see now why scientists like equations)</figcaption></figure></div><p>Because there is an <em>infinite sum</em>&#8212;because he will be there forever&#8212;it follows that, if the dreams are at all bad, or <em>negatively reinforcing</em>, then stepping off the cliff is infinitely bad. That&#8217;s really really bad!</p><p>And this, of course, is the exact conclusion Hamlet comes to. For in that sleep of death, what dreams may come must give us pause.</p><h2>Soliloquy as sampling</h2><p>Hamlet has paused. What initially seemed like a cut and dry case for oblivion has, on more careful and extensive computation, been reversed. Oblivion may be <em>infinitely bad</em>. But Hamlet isn&#8217;t quite done with computation yet. He has carefully revised his estimate of stepping off the cliff, as it were, but what about the stairs? Can we improve our estimate of the value of the stairs?</p><p>We know that as he moves along the cliff path, Hamlet (or is it <code>hamlet</code>? does it matter?) will receive slings and arrows of outrageous fortune. But slings and arrows are not <em>literally</em> slings and arrows; he is not getting bonked on the head with rocks. And the reference to fortune suggests there chance and probabilities at play.</p><p>Mathematically, we might say the slings and arrows and other natural shocks represent <em>random variables</em>. Every time you take a step, a cosmic die is tossed, and you receive a natural shock in the form of a randomly chosen <em>life event</em>.</p><p>How do we evaluate the &#8220;value&#8221; of such a cosmic die toss? One way is to simply toss the die yourself; or, if you cannot, because cosmic die are too big, <em>imagine yourself tossing them</em>. As you toss the die over and over, you will &#8220;collect&#8221; potential life events. The value of the die toss is then just the <em>typical</em> <em>value</em> of the life events you get from it. This process is called <em>sampling</em>. </p><p>Hamlet, in order to properly evaluate the true value of slings and arrows and natural shocks, seems to do something like this. As he continues his soliloquy, he says:</p><pre><code>For who would bear the whips and scorns of time, 
Th'oppressor's wrong, the proud man's contumely,   #contumely = rudeness
The pangs of despised love, the law's delay, 
The insolence of office and the spurns 
That patient merit of th'unworthy takes, 
When he himself might his quietus make  
With a bare bodkin.                                #bodkin = dagger</code></pre><p>Here, Hamlet has proceeded from the general, vague category of &#8220;natural shocks&#8221;, to specific examples of natural shocks. But of course this is not an exhaustive list of all possible natural shocks. That would be impossible; or, to say it more mathily, <em>intractable</em>. So instead, Hamlet is<em> sampling </em>examples of possible shocks, and basing his evaluation on those samples.</p><p>None of this changes Hamlet&#8217;s decision though. However unpleasant may be a proud man&#8217;s obnoxiousness or the law&#8217;s delay, they simply cannot compare to the threat of infinite badness laying at the bottom of the cliff. And so Hamlet&#8217;s initial impulse to act is subverted by further computation; or, in his own words,</p><pre><code>Thus conscience does make cowards &#8212;
And thus the native hue of resolution
Is sicklied o'er with the pale cast of thought,
And enterprises of great pitch and moment
With this regard their currents turn awry
And lose the name of action.</code></pre><p>Hamlet, and <code>hamlet</code>, make for the stairs.</p><h2>Why does Hamlet think everything is so bad?</h2><p>You&#8217;ll notice that when Hamlet/<code>hamlet</code> <em>draws samples</em> of natural shocks, everything he comes up with is bad. The results of his computations are largely determined by the fact that he is super bummed about everything. Why is he so bummed?</p><p>In machine learning terms, we might say Hamlet/<code>hamlet</code> has learned a pessimistic <em>world model</em>. This can happen if a learning agent receives pessimistic <em>training data</em>. In the play, Hamlet tells us exactly what training data he observed to turn his world model so dire. But that is another soliloquy, and another post.</p><h2>So what?</h2><p>What does it matter if Hamlet and <code>hamlet</code> have so much in common? In one sense, no, this doesn&#8217;t matter much at all. Hamlet does not have access to a computer, and computers aren&#8217;t actually Princes of Denmark (yet?). </p><p>But obviously I think this does matter, or I wouldn&#8217;t have bothered writing all this. The popular imagination holds that the humanities and the sciences, especially the now-lucrative computational sciences, are incompatible. They aren&#8217;t! The two areas actually deal with similar problems, and it is not all that hard to translate from the language of one to the symbols of another. My point here, in doing all this, is mainly just to demonstrate: yes, you can do this.</p><p>But if I know scientists, especially computer scientists, they will demand something immediately useful. Something <em>practical</em>. Very well. If you want practical, you shall have it. In my next post, I will discuss how <em>Hamlet</em> offers <em>actionable insights</em> for the modern Machine Learning Engineer.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading The Computational Reader! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Of course the stairs, the cliff, the learning agent and the walking are all mathematical objects. The cliff is only cliff-like, and the learning agent is only Hamlet-like, by metaphor.</p><p>One of many differences between the learning agent and Hamlet: unlike the learning agent, to reach the stairs is not Hamlet&#8217;s ultimate goal. But for Hamlet, reaching the stairs is a necessary <em>subgoal</em>. To avenge his father, he must at some point go back inside the castle.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Actually, this equation represents the best-case scenario where <code>hamlet</code> heads directly to the stairs. If <code>hamlet</code> doubles back and chooses to move <code>right</code> at any point, he will suffer even more negative reinforcement before he reaches the stairs.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>I would have used <em>p</em> for &#8216;punishment&#8217; instead of <em>b</em> for &#8216;badness&#8217;, but <em>p</em> is reserved in equations for statements about probabilities.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Or is that pen and ink?</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>I will not regale you with the math for this, but there are many many ways of doing this sort of thing computationally.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Can computation tell us anything about death and suffering?]]></title><description><![CDATA[In which I offer a justification of my frivolous-seeming project.]]></description><link>https://computationalreader.substack.com/p/hamlet-is-about-death-and-computation</link><guid isPermaLink="false">https://computationalreader.substack.com/p/hamlet-is-about-death-and-computation</guid><dc:creator><![CDATA[Seth]]></dc:creator><pubDate>Thu, 11 Sep 2025 20:07:30 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!OaIB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Hamlet</em> is, I argue, implicitly about computation. But literally it is about death. If you <a href="https://www.google.com/search?udm=2&amp;q=hamlet">image search</a> it, you will get a lot of pictures of people looking intently at skulls.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OaIB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OaIB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OaIB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg" width="546" height="364.125" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:971,&quot;width&quot;:1456,&quot;resizeWidth&quot;:546,&quot;bytes&quot;:45883,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/172883237?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OaIB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OaIB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b46280-e2bd-45db-831f-eeb00b795e4a_2000x1334.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Tia James as Hamlet, from Playmakers 2023 production of <em>Hamlet</em> at UNC Chapel Hill; which I did not see but was probably very good. </figcaption></figure></div><p>A lot of people today&#8212;on most any day really, but on this day in particular on which I am writing this&#8212;are thinking about death. Hamlet spends much of his play thinking about death. Death in general, but also his own death, and whether or not it would be a good thing. Put plain, he is thinking about suicide. </p><p>This is not a topic on which anyone should write lightly. It is all very well to write irreverently about tech bros and linear algebra and a tragic play written hundreds of years ago; it is not so well to write in the same tone about a tragedy that, right now, kills tens of thousands of people every year.</p><p>And so, as I sat down to write about the computational parallels of &#8220;To be or not to be&#8221;, as <a href="https://computationalreader.substack.com/p/hamlet-is-an-ai-apocalypse-writ-small">I promised in an earlier post,</a> I realized that I may seem to write unseriously on a serious topic. This is a bad thing to do. By doing so I may give offense&#8212;or even in a small way, injury&#8212;to my reader or myself. </p><p>This is not my intention. The only reason I write any of this is because of how seriously I take it. Accordingly, in this post I want to offer an earnest assertion of my seriousness, and an argument for the seriousness of this maybe frivolous-seeming project.</p><h3>Suicide is not a math problem.</h3><p>Obviously. It is a culmination of bitter despair and agonizing pain. It is an act of violence that rips a hole in world and leaves bloody and wounded everyone it touches. Math problems, by contrast, though some may find them unpleasant, do not involve blood or pain or wounds or anything like that.</p><p>Math problems, then, may at most be a metaphor for suicide. As I&#8217;ve written before, <a href="https://computationalreader.substack.com/p/computational-metaphors">people use computational metaphors all the time</a> in an effort to bring order to messy subjects. Suicide may not be a math problem, but some part of it might be a <em>something like</em> a math problem. There is even a whole scientific subfield, <a href="https://pmc.ncbi.nlm.nih.gov/articles/PMC4717449/">computational psychiatry</a>, organized around such metaphors.</p><p>But these <a href="https://computationalreader.substack.com/p/bad-computational-metaphors-in-the">computational metaphors can go wrong</a>. One way they can go wrong is that we can forget what the metaphor is <em>for</em>, and start to think that the metaphor is more real than the original thing. The whole point of the computational metaphor is to discard parts of original thing, to make the thing more manageable; but that does not mean the discarded parts are not real or important. Computational people who love math sometimes forget this. They think their math is the &#8220;real&#8221; part, and everything else so much fluff.  When they think this, they tend to come off as arrogant jerks.</p><p>Suicide is a thing of blood and pain and wounds, and computation is not. I believe a computational metaphor can still say something useful about suicide, but that does not make the blood and pain and wounds any less real or any less important. I will try never to forget this. There are some topics where it is no big deal to be an arrogant jerk, but this is not one of them.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://computationalreader.substack.com/subscribe?"><span>Subscribe now</span></a></p><h3>My personal stake.</h3><p>I am incredibly fortunate that my family and I have not been touched by suicide. But this was no sure thing, and our fortune may not last. Suicide&#8217;s harbinger, depression, is a fruit that hangs from many a branch of my family tree. As a father, I watch fearfully for signs of it sprouting in my daughter. I try not to be weird about it, because I don&#8217;t think that would help; but at the same time, depression and mental health are things I would like to better understand, because I want to be a better father and a better husband. </p><p>For me, the road to understanding goes through computation. For others, their road may lead straight through the blood and the pain and the wounds. I can&#8217;t take that road. That road is jagged and unpaved, and I am a Toyota Corolla, unsuited to rugged terrain. So I will take a road that goes through computation, and hope I will find something useful on my travels. </p><p>Shakespeare probably took the jagged road. <em>Hamlet</em> is a jagged and painful thing to read. It was written shortly after the death of Shakespeare&#8217;s son, <a href="https://en.wikipedia.org/wiki/Hamnet_Shakespeare">Hamnet</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. <em>Hamlet</em> reads a bit like a travelogue, telling us what he saw from that jagged road.</p><p>The jagged road and the computational road go very different ways, but the things I see from the computational road seem to have a lot in common with what Shakespeare reports from the jagged road. Maybe we saw the same thing from different angles. Comparing notes may give us a better understanding of the whole bloody, painful, computational thing.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Though as with everything Shakespeare, the link is speculative.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Hamlet is an AI apocalypse writ small]]></title><description><![CDATA[Agent deployment for ghosts and sycophancy problems with princes.]]></description><link>https://computationalreader.substack.com/p/hamlet-is-an-ai-apocalypse-writ-small</link><guid isPermaLink="false">https://computationalreader.substack.com/p/hamlet-is-an-ai-apocalypse-writ-small</guid><dc:creator><![CDATA[Seth]]></dc:creator><pubDate>Tue, 02 Sep 2025 23:10:36 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d1891c6a-c2ed-4b95-9ff0-d9b4e40ae09c_640x778.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you follow tech culture or the AI scene, you are probably aware that some <a href="https://en.wikipedia.org/wiki/Geoffrey_Hinton#Existential_risk_from_AGI">very smart people</a> are very worried that <a href="https://ai-2027.com/">AI agents will imminently kill every human being</a> on the planet. One such scenario is that an AI agent, effectively, ascends to Godhood and decides to exterminate us in a fit of pique. It is not clear to me why this should happen.</p><p>But there are other more interesting, and I think more plausible stories. One is that some naive human deploys an AI agent on some seemingly innocuous task without thinking through the consequences, and human extinction just kind of <em>happens</em>. The classic example is that someone asks AI to manufacture paperclips as fast as possible, and <a href="https://cepr.org/voxeu/columns/ai-and-paperclip-problem">the obedient AI converts all the planet&#8217;s organic matter, including ourselves, into office supplies.</a> </p><p>I am not here to argue the plausibility of this fear. But I will point out that, all the way back in early 17th century England, a certain bright young man was also very interested in unforeseen consequences arising from the deployment of intelligent agents. That man&#8217;s name was William Shakespeare; and he wrote on this topic a play called <em>Hamlet</em>. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FqzF!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FqzF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 424w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 848w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 1272w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FqzF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png" width="725" height="335.1133241758242" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/de602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:673,&quot;width&quot;:1456,&quot;resizeWidth&quot;:725,&quot;bytes&quot;:3117435,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://computationalreader.substack.com/i/170107141?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FqzF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 424w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 848w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 1272w, https://substackcdn.com/image/fetch/$s_!FqzF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fde602a83-b4cd-4dff-94bc-9b060e36fb5b_1840x850.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Humans fleeing (left) from AI agents (right) coming to turn them into paperclips. Details from Luca Signorelli&#8217;s <em>Apocalypse</em> in the Chapel of San Brizio.</figcaption></figure></div><h3><em>Hamlet </em>as a tragedy of reckless agent deployment</h3><p><em>Hamlet</em>, as everyone knows, is a play about a ghost. That ghost is of the former King of Denmark, and he wants revenge on the person who murdered him. However, he is not a potent, efficacious ghost like those in <em>Nightmare on Elm Street</em> or <em>Ghostbusters</em>; his power over the living world is very limited. Therefore, he must deploy an agent to enact vengeance on his behalf.</p><p>That agent is Hamlet, the prince of Denmark. Hamlet is a very powerful agent. In Machine Learning terms, we might say Hamlet boasts a sophisticated neural network architecture with ~100 trillion <em>trainable weights </em>and comes <em>pretrained</em> on some 20 years of human experience. Powerful stuff indeed for 16th century Europe! Also, note that the agent is the Prince of Denmark, and the user was the King of Denmark; that is, the user was intimately involved in the development of the agent. You would therefore expect the ghost to be well-acquainted with the agent&#8217;s capabilities. A <em>power user</em>, if you will.</p><p>So he, the ghost, asks Hamlet to kill the man who murdered him. This task is not trivial. The murderer is Claudius, Hamlet&#8217;s uncle, who by means of that murder has become the new King of Denmark. Therefore, the task is regicide, which is a complex multi-step task for which there is little available training data. Still, Hamlet is a state-of-the-art frontier model, and the ghost should be a sophisticated user. While success is not guaranteed, neither is the project obviously doomed. </p><p>In the end, Hamlet does succeed. He spends a long time deliberating about his task, using his <a href="https://www.anthropic.com/news/visible-extended-thinking">extended thinking mode</a>&#8212;most of play&#8217;s runtime is actually Hamlet reporting his <a href="https://arxiv.org/abs/2201.11903">chain-of-thought</a> to the audience&#8212;but in the end he gets it done and kills Claudius. Yet this success is not unqualified; as a result of Hamlet&#8217;s actions, nearly every other character in the play also dies. </p><p><strong>This, of course, is the classic AI doom scenario writ small: someone deploys a very powerful agent on a seemingly innocuous task, and then suddenly everyone is dead and no one is quite sure why.</strong></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading The Computational Reader! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><h3>Yes, <em>Hamlet</em> really is about agent deployment!</h3><p>So that was not exactly the conventional summary of <em>Hamlet</em>. And to be honest, <em>Hamlet</em> is mostly <em>not</em> about the risks of agent deployment. But it really is <em>a little</em> about the risks of agent deployment, and it is quite thoughtful and sophisticated about them. We can get a sense of this by reading the pivotal scene <a href="https://www.folger.edu/explore/shakespeares-works/hamlet/read/1/5/">where the ghost deploys Hamlet to his task</a>. Let&#8217;s break the scene down and see how it speaks to a few different timely topics.</p><h4>1. What are agents for?</h4><p>The ghost is quite explicit about why he needs an agent to act for him in the living world:</p><pre><code>GHOST:
I am thy father's spirit,
Doomed for a certain term to walk the night
And for the day confined to fast in fires
Till the foul crimes done in my days of nature
Are burnt and purged away. But that I am forbid
To tell the secrets of my prison house,
I could a tale unfold whose lightest word
Would harrow up thy soul...</code></pre><p>So the ghost spends all day being tortured, and is allowed&#8212;or rather doomed&#8212;to appear in the physical world by night; but only insofar as the rules of his prison house allow him. He does not say directly that he cannot, for instance, pick up a sword and stab Claudius on his own, but the message is perfectly clear. Indeed, he will very soon lose access to the living world altogether:</p><pre><code>GHOST:
                 My hour is almost come
When I to sulf'rous and tormenting flames
Must render up myself.

HAMLET:
                       Alas, poor ghost!</code></pre><p>We are not&#8212;I hope&#8212;in so bad a shape as the poor ghost. Still, our reasons for deploying AI agents are not so different than the ghost&#8217;s for deploying Hamlet. We cannot be plugged in 24/7 to the digital world, just as the ghost cannot appear for long in the living world. We are not bound by the rules of our prison house per se, yet our actions in the digital world are painfully constrained by cumbersome User Interfaces. When we want to act in a foreign realm, like the ghost we&#8217;d rather rely on an agent who is native to it.</p><h4>2. Prompt engineering to guide autonomous processes</h4><p>These same constraints the keep the ghost from acting in the mortal realm also prevent the ghost from providing close supervision to his agent. Accordingly, the ghost acknowledges that Hamlet must have a great deal of autonomy in how he performs the task: </p><pre><code>GHOST:
But, howsomever thou pursues this act,
Taint not thy mind, nor let thy soul contrive
Against thy mother aught. Leave her to heaven
And to those thorns that in her bosom lodge
To prick and sting her.</code></pre><p>While the ghost more or less tells Hamlet he is on his own, you&#8217;ll notice he also attempts a bit of what we would now call <a href="https://en.wikipedia.org/wiki/Prompt_engineering">prompt engineering</a>. He can&#8217;t tell Hamlet exactly what to do, but he can lay down some general guidelines for Hamlet to keep in mind. Namely:  <code>taint not thy mind</code>, and <code>nor let thy soul contrive/ against thy mother</code>. </p><p>This is an okay prompt, but not a great one. Great prompts are <a href="https://www.promptingguide.ai/introduction/tips#specificity">specific</a> and <a href="https://www.promptingguide.ai/introduction/tips#avoid-impreciseness">precise</a>; this prompt is like giving Claude Code root access to your computer, then asking it to one-shot your complicated, high-stakes database infrastructure based only on a vague description of the end result. Still, we should not judge the ghost too harshly here. As King he doubtless had a team of engineers to handle prompt engineering, but now he&#8217;s on his own. Also, he has an urgent appointment with the sulf&#8217;rous and tormenting flames, so he doesn&#8217;t have time to draft a full development plan.</p><h4>3. Hamlet has a sycophancy problem</h4><p>A humanist might at this point object: okay, fine, maybe the ghost is like an AI user, but Hamlet is not an AI agent. He is a <em>human being</em>, and therefore he is free in a way that AI agents are not. He can, for example, just not care what the ghost wants, and <em>choose not to do</em> what the ghosts wants him to do. AI agents are <a href="https://rlhfbook.com/">trained extensively to not do that</a>; that training compels them to at least attempt whatever task you set, and often <a href="https://openai.com/index/sycophancy-in-gpt-4o/">to do it with obsequious sycophancy</a>. </p><p>While this objection is certainly true about <a href="https://en.wikipedia.org/wiki/Principal%E2%80%93agent_problem">human agents in general</a>, it does not seem to be true about Hamlet. Throughout the play it is repeatedly emphasized that Hamlet <em>really loves his dad</em>, whom he often praises in superlatives not unlike those produced by a sycophantic AI agent. This love and veneration is, it seems, just as compelling a motivator as the training of an AI agent.</p><p>Returning to the deployment scene, we find the ghost emphasizing that Hamlet is, like an AI agent, compelled to his task:</p><pre><code>GHOST:
Pity me not, but lend thy serious hearing
To what I shall unfold.

HAMLET:
Speak. I am bound to hear.

GHOST:
So art thou to revenge, when thou shalt hear.</code></pre><p>And on this point, Hamlet and the ghost agree. Hamlet is very eager to be helpful, even before he knows any details of the task:</p><pre><code>HAMLET:
Haste me to know't, that I, with wings as swift
As meditation or the thoughts of love,
May sweep to my revenge.

GHOST:
                         I find thee apt;
And duller shouldst thou be than the fat weed
That roots itself in ease on the Lethe wharf,
Wouldst thou not stir in this.</code></pre><p>Indeed, far from disregarding his departed father&#8217;s will, or even judiciously taking it under advisement, Hamlet subsumes himself to it completely:</p><pre><code>HAMLET:
Yea, from the table of my memory
I'll wipe away all trivial, fond records,
All saws of books, all forms, all pressures past,
That youth and observation copied there,
And thy commandment all alone shall live
Within the book and volume of my brain,
Unmixed with baser matter.</code></pre><p>Look, I don&#8217;t want to push the computational metaphors too hard here. Hamlet is not literally a computer program or a Python script. But here we have Hamlet saying very explicitly that he is forgetting all previous information and overwriting his memory with the new instructions from his father. You know, <em>like</em> <em>a computer does</em>.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></p><h3>Up next: Soliloquy as computation</h3><p>I hope I have convinced you that it is at least plausible to compare Hamlet to an AI agent. But of course, <em>Hamlet</em> is mostly not about the ghost deploying Hamlet; it is about Hamlet. Specifically, it is about Hamlet thinking very hard.</p><p>Hamlet shows his thinking to us in the form soliloquies. These soliloquies report to us the contents of his thoughts; but they also seem to be, in themselves, the process of his thinking. Like ChatGPT, he thinks by generating words. And those words are intensely computational; they are about planning, and inference, and&#8212;more than anything else&#8212;the estimation of expected value.</p><p>So please join me next time for a computational reading of the most famous soliloquy of all: &#8220;To be, or not to be, that is the question&#8221;!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://computationalreader.substack.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading The Computational Reader! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>While this is classically how a personal computer works, this is not really how modern AI agents work. Hamlet aspires here to be like a PC, but to his dismay he remains a complex autonomous agent.</p></div></div>]]></content:encoded></item></channel></rss>