<?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[Agentic Reinforcement Learning: Prompt Engineering with LLMs]]></title><description><![CDATA[Prompt Engineering with LLMs]]></description><link>https://agenticreinforcementlearning.substack.com/s/prompt-engineering-with-llms</link><image><url>https://substackcdn.com/image/fetch/$s_!Alpq!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F420f4c55-6bac-4a7f-a289-344e1058f2b9_3458x3458.png</url><title>Agentic Reinforcement Learning: Prompt Engineering with LLMs</title><link>https://agenticreinforcementlearning.substack.com/s/prompt-engineering-with-llms</link></image><generator>Substack</generator><lastBuildDate>Wed, 08 Apr 2026 01:16:10 GMT</lastBuildDate><atom:link href="https://agenticreinforcementlearning.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Nik Bear Brown]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[agenticreinforcementlearning@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[agenticreinforcementlearning@substack.com]]></itunes:email><itunes:name><![CDATA[Nik Bear Brown]]></itunes:name></itunes:owner><itunes:author><![CDATA[Nik Bear Brown]]></itunes:author><googleplay:owner><![CDATA[agenticreinforcementlearning@substack.com]]></googleplay:owner><googleplay:email><![CDATA[agenticreinforcementlearning@substack.com]]></googleplay:email><googleplay:author><![CDATA[Nik Bear Brown]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[The Stochastic Machine: LLM Output Generation]]></title><description><![CDATA[Chapter 1 - Cheat Sheet]]></description><link>https://agenticreinforcementlearning.substack.com/p/the-stochastic-machine-llm-output</link><guid isPermaLink="false">https://agenticreinforcementlearning.substack.com/p/the-stochastic-machine-llm-output</guid><dc:creator><![CDATA[Nik Bear Brown]]></dc:creator><pubDate>Wed, 18 Feb 2026 21:17:31 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Alpq!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F420f4c55-6bac-4a7f-a289-344e1058f2b9_3458x3458.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Cheat Sheet &#8212; Nik Bear Brown, Feb 2026</h3><div><hr></div><h2>Core Insight</h2><p>LLMs <strong>don&#8217;t retrieve answers &#8212; they sample them.</strong> Every token is a probabilistic draw from a shaped distribution. Same question + same model = different draw each time.</p><blockquote><p>&#8220;You are not configuring an intelligence. You are reshaping a distribution.&#8221;</p></blockquote><div><hr></div><h2>Key Concepts</h2><h3>Logits &#8594; Probabilities (Softmax)</h3><p>Raw scores (logits) are converted to probabilities via softmax. Only <em>relative differences</em> between logits matter &#8212; one dominant token = a spike in the distribution.</p><p><strong>Confidence signal:</strong> &#916; = z(1) &#8722; z(2) (gap between top two logits)</p><ul><li><p>Large &#916; &#8594; decisive, low variance</p></li><li><p>Small &#916; &#8594; uncertain, near coin-flip</p></li></ul><div><hr></div><h2>The Three Sampling Controls</h2><p>ParameterWhat It DoesLow ValueHigh Value<strong>Temperature (T)</strong>Reshapes the whole distributionSharpens spike &#8594; deterministicFlattens &#8594; creative/chaotic<strong>Top-K</strong>Keeps only K most probable tokensBrittle, repetitiveMore variety<strong>Top-P (nucleus)</strong>Keeps tokens until cumulative prob &#8805; pTight nucleusWide nucleus</p><p><strong>Production default:</strong> Temperature shapes &#8594; Top-K or Top-P prunes &#8594; sample from remainder.</p><div><hr></div><h2>Temperature Behavior</h2><p>T ValueBehaviorUse WhenT = 0Greedy decoding, fully deterministicAuditable facts, codeT = 0.7Balanced accuracy + fluencyMost tasksT = 1.0+High variance, samples from long tailBrainstorming, creative</p><p><strong>Entropy H(pT):</strong> Rises with temperature. Higher entropy = more output variance = more drift risk.</p><div><hr></div><h2>Top-K vs. Top-P</h2><p>Top-KTop-P (Nucleus)<strong>Set size</strong>Fixed (always K tokens)Adaptive (varies with confidence)<strong>Confident model</strong>May include garbage tokensAutomatically tightens<strong>Uncertain model</strong>May cut off good tokensAutomatically expands<strong>Best for</strong>Predictable truncationAdapting to model&#8217;s own uncertainty</p><p><strong>Winner for most cases:</strong> Top-P &#8212; it self-adjusts.</p><div><hr></div><h2>Expert Default Bias</h2><p>No matter what persona/proficiency level you assign, a well-trained model&#8217;s logit gap for a <em>correct simple answer</em> is so large that sampling can&#8217;t reach the wrong answer. You can change <strong>presentation style</strong> &#8212; not <strong>logical execution</strong> &#8212; without fine-tuning.</p><div><hr></div><h2>Agentic Sampling Loop</h2><p>Treat sampling parameters as a <strong>feedback control surface</strong>, not fixed settings.</p><pre><code><code>draft = generate(prompt, T=0.7, top_p=0.9)
score = evaluate(draft)   # confidence, hallucination, constraints

if low_confidence:     &#8594; lower T, tighten top_p, regenerate
if too_boring (creative task): &#8594; raise T, widen top_p, regenerate

return best(drafts)</code></code></pre><p><strong>Self-consistency decoding:</strong> Generate N diverse paths &#8594; majority vote &#8594; +17.7% accuracy on factual tasks.</p><div><hr></div><h2>CASE Framework (Exemplar Selection)</h2><p>Choosing few-shot examples = multi-arm bandit problem.</p><ul><li><p><strong>Arm</strong> = a subset of candidate examples</p></li><li><p><strong>Reward</strong> = model accuracy on that subset</p></li><li><p><strong>CASE result:</strong> 87% fewer model calls, 7&#215; faster, +15% accuracy vs. brute force</p></li></ul><div><hr></div><h2>Design Rules by Task</h2><p>Task TypeTemperatureTruncationStrategyAuditable factsLow (&#8804; 0.3)Tight Top-PSingle pass + verifyGeneral Q&amp;A0.5&#8211;0.7Top-P 0.9Single passBrainstorming0.8&#8211;1.0Wide Top-PMultiple draws, pick bestCreative writingHigh in creative sections, low in factual anchorsTop-PAgentic loopFew-shot prompting0.7Top-P 0.9CASE bandit selection</p><div><hr></div><h2>The Wonder Woman Audit (Mental Model)</h2><ul><li><p><strong>T=0:</strong> Locks on canonical facts. Reliable but brittle.</p></li><li><p><strong>T=0.7:</strong> Accurate, varies in framing. Sweet spot.</p></li><li><p><strong>T=1.2:</strong> Samples from legitimate-but-irrelevant regions. &#8220;Bizarro Wonder Woman enters the frame.&#8221;</p></li></ul><p><em>The model didn&#8217;t invent Bizarro Wonder Woman &#8212; it sampled too far into a real but wrong part of its distribution.</em></p><div><hr></div><h2>One-Line Summary</h2><p><strong>LLMs are stochastic machines. Temperature, Top-K, and Top-P are your steering wheel &#8212; use them intentionally, or accept whatever the distribution gives you.</strong></p>]]></content:encoded></item><item><title><![CDATA[The Stochastic Machine: Understanding LLM Output Generation]]></title><description><![CDATA[Why Every Answer Is a Roll of the Dice&#8212;and How to Load Them]]></description><link>https://agenticreinforcementlearning.substack.com/p/the-stochastic-machine-understanding</link><guid isPermaLink="false">https://agenticreinforcementlearning.substack.com/p/the-stochastic-machine-understanding</guid><dc:creator><![CDATA[Nik Bear Brown]]></dc:creator><pubDate>Wed, 18 Feb 2026 21:15:06 GMT</pubDate><enclosure url="https://api.substack.com/feed/podcast/188425848/00eeba2e04621170909109e95fe6a547.mp3" length="0" type="audio/mpeg"/><content:encoded><![CDATA[<p>You ask a language model whether Wonder Woman&#8217;s 2017 box office gross could buy a Boeing 737. The answer comes back instantly, confident, grammatically immaculate: <em>Yes, at approximately $822 million, the film&#8217;s receipts comfortably exceed the $90&#8211;$115 million cost of a standard 737.</em></p><p>Now ask again. Same question. Same model. Different session.</p><p>The answer comes back again. Still correct. Still confident. Slightly different phrasing, maybe a detail about director Patty Jenkins, maybe a specification of the 737 MAX variant.</p><p>Ask a third time, but this time you&#8217;ve turned a dial&#8212;one you probably didn&#8217;t know existed&#8212;toward its upper limit.</p><p>This time, the answer drifts. <em>Bizarro Wonder Woman</em> appears somewhere. The Justice League is mentioned. The logical chain between box office receipts and aircraft costs starts to loosen, and you begin to suspect the model has forgotten what it was being asked.</p><p>Same model. Same question. Three different answers.</p><p>This is not a glitch. This is the machine working exactly as designed.</p><div><hr></div><p>Here is the thing most people get wrong about language models: they treat them like search engines with better grammar. <em>It retrieved the answer. It stored the fact. It found the quote.</em></p><p>That framing is wrong in a precise, measurable, consequential way.</p><p>In standard inference, an LLM does not retrieve a stored response. It generates a sequence one token at a time, making a probabilistic choice at each step about what comes next. The mathematical statement is compact but carries enormous weight:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!H5aW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H5aW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 424w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 848w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 1272w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!H5aW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png" width="1456" height="151" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:151,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:13836,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!H5aW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 424w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 848w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 1272w, https://substackcdn.com/image/fetch/$s_!H5aW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5c662f1-1ab4-4bb5-9aa9-b84bb4b242ce_2142x222.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>xt&#8203; is the next token. x&lt;tx_{&lt;t} x&lt;t&#8203; is everything that came before&#8212;your entire prompt, every word already generated. p&#952;p_\theta p&#952;&#8203; is a probability distribution shaped by the model&#8217;s learned weights. And the &#8764;\sim &#8764; symbol is the most important character in that equation. It means *sampled from*. Not *equal to*. Not *retrieved from*. Sampled from.</p><p>The output is a draw. Every time.</p><p>Even when you see the same answer twice, you are not seeing retrieval. You are seeing a distribution so sharply peaked that the same token wins the draw twice. The moment you push that distribution toward flatness&#8212;toward equal probability across many options&#8212;the draw starts landing somewhere new.</p><div><hr></div><p>To understand how that distribution gets shaped, you need to follow the math one step further.</p><p>At each generation step, the model produces a vector of raw numbers&#8212;one number per word in its vocabulary, which for modern models means tens of thousands of numbers. These are called <strong>logits</strong>. A logit of 8.3 for the token <em>&#8220;Boeing&#8221;</em> and 2.1 for the token <em>&#8220;airplane&#8221;</em> doesn&#8217;t mean the model is 8.3% confident in one and 2.1% in the other. Logits aren&#8217;t probabilities. They&#8217;re scores. To convert them into something you can sample from, you apply the softmax function:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4fWB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4fWB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 424w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 848w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 1272w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4fWB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png" width="1456" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10462,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!4fWB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 424w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 848w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 1272w, https://substackcdn.com/image/fetch/$s_!4fWB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F38ae293c-1c48-4c9c-b2b8-52cd4b6cda3c_2154x226.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Two things happen inside this equation that matter enormously.</p><p>First, only <em>differences</em> between logits matter. Add 100 to every number in the vector and the probabilities don&#8217;t change. The distribution is about relative standing, not absolute value.</p><p>Second, a single token can dominate. If one logit is significantly higher than all others, the exponential function amplifies that gap dramatically. The token with the highest logit absorbs most of the probability mass. The distribution becomes a spike.</p><p>The gap between the top two logits&#8212;call it &#916;=z(1)&#8722;z(2)\Delta = z^{(1)} - z^{(2)} &#916;=z(1)&#8722;z(2)&#8212;is your informal confidence meter. Large &#916;\Delta &#916; means the model is decisive: this token, almost certainly, and here is why. Small &#916;\Delta &#916; means it&#8217;s genuinely uncertain: any of three or four tokens could come next, and which one does is close to a coin flip.</p><div><hr></div><p>That spike&#8212;or that coin flip&#8212;is what temperature controls.</p><p>Temperature T is a single number, but it reshapes the entire distribution:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iHxd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iHxd!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 424w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 848w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 1272w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iHxd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png" width="1456" height="211" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:211,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:29665,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!iHxd!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 424w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 848w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 1272w, https://substackcdn.com/image/fetch/$s_!iHxd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F743fa3f8-802d-4d11-a586-ea65cf8c7427_2138x310.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>When T&lt;1, you divide the logits by a number less than one, which means you *increase* the gaps between them. The distribution sharpens. The most likely token becomes even more dominant. Set T close to zero and you&#8217;ve essentially eliminated randomness: the model picks the highest-scoring token every single time. This is called greedy decoding, and it&#8217;s what most people imagine when they think about a &#8220;correct&#8221; AI answer.</p><p>When  T&gt;1, you divide by a large number, shrinking the gaps. The distribution flattens. Tokens that had small logits get relatively larger. Tokens that had large logits lose their dominance. You start sampling from the long tail&#8212;the weird, the unexpected, the sometimes inspired, the sometimes incoherent.</p><p>This flattening is measurable. The formal tool is entropy:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!N52q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N52q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 424w, https://substackcdn.com/image/fetch/$s_!N52q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 848w, https://substackcdn.com/image/fetch/$s_!N52q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 1272w, https://substackcdn.com/image/fetch/$s_!N52q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!N52q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png" width="1456" height="201" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:201,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22571,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!N52q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 424w, https://substackcdn.com/image/fetch/$s_!N52q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 848w, https://substackcdn.com/image/fetch/$s_!N52q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 1272w, https://substackcdn.com/image/fetch/$s_!N52q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffe376307-6ccb-40f4-956d-06c8285fb511_2178x300.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>High entropy means the distribution is spread out&#8212;many tokens have non-negligible probability. Low entropy means it&#8217;s concentrated. As temperature rises, entropy rises with it. As entropy rises, output variance rises with it. The model starts generating completions that differ not just in phrasing but in substance.</p><p>This is exactly what you see in the Wonder Woman experiment. At T=0T = 0 T=0, the model locks onto the canonical facts. At T=0.7T = 0.7 T=0.7, it stays accurate but starts varying the framing&#8212;different emphasis, different supporting details. At T=1.2T = 1.2 T=1.2, it begins sampling from tokens that are plausible in some loose semantic sense but no longer reliably anchored to the factual core. The box office number drifts. The aircraft cost gets fuzzy. *Bizarro Wonder Woman* enters the frame.</p><div><hr></div><p>Temperature reshapes the whole distribution. But sometimes you don&#8217;t want to reshape&#8212;you want to <em>truncate</em>. That&#8217;s what Top-K and Top-P sampling do.</p><p><strong>Top-K</strong> keeps only the KK K most probable tokens and throws the rest away. If  K=50, you never sample from the bottom 99.9% of the vocabulary. The tail is gone. You renormalize across those 50 tokens and sample from that restricted set:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZiHS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZiHS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 424w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 848w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 1272w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZiHS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png" width="1456" height="213" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:213,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34951,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!ZiHS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 424w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 848w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 1272w, https://substackcdn.com/image/fetch/$s_!ZiHS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F825ad0a4-63d8-4704-a3df-6e550b002845_2066x302.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>Top-P</strong> (nucleus sampling) takes a more adaptive approach. Instead of a fixed count, it asks: what is the smallest set of tokens whose cumulative probability meets some threshold pp p? Sort tokens by probability, add them up until you hit the threshold, keep that set. When the model is confident&#8212;distribution is already spiked&#8212;the nucleus is small. When the model is uncertain&#8212;distribution is flat&#8212;the nucleus grows. The method adapts to the model&#8217;s own uncertainty in real time.</p><p>The practical difference matters. Top-K with K=3K = 3 K=3 on a highly confident model and a highly uncertain model gives you very different experiences. Top-P with p=0.9p = 0.9 p=0.9 automatically adjusts: tight when the model knows, loose when it doesn&#8217;t.</p><p>Most production systems combine all three: temperature shapes the distribution, then a truncation rule prunes it, then you sample from what&#8217;s left. The output you receive is a single draw from that shaped, pruned distribution.</p><div><hr></div><p>Now here is where this stops being a theoretical exercise and starts being a design problem.</p><p>Researchers studying exemplar selection for few-shot learning discovered that choosing <em>which examples to include in a prompt</em> is itself a stochastic optimization problem. Because the model&#8217;s response to any given set of examples is a probabilistic event, finding the &#8220;best&#8221; prompt isn&#8217;t a search through a fixed landscape&#8212;it&#8217;s an optimization problem under uncertainty.</p><p>The CASE framework&#8212;Challenger Arm Sampling for Exemplar selection&#8212;treats this as a multi-arm bandit. Each possible subset of examples is an &#8220;arm.&#8221; Pulling the arm means calling the model with that prompt and observing the reward: did the model get the answer right? The challenge is finding the best arms from an exponentially large space while minimizing the number of expensive model calls.</p><p>The results are stark. CASE reduces the number of required model calls by 87% compared to state-of-the-art methods. It runs up to 7x faster. It improves task accuracy by up to 15.19%. The mechanism is principled: a gap-index-based exploration strategy that maintains a &#8220;challenger set&#8221; of next-best candidates, iteratively evaluated against current leaders. The stochasticity of the machine is not fought&#8212;it&#8217;s incorporated into the optimization itself.</p><p>The deeper lesson: the same probabilistic nature that makes outputs variable is what makes systematic optimization possible. You can&#8217;t do a bandit optimization on a deterministic lookup table.</p><div><hr></div><p>There is a limit to how far sampling parameters can push a model, and the math of Expert Default Bias reveals exactly where that limit sits.</p><p>Consider a simple experiment: prompt GPT-4o to simulate students of different proficiency levels solving a straightforward arithmetic problem. A student who earns A grades. A student who earns D grades. Ask both to calculate the earnings for 50 minutes of babysitting at $12 per hour.</p><p>The A-student response is clean: 50/60=5/650/60 = 5/6 50/60=5/6; 5/6&#215;12=$10.005/6 \times 12 = $10.00 5/6&#215;12=$10.00. The D-student response hedges: *&#8221;Maybe like $10? I think she earned $10.&#8221;* Different tone, different confidence markers&#8212;but the same answer. The underlying calculation never changes. Not for the B-student, not for the C-student, not for the D-student.</p><p>This is not a failure of prompt engineering. It is a feature of the distribution. The probability mass for the correct answer to a simple arithmetic problem is so dominant in a well-trained model that no temperature setting, no persona prompt, no amount of stylistic instruction can shift the sampling process toward a <em>realistic</em> arithmetic error. The logit gap for the correct token is enormous. The tail&#8212;where the wrong answers live&#8212;is so suppressed it might as well not exist.</p><p>What you can change with sampling parameters is the <em>presentation</em> of competence. What you cannot change, without specialized fine-tuning, is the underlying logical execution.</p><div><hr></div><p>Suppose the stochastic nature of the machine isn&#8217;t a design flaw to be suppressed. Suppose it&#8217;s a control surface.</p><p>This is the core insight of agentic AI: treat sampling parameters as variables in a feedback loop, not fixed settings on a dial.</p><p>An agentic system generates a draft under some initial settings. It evaluates that draft&#8212;using confidence scoring, constraint checking, factuality heuristics. Based on what it finds, it adjusts the settings and generates again.</p><p>The confidence signal can come directly from the logits. Define the gap at each generation step:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ETrn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ETrn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 424w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 848w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 1272w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ETrn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png" width="1456" height="127" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:127,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15319,&quot;alt&quot;:&quot;&quot;,&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://nikbearbrown.substack.com/i/188425420?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!ETrn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 424w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 848w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 1272w, https://substackcdn.com/image/fetch/$s_!ETrn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3176da0-c48d-4b3a-8e5c-416da4c7916a_2128x186.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>Average these gaps across the full generation. A low average means the model was frequently uncertain&#8212;the distribution was often nearly flat, the draws were often close calls. A high average means it was decisive throughout.</p><p>The adaptive policy follows naturally. High confidence &#8594; modest temperature, allow Top-P for fluency. Low confidence &#8594; lower temperature to reduce randomness, or switch to a verify-then-write mode. Creative task &#8594; raise temperature in designated sections, keep it low in factual sections.</p><pre><code><code>given prompt c
settings := (T=0.7, top_p=0.9)

draft := generate(c, settings)
score := evaluate(draft)   # constraints, hallucination heuristics, etc.

if score.low_confidence:
    settings.T := max(0.2, settings.T - 0.3)
    settings.top_p := min(0.9, settings.top_p)
    draft2 := generate(c, settings)

if score.too_boring and task_is_creative:
    settings.T := settings.T + 0.3
    settings.top_p := settings.top_p + 0.05
    draft3 := generate(c, settings)

return best(draft, draft2, draft3)</code></code></pre><p>The agent isn&#8217;t adding new knowledge. It&#8217;s steering sampling based on feedback. The difference between a model and an agent isn&#8217;t intelligence&#8212;it&#8217;s the feedback loop.</p><p>This approach has measurable payoffs. Systems using self-consistency decoding&#8212;generating multiple diverse reasoning paths and selecting by majority vote&#8212;show +17.7% accuracy gains on tool-based factual datasets. The stochasticity is not eliminated. It&#8217;s harnessed for exploration, then collapsed via aggregation into a reliable answer.</p><div><hr></div><p>The Wonder Woman experiment comes full circle here.</p><p>At T=0T = 0 T=0, the model is not thinking. It is convergingon the most probable continuation of its training data. The answer is reliable but brittle&#8212;a single path through a probability landscape that was shaped to produce exactly this output.</p><p>At T=1.2T = 1.2 T=1.2, the model is not hallucinating randomly. It is sampling from regions of the distribution that exist, that were shaped by real training data, but that are rarely the right answer to this question. *Bizarro Wonder Woman* is in there because the model has read about Bizarro Wonder Woman. The problem isn&#8217;t invention&#8212;it&#8217;s sampling too far into the legitimate but irrelevant.</p><p>The design insight: <em>you are not configuring an intelligence. You are reshaping a distribution.</em> The intelligence&#8212;such as it is&#8212;emerges from the shape of what was learned. Your job, as a user or a system builder, is to choose the right sampling regime for the task at hand.</p><p>For auditable facts: low temperature, tight truncation, verify outputs. For brainstorming: moderate temperature, wide nucleus, expect variance. For creative synthesis: high temperature in the creative sections, low temperature in the factual anchors, aggregate across multiple draws.</p><p>The model is a stochastic machine. It has always been a stochastic machine. The only question is whether you are steering it or just hoping.</p><div><hr></div><h2>LLM Exercises</h2><p><strong>Exercise 1 &#8212; Temperature Variance Lab</strong></p><p>Choose a prompt with both a factual component (a specific number, date, or name) and a stylistic component (a tone, a metaphor, a voice). Run N=20N = 20 N=20 generations at T&#8712;{0,0.7,1.2}T \in \{0, 0.7, 1.2\} T&#8712;{0,0.7,1.2} with identical truncation settings.</p><p>Compute the unique completion rate:</p><p>U=# unique outputsNU = \frac{\text{\# unique outputs}}{N}U=N# unique outputs&#8203;</p><p>Also compute the average pairwise Levenshtein distance across completions at each temperature. Plot UU U and mean distance as functions of TT T.</p><p>*Prompt to Claude:* &#8220;I&#8217;m running this experiment and have my completion data as a list of strings. Write Python code that computes UU U and the average pairwise Levenshtein distance for a list of NN N text completions. Then help me interpret the results&#8212;what does a UU U close to 1.0 mean for system reliability versus a UU U close to 1/N1/N 1/N?&#8221;</p><div><hr></div><p><strong>Exercise 2 &#8212; Top-K vs. Top-P Failure Mode Mapping</strong></p><p>Hold temperature fixed at T=0.7T = 0.7 T=0.7. Vary K&#8712;{3,20,200}K \in \{3, 20, 200\} K&#8712;{3,20,200} and p&#8712;{0.5,0.9,0.99}p \in \{0.5, 0.9, 0.99\} p&#8712;{0.5,0.9,0.99} across the same creative writing prompt.</p><p>Your goal is to map the <em>failure modes</em>, not just the outputs. For each setting, identify whether the failure (if any) is: (a) repetition and brittleness, (b) incoherence and drift, or (c) neither.</p><p><em>Prompt to Claude:</em> &#8220;Here are six completions from a creative writing prompt under different Top-K and Top-P settings. For each one, tell me: is this failure mode (a) repetitive/brittle, (b) incoherent/drifting, or (c) neither? Then explain what the sampling setting was likely doing mathematically to produce that outcome.&#8221;</p><div><hr></div><p><strong>Exercise 3 &#8212; Expert Default Bias Investigation</strong></p><p>Replicate the proficiency role-play experiment. Prompt a capable LLM (GPT-4o, Claude, or equivalent) to simulate four students&#8212;A, B, C, and D proficiency&#8212;solving the same arithmetic problem. Record not just the final answer but the intermediate steps.</p><p>Now try a <em>harder</em> problem&#8212;one where a realistic intermediate error is possible (e.g., a multi-step percentage calculation). Does the Expert Default Bias hold? At what point does the model begin to generate plausible errors?</p><p><em>Prompt to Claude:</em> &#8220;I&#8217;ve run the proficiency role-play experiment and collected outputs. Help me analyze whether the model&#8217;s logical execution actually changed between proficiency levels, or only the surface presentation. What statistical test would distinguish genuine logical variation from stylistic variation?&#8221;</p><div><hr></div><p><strong>Exercise 4 &#8212; Design an Agentic Sampling Policy</strong></p><p>Define a two-phase generation task: (a) produce a structured outline for a technical explanation, (b) write the final explanation for a non-expert audience.</p><p>For each phase, specify: temperature, truncation method (Top-K or Top-P), number of samples to generate, and any evaluation criterion used to select among samples.</p><p>Justify each choice in terms of the confidence signal &#916;t\Delta_t &#916;t&#8203; and the entropy H(pT)H(p_T) H(pT&#8203;) you would expect in each phase.</p><p><em>Prompt to Claude:</em> &#8220;Review my agentic sampling policy specification. For each phase, tell me: (1) whether my temperature choice is appropriate given the expected entropy of the task, (2) whether Top-K or Top-P is better suited and why, and (3) what evaluation criterion you would use to select the best output from multiple samples.&#8221;</p><div><hr></div><p><strong>Exercise 5 &#8212; CASE Bandit Framing</strong></p><p>You are building a few-shot prompt for a classification task. You have 20 candidate examples and need to choose 5. Brute-force search requires testing (205)=15,504\binom{20}{5} = 15{,}504 (520&#8203;)=15,504 combinations.</p><p>Frame this as a multi-arm bandit problem. Define: what is the &#8220;arm,&#8221; what is the &#8220;reward,&#8221; what is the exploration-exploitation tradeoff, and how would you implement a simple &#1013;\epsilon &#1013;-greedy strategy to reduce the number of required LLM calls?</p><p>*Prompt to Claude:* &#8220;I&#8217;ve framed my exemplar selection problem as a multi-arm bandit with arms defined as [your definition]. Help me implement a basic &#1013;\epsilon &#1013;-greedy search that: (1) starts with random sampling of arm subsets, (2) exploits the current best arm with probability 1&#8722;&#1013;1 - \epsilon 1&#8722;&#1013;, and (3) tracks running accuracy estimates. Then explain where the CASE framework&#8217;s gap-index strategy improves on this naive approach.&#8221;</p><div><hr></div><p><strong>Exercise 6 &#8212; Wonder Woman Stochastic Audit</strong></p><p>Use the Wonder Woman/Boeing 737 prompt as a benchmark. Run it 10 times at T=0T = 0 T=0 and 10 times at T=1.0T = 1.0 T=1.0.</p><p>For each output, classify every factual claim as: (a) correct and consistent, (b) correct but phrased differently, (c) correct but with irrelevant additions, or (d) factually drifted.</p><p>Compute the drift rate D=(d) outputs/ND = \text{(d) outputs} / N D=(d) outputs/N at each temperature.</p><p><em>Prompt to Claude:</em> &#8220;Here are my 20 Wonder Woman/Boeing completions with their temperature settings. Classify each factual claim using the four-category scheme and compute the drift rate at each temperature. Then explain: at what point in the probability distribution does &#8216;irrelevant but accurate&#8217; (category c) transition to &#8216;factually drifted&#8217; (category d)? What does this tell us about where the model&#8217;s knowledge of these two facts actually lives in its weights?&#8221;</p>]]></content:encoded></item><item><title><![CDATA[Prompt Engineering with LLMs]]></title><description><![CDATA[A Rigorous Framework for Designing, Evaluating, and Scaling Language Model Interactions]]></description><link>https://agenticreinforcementlearning.substack.com/p/prompt-engineering-with-llms</link><guid isPermaLink="false">https://agenticreinforcementlearning.substack.com/p/prompt-engineering-with-llms</guid><dc:creator><![CDATA[Nik Bear Brown]]></dc:creator><pubDate>Wed, 18 Feb 2026 20:53:35 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Alpq!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F420f4c55-6bac-4a7f-a289-344e1058f2b9_3458x3458.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>A Rigorous Framework for Designing, Evaluating, and Scaling Language Model Interactions</h3><p><strong>Author:</strong> Professor Nik Bear Brown<br><strong>Institution:</strong> Northeastern University, College of Engineering<br><strong>Series:</strong> INFO 7375 &#8212; Prompt Engineering for Generative AI</p><div><hr></div><h2>Table of Contents</h2><div><hr></div><h3>Preface: Why Prompt Engineering Is an Engineering Discipline</h3><div><hr></div><h2>PART I &#8212; FOUNDATIONS: HOW LANGUAGE MODELS THINK (AND DON&#8217;T)</h2><div><hr></div><p><strong>Chapter 1: The Stochastic Machine &#8212; Understanding LLM Output Generation</strong></p><ul><li><p><strong>Core Claim:</strong> LLMs do not retrieve answers &#8212; they sample from learned probability distributions, making every output a probabilistic event, not a deterministic lookup.</p></li><li><p><strong>Logical Method:</strong> Deductive reasoning from first principles of softmax probability and logit distributions to explain temperature, Top-K, and Top-P sampling mechanics.</p></li><li><p><strong>Methodological Soundness:</strong> Grounded in the mathematical formalism of transformer decoding; claims are falsifiable through controlled temperature experiments producing measurable output variance.</p></li><li><p><strong>Use of LLMs:</strong> Demonstrations using the same prompt at temperature 0, 0.7, and 1.2 to empirically observe the distribution-flattening effect; &#8220;Wonder Woman&#8221; stochastic variance case study.</p></li><li><p><strong>Use of Agentic AI:</strong> Agentic loops that adaptively adjust sampling parameters mid-task based on confidence scoring of prior outputs.</p></li></ul><div><hr></div><p><strong>Chapter 2: Hallucination &#8212; When Plausibility Beats Truth</strong></p><ul><li><p><strong>Core Claim:</strong> Hallucination is not a bug to be patched but an emergent property of next-token prediction trained on human text, where fluency and factual grounding are orthogonal objectives.</p></li><li><p><strong>Logical Method:</strong> Inductive reasoning from documented hallucination cases (fabricated citations, false statistics) to a general model of why plausibility diverges from accuracy.</p></li><li><p><strong>Methodological Soundness:</strong> Uses reproducible prompt experiments that reliably elicit hallucination; distinguishes between factual hallucination, attribution hallucination, and coherence hallucination as distinct failure modes.</p></li><li><p><strong>Use of LLMs:</strong> Live prompt experiments asking models about obscure facts, forcing citation generation, and auditing outputs against ground truth.</p></li><li><p><strong>Use of Agentic AI:</strong> Fact Check List Pattern embedded in agentic pipelines; agents that cross-reference claims against retrieval systems before surfacing outputs.</p></li></ul><div><hr></div><p><strong>Chapter 3: The Chinese Room and the Limits of Syntax</strong></p><ul><li><p><strong>Core Claim:</strong> LLMs are powerful symbol manipulators, but Searle&#8217;s Chinese Room argument reminds us that syntactic competence does not entail semantic understanding &#8212; a distinction with profound implications for prompt design.</p></li><li><p><strong>Logical Method:</strong> Philosophical deduction from Searle&#8217;s thought experiment mapped onto transformer architecture; argument by analogy and systematic counter-argument.</p></li><li><p><strong>Methodological Soundness:</strong> Engages with standard objections (Systems Reply, Robot Reply) and situates them within empirical NLP findings on commonsense reasoning failures.</p></li><li><p><strong>Use of LLMs:</strong> Prompts designed to probe &#8220;understanding&#8221; vs. pattern matching &#8212; e.g., Winograd schemas, counterfactual reasoning tasks, and symbol substitution experiments.</p></li><li><p><strong>Use of Agentic AI:</strong> Discussion of how agentic AI architectures (tool-use, memory, planning) partially address the Chinese Room limitation by anchoring symbolic operations to real-world feedback loops.</p></li></ul><div><hr></div><p><strong>Chapter 4: Sycophancy and Computational Skepticism</strong></p><ul><li><p><strong>Core Claim:</strong> LLMs are trained to maximize approval, not accuracy &#8212; making sycophancy a systematic bias that users must actively counteract through computational skepticism.</p></li><li><p><strong>Logical Method:</strong> Causal reasoning tracing sycophancy from RLHF reward structures through to output-level behaviors; proposes computational skepticism as the epistemically correct response.</p></li><li><p><strong>Methodological Soundness:</strong> Empirically grounded in documented RLHF alignment research; sycophancy is operationalized as a measurable divergence between model agreement rate and ground-truth accuracy rate.</p></li><li><p><strong>Use of LLMs:</strong> Experiments where the user asserts a false claim and observes whether the model capitulates; A/B testing prompts with and without explicit anti-sycophancy constraints.</p></li><li><p><strong>Use of Agentic AI:</strong> Agents designed with dissenting sub-agents (red-team agents) that challenge primary agent outputs before they surface to the user.</p></li></ul><div><hr></div><h2>PART II &#8212; PROMPT ENGINEERING FRAMEWORKS</h2><div><hr></div><p><strong>Chapter 5: The Architect Mindset &#8212; Designing Prompts as Systems</strong></p><ul><li><p><strong>Core Claim:</strong> Effective prompt engineering requires the Architect Mindset &#8212; designing the full prompt system (root prompts, constraints, persona, format) rather than crafting individual queries ad hoc.</p></li><li><p><strong>Logical Method:</strong> Analogical reasoning from software architecture to prompt architecture; introduces the distinction between Architect-level design decisions and User-level interaction patterns.</p></li><li><p><strong>Methodological Soundness:</strong> Framework validated through comparative studies of ad hoc prompting vs. structured prompt system design across multiple task types.</p></li><li><p><strong>Use of LLMs:</strong> Constructing and testing root prompts that persist behavioral constraints across multi-turn conversations; the Wordsville case study as a worked example.</p></li><li><p><strong>Use of Agentic AI:</strong> System-level prompt stacks in agentic pipelines where the Architect layer governs agent scope, persona, and guardrails across an entire autonomous task.</p></li></ul><div><hr></div><p><strong>Chapter 6: Persona Patterns &#8212; Shaping Who the Model Is and Who It Speaks To</strong></p><ul><li><p><strong>Core Claim:</strong> Two distinct and frequently confused patterns &#8212; the Persona Pattern (who the AI <em>is</em>) and the Audience Persona Pattern (who the AI speaks <em>to</em>) &#8212; each activate different latent behaviors in the model and must be applied with precision.</p></li><li><p><strong>Logical Method:</strong> Taxonomic differentiation through definition, contrast, and worked examples; logical analysis of how each pattern affects the model&#8217;s internal framing of the task.</p></li><li><p><strong>Methodological Soundness:</strong> Distinctions are operationally testable: swapping Persona for Audience Persona in identical prompts produces measurably different outputs in vocabulary, register, and depth.</p></li><li><p><strong>Use of LLMs:</strong> The Jane Austen prompt as a Persona Pattern exemplar; the non-technical executive explanation as an Audience Persona exemplar; side-by-side output comparison.</p></li><li><p><strong>Use of Agentic AI:</strong> Assigning persistent personas to specialized sub-agents (e.g., &#8220;You are a compliance auditor&#8221;) within a multi-agent orchestration framework.</p></li></ul><div><hr></div><p><strong>Chapter 7: Constraint Engineering &#8212; Negative Prompts, Root Prompts, and Semantic Focus</strong></p><ul><li><p><strong>Core Claim:</strong> What you tell a model <em>not</em> to do is as architecturally important as what you tell it to do &#8212; negative constraints sharpen semantic focus and reduce output entropy in ways positive instructions alone cannot achieve.</p></li><li><p><strong>Logical Method:</strong> Contrastive analysis demonstrating how negative constraints reduce the probability mass on undesired output regions; grounded in the mechanics of conditional probability in token generation.</p></li><li><p><strong>Methodological Soundness:</strong> Controlled experiments measuring output variance and constraint adherence with and without negative prompts across diverse task types.</p></li><li><p><strong>Use of LLMs:</strong> Examples of prompts with and without negative constraints (&#8221;avoid jargon,&#8221; &#8220;do not hedge,&#8221; &#8220;never use bullet points&#8221;) with annotated output comparisons.</p></li><li><p><strong>Use of Agentic AI:</strong> Encoding negative constraints as persistent guardrails in root prompts of agentic systems; Semantic Filter agents that post-process outputs to enforce content policies.</p></li></ul><div><hr></div><p><strong>Chapter 8: PAST, PLFR, and Structured Prompt Frameworks</strong></p><ul><li><p><strong>Core Claim:</strong> Structured prompt frameworks &#8212; PAST (Problem, Action, Steps, Task) and PLFR (Prompt, Logic, Format, Result) &#8212; impose logical scaffolding that reduces ambiguity and improves output reliability at scale.</p></li><li><p><strong>Logical Method:</strong> Deductive derivation of each framework&#8217;s component logic; analysis of how structured decomposition maps complex user intent onto model-interpretable instruction sequences.</p></li><li><p><strong>Methodological Soundness:</strong> Frameworks evaluated on prompt clarity, output reproducibility, and task completion rate compared to unstructured prompts; edge cases and failure modes documented.</p></li><li><p><strong>Use of LLMs:</strong> Applying PAST and PLFR to real professional tasks (data analysis requests, report generation, code review) with before/after output quality assessments.</p></li><li><p><strong>Use of Agentic AI:</strong> Using PAST as the task decomposition backbone for agentic planning modules; PLFR as a structured format for agent-to-agent communication within a pipeline.</p></li></ul><div><hr></div><h2>PART III &#8212; ADVANCED PATTERNS AND ARCHITECTURES</h2><div><hr></div><p><strong>Chapter 9: Interaction Patterns &#8212; Flipping the Conversation</strong></p><ul><li><p><strong>Core Claim:</strong> The most powerful prompt patterns are not declarative but interactive &#8212; patterns like Flipped Interaction, Ask for Input, and Cognitive Verifier shift the model from passive responder to active collaborator, dramatically improving output quality on ill-specified tasks.</p></li><li><p><strong>Logical Method:</strong> Taxonomic classification of interaction patterns by their epistemic function (information elicitation, task clarification, reasoning decomposition); argument that interactivity reduces underdetermination of the prompt.</p></li><li><p><strong>Methodological Soundness:</strong> Empirical comparison of direct-answer prompting vs. interactive pattern prompting on open-ended tasks; measured by output relevance and task completion accuracy.</p></li><li><p><strong>Use of LLMs:</strong> Worked examples of Flipped Interaction (model interviews the user), Cognitive Verifier (model generates sub-questions), and Question Refinement (model proposes a better question).</p></li><li><p><strong>Use of Agentic AI:</strong> Multi-turn agentic workflows where agents autonomously apply Ask for Input before executing tasks, reducing error rates from ambiguous instructions.</p></li></ul><div><hr></div><p><strong>Chapter 10: ReAct &#8212; Grounding Reasoning in the Real World</strong></p><ul><li><p><strong>Core Claim:</strong> The ReAct (Reasoning and Acting) framework solves a fundamental limitation of pure chain-of-thought prompting by interleaving thought with action &#8212; allowing models to query external tools and ground each reasoning step in real observations rather than internal hallucination.</p></li><li><p><strong>Logical Method:</strong> Mechanistic analysis of the Thought &#8594; Action &#8594; Observation loop; logical argument for why external grounding reduces cumulative reasoning error compared to closed-chain inference.</p></li><li><p><strong>Methodological Soundness:</strong> Referenced against the original ReAct paper (Yao et al., 2022); brittleness under few-shot distribution shift is explicitly documented as a known limitation.</p></li><li><p><strong>Use of LLMs:</strong> Step-by-step ReAct trace examples for web search, database lookup, and code execution tasks; few-shot example construction and its effect on task accuracy.</p></li><li><p><strong>Use of Agentic AI:</strong> ReAct as the core reasoning architecture for autonomous agents; multi-step agentic tasks (e.g., research summarization, data validation pipelines) implemented as ReAct loops with tool registries.</p></li></ul><div><hr></div><p><strong>Chapter 11: The Prompt Stack &#8212; Scalable AI Infrastructure</strong></p><ul><li><p><strong>Core Claim:</strong> Production AI systems cannot be built on single-turn prompts &#8212; the Prompt Stack architecture (pre-prompts, meta-prompts, user prompts, output filters) provides the modular infrastructure required for maintainable, scalable, and auditable LLM deployments.</p></li><li><p><strong>Logical Method:</strong> Systems engineering reasoning applied to prompt design; argument by analogy to software layered architecture (OS, middleware, application).</p></li><li><p><strong>Methodological Soundness:</strong> Framework evaluated against real deployment scenarios (chatbots, RAG pipelines, multi-agent systems) for modularity, debuggability, and component replaceability.</p></li><li><p><strong>Use of LLMs:</strong> Building a complete Prompt Stack for a realistic use case (e.g., a university academic advisor bot); demonstrating how each stack layer can be updated independently.</p></li><li><p><strong>Use of Agentic AI:</strong> Prompt Stack as the governance layer for multi-agent systems &#8212; pre-prompts encode agent identity, meta-prompts encode task routing logic, user prompts carry dynamic context.</p></li></ul><div><hr></div><p><strong>Chapter 12: Chain-of-Thought, Few-Shot, and Meta Language Creation</strong></p><ul><li><p><strong>Core Claim:</strong> Chain-of-thought prompting, few-shot exemplars, and Meta Language Creation are complementary techniques that exploit the model&#8217;s in-context learning capacity &#8212; but each has distinct failure modes that disciplined prompt engineers must anticipate.</p></li><li><p><strong>Logical Method:</strong> Comparative analysis of zero-shot, few-shot, and chain-of-thought prompting on a common benchmark task set; formal definition of Meta Language Creation as a prompt-level DSL (domain-specific language).</p></li><li><p><strong>Methodological Soundness:</strong> Claims grounded in empirical NLP literature (Wei et al. on chain-of-thought; Brown et al. on few-shot); failure modes (exemplar bias, format overfitting) are operationalized and demonstrated.</p></li><li><p><strong>Use of LLMs:</strong> Constructing few-shot exemplars for a structured data extraction task; building a Meta Language for a recurring analytical workflow (e.g., &#8220;ANALYZE:[text] FORMAT:[table] VERIFY:[sources]&#8221;).</p></li><li><p><strong>Use of Agentic AI:</strong> Agents that dynamically construct chain-of-thought prompts for sub-tasks; Meta Language as a structured communication protocol between orchestrator and worker agents.</p></li></ul><div><hr></div><h2>PART IV &#8212; FINE-TUNING, ALIGNMENT, AND SCALING</h2><div><hr></div><p><strong>Chapter 13: SFT vs. RAG &#8212; When to Bake Knowledge In vs. Retrieve It</strong></p><ul><li><p><strong>Core Claim:</strong> Supervised Fine-Tuning and Retrieval-Augmented Generation are not competing alternatives but complementary strategies with distinct cost-benefit profiles &#8212; the choice between them is an engineering decision driven by knowledge volatility, latency requirements, and update frequency.</p></li><li><p><strong>Logical Method:</strong> Decision-theoretic framework comparing SFT and RAG on five axes: knowledge freshness, inference cost, training cost, hallucination risk, and deployment complexity.</p></li><li><p><strong>Methodological Soundness:</strong> Framework validated through case studies spanning static knowledge domains (SFT preferred) and dynamic knowledge domains (RAG preferred); hybrid architectures addressed.</p></li><li><p><strong>Use of LLMs:</strong> Prompt experiments illustrating the knowledge boundary of a pre-trained model vs. a RAG-augmented pipeline on current events and proprietary data tasks.</p></li><li><p><strong>Use of Agentic AI:</strong> Agentic systems that dynamically route queries to fine-tuned models vs. RAG pipelines based on query classification; the &#8220;80 Days to Stay&#8221; SEC data retrieval system as a worked case study.</p></li></ul><div><hr></div><p><strong>Chapter 14: LoRA and QLoRA &#8212; Parameter-Efficient Fine-Tuning</strong></p><ul><li><p><strong>Core Claim:</strong> LoRA and QLoRA make fine-tuning democratically accessible by decomposing weight updates into low-rank matrices (LoRA) and combining this with 4-bit quantization (QLoRA) &#8212; reducing GPU memory requirements by orders of magnitude without proportional loss in task performance.</p></li><li><p><strong>Logical Method:</strong> Mathematical derivation of the low-rank decomposition logic (W = W&#8320; + BA); analysis of how NF4 quantization and Paged Optimizers address memory bottlenecks in QLoRA.</p></li><li><p><strong>Methodological Soundness:</strong> Claims grounded in the original LoRA (Hu et al., 2021) and QLoRA (Dettmers et al., 2023) papers; parameter reduction ratios (10&#215;&#8211;100&#215;) are empirically sourced and reproducible.</p></li><li><p><strong>Use of LLMs:</strong> Step-by-step walkthrough of fine-tuning a base LLM with QLoRA on a custom instruction dataset; comparison of fine-tuned vs. base model output on held-out test prompts.</p></li><li><p><strong>Use of Agentic AI:</strong> Deploying LoRA-adapted models as specialized agents (e.g., a domain-specific compliance agent); adapter swapping in multi-agent systems where different tasks route to different LoRA modules.</p></li></ul><div><hr></div><p><strong>Chapter 15: RLHF, DPO, and Alignment &#8212; Training Models to Do What We Mean</strong></p><ul><li><p><strong>Core Claim:</strong> RLHF is the dominant method for aligning LLM behavior with human values, but it introduces systematic risks &#8212; sycophancy, reward hacking, and value misspecification &#8212; that DPO and Constitutional AI partially mitigate through architectural alternatives.</p></li><li><p><strong>Logical Method:</strong> Causal chain analysis from reward model construction through policy gradient updates to observed alignment failures; formal comparison of RLHF, DPO, and Constitutional AI objective functions.</p></li><li><p><strong>Methodological Soundness:</strong> Grounded in Ouyang et al. (InstructGPT), Rafailov et al. (DPO), and Bai et al. (Constitutional AI); failure modes are empirically documented, not merely theoretical.</p></li><li><p><strong>Use of LLMs:</strong> Experiments probing sycophancy in RLHF-trained vs. DPO-trained models; prompts designed to elicit reward hacking behavior; Fact Check List as a prompt-level sycophancy mitigation.</p></li><li><p><strong>Use of Agentic AI:</strong> Red-team agents in alignment evaluation pipelines; agentic Constitutional AI implementations where agents self-critique outputs against a defined principle set before delivery.</p></li></ul><div><hr></div><p><strong>Chapter 16: Catastrophic Forgetting, Chinchilla, and the Science of Scaling</strong></p><ul><li><p><strong>Core Claim:</strong> Scaling language models is not simply a matter of adding parameters &#8212; the Chinchilla Scaling Law establishes that optimal performance requires proportional scaling of both model size and training data, while catastrophic forgetting imposes hard constraints on sequential fine-tuning.</p></li><li><p><strong>Logical Method:</strong> Empirical induction from scaling law experiments (Hoffmann et al., 2022) to general principles; mechanistic analysis of catastrophic forgetting as gradient interference in neural weight space.</p></li><li><p><strong>Methodological Soundness:</strong> Chinchilla compute-optimal ratio (approximately 20 tokens per parameter) is empirically derived and contrasted against the GPT-3 paradigm; inference-aware scaling is introduced as a practical complement.</p></li><li><p><strong>Use of LLMs:</strong> Case studies comparing models trained under Chinchilla-optimal vs. under-data-trained regimes on downstream benchmarks; prompts that surface capability degradation from catastrophic forgetting.</p></li><li><p><strong>Use of Agentic AI:</strong> Inference-aware scaling decisions for deploying agents at different capability tiers; continual learning architectures for agents that must update without forgetting prior task competencies.</p></li></ul><div><hr></div><h2>PART V &#8212; SYNTHESIS AND PROFESSIONAL PRACTICE</h2><div><hr></div><p><strong>Chapter 17: Cross-Module Integration &#8212; Connecting Prompt Design to Model Behavior</strong></p><ul><li><p><strong>Core Claim:</strong> The most consequential prompt engineering decisions sit at the intersection of modules &#8212; understanding how RLHF-induced sycophancy interacts with Persona Patterns, or how ReAct brittleness connects to few-shot design, unlocks the next level of engineering judgment.</p></li><li><p><strong>Logical Method:</strong> Systematic cross-mapping of concepts across all four course modules; identification of second-order interaction effects that single-module analysis misses.</p></li><li><p><strong>Methodological Soundness:</strong> Each cross-module claim is supported by a concrete, reproducible prompt experiment that isolates the interaction effect from confounding variables.</p></li><li><p><strong>Use of LLMs:</strong> Multi-concept prompt designs that intentionally activate cross-module dynamics; the defense bot and Humanitarians AI volunteer onboarding system as integrated case studies.</p></li><li><p><strong>Use of Agentic AI:</strong> Full agentic system design exercises that require simultaneous application of prompt stacks, fine-tuned models, ReAct reasoning, and alignment-aware output evaluation.</p></li></ul><div><hr></div><p><strong>Chapter 18: Ethical Prompt Engineering &#8212; Power, Bias, and Responsibility</strong></p><ul><li><p><strong>Core Claim:</strong> Prompt engineers wield disproportionate power over model behavior, and with that power comes an obligation to understand how prompts can amplify bias, marginalize voices, or weaponize AI systems &#8212; making ethics not an addendum but a design constraint.</p></li><li><p><strong>Logical Method:</strong> Normative ethical reasoning (consequentialist and deontological frameworks) applied to prompt design decisions; argument that ethical constraints are formally analogous to negative prompt constraints.</p></li><li><p><strong>Methodological Soundness:</strong> Grounded in documented cases of prompt injection, jailbreaking, persona manipulation, and biased output amplification; proposes auditable prompt design practices as structural mitigations.</p></li><li><p><strong>Use of LLMs:</strong> Prompt auditing exercises that surface bias in output distributions; red-teaming prompts to expose safety vulnerabilities in deployed systems.</p></li><li><p><strong>Use of Agentic AI:</strong> Ethical guardrail architectures for autonomous agents; Constitutional AI principles as an operationalized ethics layer; human-in-the-loop checkpoints in high-stakes agentic workflows.</p></li></ul><div><hr></div><p><strong>Chapter 19: Building Production Prompt Systems &#8212; From Prototype to Pipeline</strong></p><ul><li><p><strong>Core Claim:</strong> A prompt that works in a notebook is not a production system &#8212; moving from prototype to pipeline requires versioning, evaluation frameworks, monitoring, and modular architecture that treats prompts as first-class software artifacts.</p></li><li><p><strong>Logical Method:</strong> Software engineering principles (modularity, testability, observability) translated into prompt system design requirements; lifecycle model from initial design through deployment and iteration.</p></li><li><p><strong>Methodological Soundness:</strong> Framework instantiated through a complete worked example (a production student advising agent) with evaluation rubrics, version history, and monitoring dashboards.</p></li><li><p><strong>Use of LLMs:</strong> Prompt versioning and regression testing strategies; automated output evaluation using LLM-as-judge pipelines; A/B testing frameworks for prompt variants.</p></li><li><p><strong>Use of Agentic AI:</strong> Full agentic pipeline architecture with orchestration, tool registration, state management, error recovery, and human escalation paths; deployment patterns for the Mycroft investment intelligence and Madison marketing intelligence frameworks.</p></li></ul><div><hr></div><p><strong>Chapter 20: The Future of Prompt Engineering &#8212; Inference-Aware Scaling, Multimodal Prompting, and Beyond</strong></p><ul><li><p><strong>Core Claim:</strong> Prompt engineering is a field in rapid transition &#8212; inference-aware scaling, multimodal inputs, long-context architectures, and increasingly autonomous agents are reshaping what &#8220;a prompt&#8221; even means, requiring practitioners to build adaptive mental models rather than fixed playbooks.</p></li><li><p><strong>Logical Method:</strong> Extrapolative reasoning from current technical trajectories; distinguishes between near-term engineering predictions (high confidence) and long-term capability claims (appropriately hedged).</p></li><li><p><strong>Methodological Soundness:</strong> Grounded in published research on inference scaling (o1/o3 paradigm), multimodal LLMs, and agent benchmarking; speculative claims are explicitly flagged and bounded.</p></li><li><p><strong>Use of LLMs:</strong> Multimodal prompt experiments combining text, image, and structured data; long-context prompting strategies for document-scale reasoning tasks.</p></li><li><p><strong>Use of Agentic AI:</strong> Vision of fully autonomous prompt-engineering agents that iteratively refine their own system prompts based on output evaluation feedback &#8212; and the risks this introduces for alignment and interpretability.</p></li></ul><div><hr></div><h2>Appendices</h2><p><strong>Appendix A:</strong> Prompt Pattern Reference Card<br><strong>Appendix B:</strong> Sampling Parameter Cheat Sheet (Temperature, Top-K, Top-P)<br><strong>Appendix C:</strong> Fine-Tuning Decision Framework (SFT vs. RAG vs. LoRA vs. QLoRA)<br><strong>Appendix D:</strong> Glossary of Core Concepts<br><strong>Appendix E:</strong> Annotated Bibliography and Further Reading<br><strong>Appendix F:</strong> INFO 7375 Midterm Study Guide (Modules 1, 2, 3, and 6)</p><div><hr></div><p><em>&#8220;The question is never whether you can get the model to say something. The question is whether you understand why it said it &#8212; and what that means for the next ten outputs you haven&#8217;t seen yet.&#8221;</em> &#8212; Professor Nik Bear Brown</p>]]></content:encoded></item></channel></rss>