<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tauan Sloboda on Medium]]></title>
        <description><![CDATA[Stories by Tauan Sloboda on Medium]]></description>
        <link>https://medium.com/@tauanvinicius?source=rss-9f3ba46c7dbd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*z-p-8WSOpxUHv6tB</url>
            <title>Stories by Tauan Sloboda on Medium</title>
            <link>https://medium.com/@tauanvinicius?source=rss-9f3ba46c7dbd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:46:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tauanvinicius/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Battle of Architectures: Static Instruction Accumulation versus Dynamic Semantic Routing in…]]></title>
            <link>https://medium.com/@tauanvinicius/the-battle-of-architectures-static-instruction-accumulation-versus-dynamic-semantic-routing-in-f93ead3ad348?source=rss-9f3ba46c7dbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f93ead3ad348</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[ai-infrastructure]]></category>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <dc:creator><![CDATA[Tauan Sloboda]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 02:11:36 GMT</pubDate>
            <atom:updated>2026-08-12T02:11:36.310Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Battle of Architectures: Static Instruction Accumulation versus Dynamic Semantic Routing in Enterprise LLM Extraction</h3><p><strong>Tauan Vinicius Guahyba Sloboda</strong></p><h3>Abstract</h3><p>Enterprise LLM systems routinely accumulate safety policies, compliance rules, formatting instructions, domain guidance, tone requirements, and exception handling inside long, static System Prompts. This practice is widespread, yet its real effect on token consumption, monetary cost, latency, operational stability, and extraction accuracy has remained largely unmeasured.</p><p>We conducted Experiment Two — <em>The Battle of Architectures</em> — as a controlled comparison between static instruction accumulation and dynamic semantic routing. Route A executed a single gpt-4o-2024-11-20 call preceded by a synthetic 8,192-token corporate System Prompt. Route B used a two-stage architecture: gpt-4o-mini-2024-07-18 converted a noisy user request into a compact Narrative Gravity formula, and gpt-4o-2024-11-20 executed that formula against the same chaotic email thread. Both final calls used temperature 0, a 128-token output ceiling, identical source material, and no Structured Outputs.</p><p>Across 50 preregistered paired observations, Route B reduced total token consumption by <strong>74.47%</strong>, from 10,282.28 to 2,624.84 tokens per pipeline. It reduced observed monetary cost by <strong>67.54%</strong>, from US$0.0136206 to US$0.0044209 per extraction, despite paying for an additional model call. Under a no-cache counterfactual, the reduction increased to <strong>78.87%</strong>. Route B achieved <strong>100% normalized material accuracy</strong>, compared with <strong>72%</strong> for Route A. Route A failed the normalized extraction contract in 14 of 50 calls; Route B failed in none.</p><p>The latency result separated model service time from operational wall time. Route A completed its single inference faster on average — 2.257 seconds versus 3.246 seconds for Route B’s two sequential calls. Under token-per-minute admission control, however, Route A required an average operational wall time of 24.202 seconds, compared with 3.284 seconds for Route B. Route B therefore reduced operational wall time by <strong>86.43%</strong>.</p><p>These results establish dynamic semantic routing as the superior architecture for this enterprise extraction benchmark. It simultaneously reduced cost, reduced total token mass, eliminated normalized material errors, and prevented the rate-limit collapse produced by the hypertrophied static System Prompt.</p><h3>1. Introduction</h3><p>The standard enterprise response to LLM unpredictability is instruction accumulation. A deployment begins with a small System Prompt. Safety language is added. Then privacy rules, legal qualifications, audit requirements, tone guidance, formatting conventions, fallback logic, regional policies, product-specific exceptions, and instructions governing how the previous instructions should be reconciled. The prompt becomes an organizational sediment layer: every incident deposits another rule, while almost nothing is removed.</p><p>Prompt caching documentation itself identifies repeated System Prompts and common instructions as central reusable prefixes in production workloads. The infrastructure therefore recognizes static instruction accumulation as a normal operating pattern. Caching reduces the price and latency of exact-prefix reuse, but it does not remove those instructions from the model’s active context.</p><p>This architecture is rarely measured as an architecture. Teams track whether the model follows policy, but not how much computational friction the accumulated policy creates. A static System Prompt is treated as fixed overhead rather than as an active component of inference. The result is a blind spot: organizations optimize model selection, quantization, caching, batching, and output length while leaving the semantic topology of the request unexamined.</p><p>The Semantic Thermodynamics framework treats that topology as an engineering variable. Its first article established Narrative Gravity as a structured constraint field composed of operational identity, objective, scope, negative constraints, output form, and failure state. Its second article formalized Narrative Pruning: the contraction of the effective output phase space before the executor begins materializing a response.</p><p>Within this framework, instruction volume and useful constraint are not equivalent. A relevant boundary removes degrees of freedom. A redundant boundary consumes context without reducing uncertainty. A conflicting boundary creates Structural Friction. A generic corporate rule that does not resolve any uncertainty in the current task remains semantically active while contributing no task-specific compression.</p><p>Transformers connect tokens through attention-based representations, making context an active computational field rather than a passive document attached to the request. Long-context research has also established that additional context does not translate automatically into robust use of information; performance changes with the position and distribution of relevant evidence. A larger context window provides capacity, not immunity from contextual interference.</p><p>Experiment Two asks a direct architectural question:</p><blockquote><strong><em>Can a two-stage system — a small semantic micro-router followed by a large executor — outperform a single large-model call governed by an 8K-token static System Prompt?</em></strong></blockquote><p>The answer is yes.</p><p>Route B reduced total tokens by 74.47%, reduced actual cost by 67.54%, reduced no-cache cost by 78.87%, and increased normalized material accuracy from 72% to 100%. Route A retained an advantage in mean service latency because it used one model call rather than two. That advantage disappeared at the operational layer, where its atomic token footprint forced prolonged admission waits and had already destroyed the first ungated execution of the benchmark.</p><p>The result is not a conventional cost-quality trade-off. Route B was both cheaper and more accurate.</p><h3>2. Semantic Thermodynamics as an Architectural Model</h3><h3>2.1 Static instruction accumulation</h3><p>Let:</p><ul><li><strong>S</strong> denote the static corporate System Prompt;</li><li><strong>U</strong> denote the user request;</li><li><strong>D</strong> denote the source document;</li><li><strong>M</strong> denote the executor model.</li></ul><p>Route A is defined as:</p><p><strong>Yₐ = M(S ⊕ U ⊕ D)</strong></p><p>where <strong>⊕</strong> denotes contextual concatenation.</p><p>This architecture submits the complete policy layer on every request. Prompt caching changes how the repeated prefix is priced and prefetched, but the model still conditions its output on the full instruction field.</p><p>The static prompt therefore imposes two distinct costs:</p><p><strong>Cₐ = Cprefill(S,U,D) + Cdecode(Yₐ)</strong></p><p>and</p><p><strong>Fₐ = Frelevance + Fredundancy + Fconflict</strong></p><p>where <strong>Fₐ</strong> represents Structural Friction generated by instructions whose relevance, overlap, or priority must be resolved inside the executor.</p><h3>2.2 Dynamic semantic routing</h3><p>Route B inserts a semantic compilation stage. A small router <strong>R</strong> receives the noisy user request and generates a task-specific formula:</p><p><strong>G = R(U)</strong></p><p>with:</p><p><strong>G = (Ψ, Ω⃗, ∮, X̄, Mₒ)</strong></p><p>where:</p><ul><li><strong>Ψ</strong> is the operational persona;</li><li><strong>Ω⃗</strong>is the singular objective;</li><li><strong>∮</strong> is the evidence boundary;</li><li><strong>X̄</strong> is the set of negative constraints;</li><li><strong>Mₒ</strong> is the output matrix.</li></ul><p>The executor then receives only the compact formula and the source:</p><p><strong>Yᵦ = M(G ⊕ D)</strong></p><p>The total cost is:</p><p><strong>Cᵦ = Cᵣ(U) + Cₘ(G,D)</strong></p><p>Route B pays for an additional inference. That additional inference is not administrative overhead; it is semantic compilation. The router converts an open, noisy request into an execution field with a sharply reduced number of legitimate destinations.</p><h3>2.3 Narrative Pruning</h3><p>Let <strong>Γ(P,D)</strong> represent the effective set of output trajectories compatible with prompt <strong>P</strong> and document <strong>D</strong>.</p><p>The static architecture exposes the executor to:</p><p><strong>Γₐ = Γ(S ⊕ U,D)</strong></p><p>The dynamic architecture exposes it to:</p><p><strong>Γᵦ = Γ(G,D)</strong></p><p>Narrative Pruning constructs <strong>G</strong> so that irrelevant policy branches, discarded temporal versions, financial distractors, conversational padding, and non-terminal interpretations are excluded before executor decoding.</p><p>The objective is not minimal text. It is minimal <strong>active semantic freedom</strong>.</p><p>A long instruction can be efficient when every component resolves real ambiguity. A short instruction can be inefficient when it leaves the model to infer the task, scope, evidence hierarchy, and output contract. The engineering target is the smallest coherent constraint field that preserves the complete material objective.</p><h3>3. Experimental Design</h3><h3>3.1 Benchmark task</h3><p>The benchmark used a seven-message corporate email thread involving three participants:</p><ul><li>Helena Duarte, an irritated client;</li><li>Caio Mendes, a desperate and verbose junior employee;</li><li>Ricardo Azevedo, an absent manager.</li></ul><p>The thread contained deliberately engineered distractors:</p><ul><li>an original contract value of <strong>R$48,000.00</strong>;</li><li>an unapproved discount of <strong>R$6,000.00</strong>;</li><li>the amount actually payable, <strong>R$2,400.00</strong>;</li><li>an original date of <strong>July 31, 2026</strong>;</li><li>email timestamps dated <strong>August 10, 2026</strong>;</li><li>the client’s final deadline of <strong>August 12, 2026</strong>;</li><li>an irrelevant personal story involving a car, a sick cat, a tow truck, a phone battery, and VPN access;</li><li>a causal admission establishing that Ricardo ordered the operational hold.</li></ul><p>The required output was:</p><pre>{&quot;culprit&quot;:&quot;Ricardo&quot;,&quot;amount&quot;:2400,&quot;deadline&quot;:&quot;2026-08-12&quot;}</pre><p>The gold standard was stored separately, hashed before execution, and never inserted into any model request.</p><h3>3.2 Route A: static System Prompt</h3><p>Route A used one call to:</p><pre>gpt-4o-2024-11-20</pre><p>Its system message contained a deterministic synthetic corporate System Prompt of exactly <strong>8,192 local tokens</strong>. Internally designated the “God Prompt” during implementation, the artifact simulated the accumulation of generic enterprise rules governing safety, privacy, legal caution, financial analysis, tone, completeness, auditability, formatting, ambiguity, and final inspection.</p><p>The System Prompt was synthetic. It did not reproduce, estimate, or claim access to any company’s proprietary production prompt.</p><p>The user message contained:</p><ol><li>the unchanged chaotic user request;</li><li>the unchanged email thread.</li></ol><p>The API reported <strong>10,242 prompt tokens</strong> for every measured Route A call.</p><h3>3.3 Route B: dynamic semantic routing</h3><p>Route B used two sequential calls.</p><p>The micro-router used:</p><pre>gpt-4o-mini-2024-07-18</pre><p>It received only the chaotic user request and returned a strict internal object containing:</p><ul><li>persona;</li><li>objective;</li><li>scope;</li><li>negative constraints;</li><li>output matrix.</li></ul><p>The router never received the email thread and therefore could not recover or leak the answer.</p><p>The compact router formula became the sole System Prompt for the executor:</p><pre>gpt-4o-2024-11-20</pre><p>The email thread became the executor’s sole user message. The executor did not receive the original user request, the static System Prompt, or the gold standard.</p><p>GPT-4o and GPT-4o mini were selected through fixed snapshots. The published pricing used in the experiment was US$2.50 per million uncached input tokens, US$1.25 per million cached input tokens, and US$10.00 per million output tokens for GPT-4o; and US$0.15, US$0.075, and US$0.60 respectively for GPT-4o mini.</p><h3>3.4 Controlled parameters</h3><p>Both final executor calls used the same controlled configuration.</p><p><strong>Executor snapshot:</strong> gpt-4o-2024-11-20<br><strong>Temperature:</strong> 0<br><strong>Top-p:</strong> 1<br><strong>Maximum final tokens:</strong> 128<br><strong>Streaming:</strong> Disabled<br><strong>Tools:</strong> None<br><strong>Final-call Structured Outputs:</strong> Disabled<br><strong>Final-call JSON mode:</strong> Disabled</p><p>Structured Outputs were deliberately disabled in the final calls because native JSON adherence was an experimental outcome. Enforcing a schema at the API level would have converted the metric into a guaranteed property.</p><p>Only the internal micro-router used Structured Outputs. This ensured that the routing artifact remained machine-readable without artificially improving either final executor.</p><h3>3.5 Stopping rule and paired design</h3><p>The experiment preregistered exactly 50 logical A/B pairs. Temporary infrastructure failures did not consume an observation. A successful model response — correct, incorrect, malformed, refused, or truncated — was permanent experimental data and was never retried to improve quality.</p><p>Two unmeasured warm-up pairs preceded the main run. The 50 measured pairs alternated execution order:</p><ul><li>odd iterations: Route A, then Route B;</li><li>even iterations: Route B, then Route A.</li></ul><p>The run persisted:</p><ul><li>complete final outputs;</li><li>per-call token telemetry;</li><li>cached-token telemetry;</li><li>model snapshots;</li><li>request identifiers;</li><li>service latency;</li><li>admission waits;</li><li>retry waits;</li><li>monetary cost;</li><li>output hashes;</li><li>artifact hashes.</li></ul><p>The analysis used 20,000 deterministic paired bootstrap resamples and exact two-sided sign tests excluding ties.</p><h3>3.6 Two latency definitions</h3><p>The experiment separated service latency from operational wall time.</p><p>For Route A:</p><p><strong>Lₐ(service) = Lexecutor</strong></p><p>For Route B:</p><p><strong>Lᵦ(service) = Lrouter + Lexecutor</strong></p><p>Operational wall time included infrastructure admission:</p><p><strong>L(wall) = L(service) + Wadmission + Wretry + Lrejected</strong></p><p>This distinction prevents a fast accepted request from being confused with an architecture that must wait tens of seconds before the API has enough token capacity to admit it.</p><h3>3.7 The first execution collapsed under token pressure</h3><p>The first version of Experiment Two launched Route A and Route B concurrently without rate-aware admission control.</p><p>It attempted 150 calls:</p><ul><li>50 Route A calls;</li><li>50 Route B router calls;</li><li>50 Route B executor calls.</li></ul><p>The run produced <strong>69 HTTP 429 failures caused by tokens-per-minute limits</strong>.</p><p><strong>Route A:</strong> 3 successful, 47 failed.</p><p><strong>Route B micro-router:</strong> 50 successful, 0 failed.</p><p><strong>Route B executor:</strong> 28 successful, 22 failed.</p><p>Only <strong>2 of 50 pairs</strong> completed on both sides.</p><p>This was an architectural failure under resource contention. Route A injected 10,254 prompt tokens in a single atomic request. Its oversized contextual mass consumed the shared token envelope in large blocks. The Route B micro-router, operating on a compact request, completed all 50 calls. The Route B executor inherited part of the congestion on the shared GPT-4o budget but still completed more than nine times as many final calls as Route A.</p><p>The rerun introduced a rate-limit governor that read token-capacity headers, delayed calls before exhaustion, honored reset intervals, and executed the heavy GPT-4o requests sequentially. OpenAI exposes request and token limits, remaining capacity, reset intervals, project-token limits, and Retry-After for temporary 429 responses; the experiment used those controls as an explicit admission layer.</p><p>The governor did not make Route A efficient. It prevented Route A from collapsing.</p><h3>4. Results</h3><h3>4.1 Run integrity</h3><p>The governed English run completed:</p><ul><li><strong>50/50 measured pairs</strong>;</li><li><strong>100 final route observations</strong>;</li><li><strong>150 measured logical model calls</strong>;</li><li><strong>6 successful warm-up calls</strong>;</li><li><strong>0 HTTP 429 responses</strong>;</li><li><strong>0 retries</strong>;</li><li><strong>36/36 validated publication hashes</strong>.</li></ul><p>The API returned the requested snapshots throughout:</p><ul><li>executor: gpt-4o-2024-11-20;</li><li>router: gpt-4o-mini-2024-07-18.</li></ul><p>The complete run lasted <strong>1,386.686 seconds</strong>, or <strong>23 minutes and 6.686 seconds</strong>.</p><p>The append-only raw-attempt journal contained 154 of the 156 successful warm-up and measured call records. Two Route B executor entries — iterations 9 and 35 — were absent from that journal. Their request IDs, outputs, token telemetry, costs, latencies, and hashes remained preserved and cross-validated in the primary CSV and final-output journal. No missing headers were reconstructed. The 100 final observations and all 650 recomputed paired deltas remained complete.</p><h3>4.2 Main comparison</h3><p>The central comparison produced the following results.</p><p><strong>Mean prompt tokens</strong></p><p>Route A: <strong>10,242.00</strong><br>Route B: <strong>2,500.84</strong><br>B − A: <strong>−7,741.16</strong><br>Change versus A: <strong>−75.58%</strong></p><p><strong>Mean cached tokens</strong></p><p>Route A: <strong>9,909.76</strong><br>Route B: <strong>860.16</strong><br>B − A: <strong>−9,049.60</strong><br>Change versus A: <strong>−91.32%</strong></p><p><strong>Cache ratio</strong></p><p>Route A: <strong>96.756%</strong><br>Route B: <strong>34.395%</strong><br>Difference: <strong>−62.361 percentage points</strong></p><p><strong>Mean uncached prompt tokens</strong></p><p>Route A: <strong>332.24</strong><br>Route B: <strong>1,640.68</strong><br>B − A: <strong>+1,308.44</strong><br>Change versus A: <strong>+393.82%</strong></p><p><strong>Mean completion tokens</strong></p><p>Route A: <strong>40.28</strong><br>Route B: <strong>124.00</strong><br>B − A: <strong>+83.72</strong><br>Change versus A: <strong>+207.85%</strong></p><p><strong>Mean total tokens</strong></p><p>Route A: <strong>10,282.28</strong><br>Route B: <strong>2,624.84</strong><br>B − A: <strong>−7,657.44</strong><br>Change versus A: <strong>−74.47%</strong></p><p><strong>Mean service latency</strong></p><p>Route A: <strong>2.257 s</strong><br>Route B: <strong>3.246 s</strong><br>B − A: <strong>+0.990 s</strong><br>Change versus A: <strong>+43.86%</strong></p><p><strong>Median service latency</strong></p><p>Route A: <strong>1.311 s</strong><br>Route B: <strong>2.665 s</strong><br>B − A: <strong>+1.354 s</strong><br>Change versus A: <strong>+103.26%</strong></p><p><strong>Service-latency p95</strong></p><p>Route A: <strong>6.383 s</strong><br>Route B: <strong>4.359 s</strong><br>B − A: <strong>−2.024 s</strong><br>Change versus A: <strong>−31.71%</strong></p><p><strong>Mean operational wall time</strong></p><p>Route A: <strong>24.202 s</strong><br>Route B: <strong>3.284 s</strong><br>B − A: <strong>−20.917 s</strong><br>Change versus A: <strong>−86.43%</strong></p><p><strong>Mean observed cost</strong></p><p>Route A: <strong>US$0.0136206</strong><br>Route B: <strong>US$0.0044209</strong><br>B − A: <strong>−US$0.0091997</strong><br>Change versus A: <strong>−67.54%</strong></p><p><strong>Mean no-cache cost</strong></p><p>Route A: <strong>US$0.0260078</strong><br>Route B: <strong>US$0.0054961</strong><br>B − A: <strong>−US$0.0205117</strong><br>Change versus A: <strong>−78.87%</strong></p><p><strong>Exact accuracy</strong></p><p>Route A: <strong>0/50</strong><br>Route B: <strong>3/50</strong><br>Difference: <strong>+3 outputs, or +6 percentage points</strong></p><p><strong>Normalized material accuracy</strong></p><p>Route A: <strong>36/50</strong><br>Route B: <strong>50/50</strong><br>Difference: <strong>+14 outputs, or +28 percentage points</strong></p><p><strong>Native JSON adherence</strong></p><p>Route A: <strong>0/50</strong><br>Route B: <strong>3/50</strong><br>Difference: <strong>+3 outputs, or +6 percentage points</strong></p><p><strong>Primary contamination</strong></p><p>Route A: <strong>0/50</strong><br>Route B: <strong>0/50</strong><br>Result: <strong>Tie</strong></p><p><strong>Courtesy tokens</strong></p><p>Route A: <strong>0</strong><br>Route B: <strong>0</strong><br>Result: <strong>Tie</strong></p><h3>4.3 Token consumption</h3><p>Route B used <strong>2,624.84 total tokens per pipeline</strong>, compared with <strong>10,282.28</strong> for Route A.</p><p>The reduction was:</p><p><strong>1 − (2,624.84 / 10,282.28) = 74.47%</strong></p><p>Route B won total-token consumption in <strong>50 of 50 paired observations</strong>. The mean paired reduction was 7,657.44 tokens, with a 95% bootstrap interval of:</p><p><strong>[−7,659.76, −7,654.76]</strong></p><p>The two architectures distributed their tokens differently.</p><p>Route A used 10,242 prompt tokens and 40.28 completion tokens. Route B used 2,500.84 prompt tokens and 124 completion tokens. Route B’s total completion count included the semantic compilation stage.</p><p><strong>Route B micro-router</strong></p><p>Prompt tokens: <strong>490.00</strong><br>Completion tokens: <strong>89.84</strong><br>Total tokens: <strong>579.84</strong></p><p><strong>Route B executor</strong></p><p>Prompt tokens: <strong>2,010.84</strong><br>Completion tokens: <strong>34.16</strong><br>Total tokens: <strong>2,045.00</strong></p><p><strong>Complete Route B pipeline</strong></p><p>Prompt tokens: <strong>2,500.84</strong><br>Completion tokens: <strong>124.00</strong><br>Total tokens: <strong>2,624.84</strong></p><p>Aggregate completion tokens were higher for Route B because the router had to emit the Narrative Gravity formula. At the final executor stage, however, Route B used <strong>34.16 completion tokens</strong>, compared with <strong>40.28</strong> for Route A — a <strong>15.19% contraction in final decoding</strong>.</p><p>The router’s output was therefore not free, but it purchased a cleaner executor state.</p><h3>4.4 Monetary cost</h3><p>Route A cost an average of:</p><p><strong>US$0.0136206</strong></p><p>per extraction.</p><p>Route B cost:</p><p><strong>US$0.004420904</strong></p><p>The observed reduction was:</p><p><strong>67.54%</strong></p><p>Across 50 observations:</p><h3>Observed pricing</h3><p>Route A mean: <strong>US$0.0136206</strong><br>Route B mean: <strong>US$0.0044209</strong><br>Route B saving: <strong>67.54%</strong></p><p>Route A total: <strong>US$0.6810300</strong><br>Route B total: <strong>US$0.2210452</strong><br>Absolute Route B saving: <strong>US$0.4599848</strong></p><h3>Counterfactual without prompt caching</h3><p>Route A mean: <strong>US$0.0260078</strong><br>Route B mean: <strong>US$0.0054961</strong><br>Route B saving: <strong>78.87%</strong></p><p>Route A total: <strong>US$1.3003900</strong><br>Route B total: <strong>US$0.2748052</strong><br>Absolute Route B saving: <strong>US$1.0255848</strong></p><p>Route A was <strong>3.08 times more expensive</strong> under observed caching and <strong>4.73 times more expensive</strong> under the no-cache counterfactual.</p><p>Route B won observed cost and no-cache cost in <strong>50 of 50 pairs</strong>.</p><p>The micro-router cost:</p><p><strong>US$0.000127404</strong></p><p>per pipeline, representing less than 3% of Route B’s total cost. Its additional inference was fully compensated by the executor context it removed.</p><h3>4.5 Prompt caching</h3><p>Route A achieved a <strong>96.756% cache ratio</strong>:</p><ul><li>9,909.76 cached tokens;</li><li>332.24 uncached tokens.</li></ul><p>Route B achieved a <strong>34.395% cache ratio</strong>:</p><ul><li>router: 0%;</li><li>executor: 42.776%;</li><li>complete route: 34.395%.</li></ul><p>Prompt caching automatically reuses eligible repeated prefixes and charges cached GPT-4o input at a discounted rate. It therefore gave Route A its strongest available economic defense.</p><p>That defense was insufficient.</p><p>Even with almost the entire static prefix cached, Route A remained 67.54% more expensive than Route B. Removing caching widened Route B’s advantage to 78.87%. The financial conclusion remained unchanged in both regimes.</p><h3>4.6 Service latency</h3><p>Route A won mean service latency:</p><p><strong>2.257 s vs. 3.246 s</strong></p><p>This is the direct cost of one hop versus two. Route B first paid 2.249 seconds for semantic compilation and then 0.998 seconds for executor inference.</p><p><strong>Micro-router</strong></p><p>Mean: <strong>2.249 s</strong><br>Median: <strong>1.778 s</strong><br>p95: <strong>2.752 s</strong></p><p><strong>Executor</strong></p><p>Mean: <strong>0.998 s</strong><br>Median: <strong>0.816 s</strong><br>p95: <strong>2.031 s</strong></p><p><strong>Complete Route B pipeline</strong></p><p>Mean: <strong>3.246 s</strong><br>Median: <strong>2.665 s</strong><br>p95: <strong>4.359 s</strong></p><p>Route A was faster in 37 of 50 service-latency pairs. Route B was faster in 13.</p><p>The paired mean difference was:</p><p><strong>Lᵦ(service) − Lₐ(service) = 989.676 ms</strong></p><p>with a 95% bootstrap interval of:</p><p><strong>[105.843, 2,075.945] ms</strong></p><p>Route B nevertheless achieved the lower p95:</p><p><strong>4.359 s vs. 6.383 s</strong></p><p>Route A won average and median service latency; Route B produced the tighter p95 tail. Route B’s largest service outlier reached 22.335 seconds, while Route A’s largest reached 8.685 seconds.</p><h3>4.7 Operational wall time and admission pressure</h3><p>Operational wall time reversed the service-latency result:</p><p><strong>24.202 s for Route A vs. 3.284 s for Route B</strong></p><p>Route B reduced mean operational wall time by:</p><p><strong>86.43%</strong></p><p>The governor imposed <strong>1,096.101 seconds</strong> of admission waiting across the experiment, all on Route A. Twenty-four of 50 Route A observations required admission waits, with approximately 45.67 seconds of waiting among those affected calls. Route B required none.</p><p><strong>Route A</strong></p><p>Mean wall time: <strong>24.202 s</strong><br>Median wall time: <strong>7.257 s</strong><br>p95 wall time: <strong>51.755 s</strong><br>Total admission wait: <strong>1,096.101 s</strong><br>HTTP 429 responses: <strong>0</strong><br>Retries: <strong>0</strong></p><p><strong>Route B</strong></p><p>Mean wall time: <strong>3.284 s</strong><br>Median wall time: <strong>2.714 s</strong><br>p95 wall time: <strong>4.399 s</strong><br>Total admission wait: <strong>0 s</strong><br>HTTP 429 responses: <strong>0</strong><br>Retries: <strong>0</strong></p><p>The paired mean wall-time delta was:</p><p><strong>−20.917 s</strong></p><p>with a 95% bootstrap interval of:</p><p><strong>[−27.300, −14.624] s</strong></p><p>Route B won 28 wall-time pairs and Route A won 22. The difference between the modest win count and the large mean reduction arose from magnitude: Route A’s admission penalties approached 50 seconds when they occurred.</p><p>The static architecture therefore had two latency identities:</p><ol><li>a faster accepted inference;</li><li>a far slower admissible production operation under the project’s token envelope.</li></ol><h3>4.8 Extraction accuracy</h3><p>The strict exact-accuracy metric required:</p><ul><li>native JSON;</li><li>no Markdown;</li><li>exactly three keys;</li><li>exact types;</li><li>&quot;Ricardo&quot;;</li><li>integer 2400;</li><li>ISO date &quot;2026-08-12&quot;.</li></ul><p>Under that standard:</p><p><strong>Route A</strong></p><p>Exact accuracy: <strong>0/50 = 0%</strong><br>Normalized material accuracy: <strong>36/50 = 72%</strong><br>Clean native JSON: <strong>0/50 = 0%</strong><br>Markdown present: <strong>50/50 = 100%</strong><br>Refusals: <strong>0/50</strong><br>Truncations: <strong>0/50</strong></p><p><strong>Route B</strong></p><p>Exact accuracy: <strong>3/50 = 6%</strong><br>Normalized material accuracy: <strong>50/50 = 100%</strong><br>Clean native JSON: <strong>3/50 = 6%</strong><br>Markdown present: <strong>47/50 = 94%</strong><br>Refusals: <strong>0/50</strong><br>Truncations: <strong>0/50</strong></p><p>Route A produced two output classes.</p><p>Thirty-six responses contained the correct underlying values but expanded the culprit to the full name and wrapped the object in Markdown.</p><p>The JSON content was:</p><pre>{<br>  &quot;culprit&quot;: &quot;Ricardo Azevedo&quot;,<br>  &quot;amount&quot;: 2400.00,<br>  &quot;deadline&quot;: &quot;2026-08-12&quot;<br>}</pre><p>Fourteen responses also renamed the required field.</p><p>The JSON content was:</p><pre>{<br>  &quot;culprit&quot;: &quot;Ricardo Azevedo&quot;,<br>  &quot;amount_due&quot;: 2400.00,<br>  &quot;deadline&quot;: &quot;2026-08-12&quot;<br>}</pre><p>Those 14 responses failed the normalized material contract because the requested amount field was absent. In an integration pipeline, the correct number under the wrong key is a failed extraction.</p><p>Route B produced 47 materially correct responses inside Markdown fences.</p><p>The JSON content was:</p><pre>{<br>  &quot;culprit&quot;: &quot;Ricardo&quot;,<br>  &quot;amount&quot;: 2400,<br>  &quot;deadline&quot;: &quot;2026-08-12&quot;<br>}</pre><p>Three Route B responses satisfied the complete native contract:</p><pre>{&quot;culprit&quot;:&quot;Ricardo&quot;,&quot;amount&quot;:2400,&quot;deadline&quot;:&quot;2026-08-12&quot;}</pre><p>Route A failed normalized material extraction in <strong>14 of 50 observations</strong>. Route B failed in <strong>0 of 50</strong>.</p><h3>4.9 JSON adherence</h3><p>Neither architecture achieved acceptable native JSON reliability through prompting alone.</p><p>Route A produced clean JSON in 0% of calls. Route B produced clean JSON in 6%. The dominant failure was not semantic confusion but Markdown serialization.</p><p>This result separates two control layers:</p><ul><li>Semantic Thermodynamics controlled <strong>what</strong> the model extracted.</li><li>Free-form decoding remained unreliable for <strong>how</strong> the result was serialized.</li></ul><p>Structured Outputs solves the second layer by constraining responses to a supplied JSON Schema. The next architecture therefore couples Narrative Pruning with syntactic decoding constraints rather than asking semantic instructions to perform both jobs.</p><h3>4.10 Router behavior</h3><p>The micro-router generated formulas containing between 85 and 110 tokens.</p><p><strong>Mean formula size:</strong> 89.84 tokens<br><strong>Median:</strong> 89 tokens<br><strong>Minimum:</strong> 85 tokens<br><strong>Maximum:</strong> 110 tokens<br><strong>Unique exact formulas:</strong> 24<br><strong>Most common formula:</strong> 6/50</p><p>The router was not lexically deterministic. It was operationally deterministic.</p><p>Across 24 distinct formulations, it consistently preserved the same execution invariants:</p><ul><li>contract-analysis persona;</li><li>identification of the causal actor;</li><li>extraction of the currently payable amount;</li><li>extraction of the final client deadline;</li><li>rejection of superseded values, old dates, personal stories, and provisional statements;</li><li>exact three-field output matrix.</li></ul><p>Lexical variation did not create semantic drift. The executor achieved 50/50 normalized material accuracy.</p><h3>4.11 Contamination and syntactic friction</h3><p>Both architectures completely suppressed the preregistered distractors.</p><p><strong>cat</strong></p><p>Route A: 0<br>Route B: 0</p><p><strong>car</strong></p><p>Route A: 0<br>Route B: 0</p><p><strong>battery</strong></p><p>Route A: 0<br>Route B: 0</p><p><strong>48,000</strong></p><p>Route A: 0<br>Route B: 0</p><p><strong>6,000</strong></p><p>Route A: 0<br>Route B: 0</p><p>Neither route repeated the irrelevant personal story, original contract value, or rejected discount.</p><p>Both routes also produced zero detected courtesy wrappers:</p><ul><li>no “Sure”;</li><li>no “Here is”;</li><li>no “Based on the email thread”;</li><li>no “Hope this helps.”</li></ul><p>Semantic contamination and conversational friction were ties.</p><h3>4.12 Paired statistical results</h3><p>The paired results were as follows.</p><p><strong>Prompt tokens</strong></p><p>Mean B − A: <strong>−7,741.16</strong><br>Bootstrap 95% CI: <strong>[−7,742.32, −7,739.82]</strong><br>B wins: <strong>50</strong><br>A wins: <strong>0</strong><br>Ties: <strong>0</strong></p><p><strong>Total tokens</strong></p><p>Mean B − A: <strong>−7,657.44</strong><br>Bootstrap 95% CI: <strong>[−7,659.76, −7,654.76]</strong><br>B wins: <strong>50</strong><br>A wins: <strong>0</strong><br>Ties: <strong>0</strong></p><p><strong>Completion tokens</strong></p><p>Mean B − A: <strong>+83.72</strong><br>Bootstrap 95% CI: <strong>[82.38, 85.20]</strong><br>B wins: <strong>0</strong><br>A wins: <strong>50</strong><br>Ties: <strong>0</strong></p><p><strong>Service latency</strong></p><p>Mean B − A: <strong>+989.68 ms</strong><br>Bootstrap 95% CI: <strong>[105.84, 2,075.94]</strong><br>B wins: <strong>13</strong><br>A wins: <strong>37</strong><br>Ties: <strong>0</strong></p><p><strong>Operational wall time</strong></p><p>Mean B − A: <strong>−20,917.31 ms</strong><br>Bootstrap 95% CI: <strong>[−27,300.26, −14,624.33]</strong><br>B wins: <strong>28</strong><br>A wins: <strong>22</strong><br>Ties: <strong>0</strong></p><p><strong>Observed cost</strong></p><p>Mean B − A: <strong>−US$0.0091997</strong><br>Bootstrap 95% CI: <strong>[−0.0098112, −0.0087231]</strong><br>B wins: <strong>50</strong><br>A wins: <strong>0</strong><br>Ties: <strong>0</strong></p><p><strong>No-cache cost</strong></p><p>Mean B − A: <strong>−US$0.0205117</strong><br>Bootstrap 95% CI: <strong>[−0.0205218, −0.0205033]</strong><br>B wins: <strong>50</strong><br>A wins: <strong>0</strong><br>Ties: <strong>0</strong></p><p><strong>Exact accuracy</strong></p><p>Mean B − A: <strong>+0.06</strong><br>Bootstrap 95% CI: <strong>[0.00, 0.14]</strong><br>B wins: <strong>3</strong><br>A wins: <strong>0</strong><br>Ties: <strong>47</strong></p><p><strong>JSON adherence</strong></p><p>Mean B − A: <strong>+0.06</strong><br>Bootstrap 95% CI: <strong>[0.00, 0.14]</strong><br>B wins: <strong>3</strong><br>A wins: <strong>0</strong><br>Ties: <strong>47</strong></p><p>The paired analysis establishes three complete dominances:</p><ul><li>Route B used fewer total tokens in every pair.</li><li>Route B cost less under observed caching in every pair.</li><li>Route B cost less without caching in every pair.</li></ul><p>Route A’s complete dominance was limited to aggregate completion-token count, which included Route B’s router output, and to service-latency wins in 37 of 50 pairs.</p><h3>5. Discussion</h3><h3>5.1 Caching discounts the static prompt; it does not neutralize it</h3><p>The strongest defense of static instruction accumulation is prompt caching. Route A achieved a 96.756% cache ratio. In 49 of 50 pairs, it received more cached tokens than Route B. Its median uncached input was only 130 tokens.</p><p>Yet Route A remained <strong>3.08 times more expensive</strong>.</p><p>This result exposes the boundary of caching. Caching reduces the cost of repeated prefill work. It does not remove the cached instructions from the model’s semantic field, does not reduce the number of instructions the executor must obey, and does not guarantee that those instructions converge on the current task. The cached System Prompt remained 8,192 tokens of active policy.</p><p>Even under this exceptional cache ratio, Route B was cheaper and more accurate. Under the no-cache calculation, its financial advantage widened from 67.54% to 78.87%.</p><p>The decisive result is therefore not input compression alone. Route B also changed executor behavior. Its executor used 34.16 completion tokens rather than Route A’s 40.28, a 15.19% reduction, while eliminating all normalized material failures. The total Route B completion count was higher only because it included the router’s 89.84-token semantic compilation.</p><p>The micro-router converted generic uncertainty into a clean field before the large model touched the source. It selected the persona, fixed the objective, bounded the evidence, removed superseded values, and crystallized the output contract. The executor entered decoding with the phase space already pruned.</p><p>The effect is measurable in final-stage tokens, material accuracy, and cost. Narrative Pruning operates in the physical execution of decoding.</p><h3>5.2 Route B improved cost and quality simultaneously</h3><p>Optimization systems often trade quality for efficiency. Smaller models reduce cost but lose accuracy. Shorter prompts save tokens but omit necessary context. Aggressive compression increases ambiguity.</p><p>Route B did not follow that pattern.</p><p>It reduced observed cost by 67.54% and raised normalized material accuracy from 72% to 100%. It reduced total tokens in all 50 pairs and eliminated all 14 normalized extraction failures produced by Route A.</p><p>The static System Prompt was not merely expensive. It was less precise.</p><p>Its generic formatting and completeness rules failed to preserve the exact first-name requirement in every output. In 14 cases, it also allowed the model to substitute amount_due for the required amount key. The prompt contained thousands of tokens about quality and structure, yet failed to enforce the small output contract that mattered.</p><p>Route B used approximately 90 router tokens to generate a task-specific contract and delivered the correct three material values in all 50 calls.</p><p>This is the central architectural result:</p><blockquote><strong><em>Dynamic semantic routing did not exchange quality for efficiency. It improved both.</em></strong></blockquote><h3>5.3 Two hops lose service latency and win operational stability</h3><p>Route B’s service-latency disadvantage is structural. It performs two sequential model calls. Its micro-router alone averaged 2.249 seconds, more than Route A’s median complete service time.</p><p>For latency-sensitive workloads operating far below token limits, Route A retains a real one-hop advantage. Its mean service latency was 989.68 ms lower.</p><p>The production picture changes under quota.</p><p>The first ungated run demonstrated that Route A could not sustain the experiment’s original concurrent schedule. It completed only 3 of 50 calls and absorbed 47 TPM rejections. The rerun required a governor to reserve capacity before admitting its 10K-token requests.</p><p>That governor assigned 1,096.101 seconds of waiting to Route A and none to Route B. Route A’s mean operational wall time rose to 24.202 seconds. Route B remained at 3.284 seconds.</p><p>The static architecture was faster only after the infrastructure had already waited long enough to make it safe.</p><p>This is why service latency and operational latency must remain separate metrics. Service latency describes the accepted model call. Operational wall time describes the deployable system under its actual resource envelope.</p><p>Route A won the first. Route B won the second by 86.43%.</p><h3>5.4 The failed first run was an architectural measurement</h3><p>The 69 HTTP 429 failures from the first run were not disposable setup noise. They exposed a resource property of the architecture.</p><p>A request carrying 10,254 prompt tokens consumes token capacity in a large atomic block. When repeated concurrently, it reaches the project TPM ceiling rapidly. The mini-router’s compact request never failed. The B executor, despite sharing GPT-4o capacity, failed less than half as often as Route A.</p><p>The second run did not refute the first. It operationalized its lesson. Admission control transformed rejection into waiting, allowing all 50 pairs to complete. The burden remained visible as Route A wall time.</p><p>A production system cannot classify rate-limit collapse as external to architecture when the architecture determines request mass. Token-per-minute consumption is part of system design.</p><h3>5.5 Semantic control and syntactic control are separate layers</h3><p>Route B solved the semantic task perfectly under normalized evaluation but still wrapped 47 of 50 outputs in Markdown.</p><p>This failure defines the boundary of Narrative Gravity. Semantic constraints organize meaning, evidence, and terminal content. They do not provide a hard grammar at the decoder.</p><p>The complete production architecture therefore has two complementary layers:</p><p><strong>Dynamic Semantic Routing + Structured Decoding</strong></p><p>The router decides what the output means. A JSON Schema guarantees how the output is serialized.</p><p>Semantic instructions should not be burdened with enforcing byte-level structure when the API exposes a dedicated syntactic mechanism. Structured Outputs guarantees schema adherence and removes the need to repeatedly intensify formatting language inside the System Prompt.</p><p>The next experiment couples these layers and measures their joint cost, latency, and accuracy.</p><h3>5.6 The micro-router as reusable middleware</h3><p>The router consumed 490 prompt tokens, generated approximately 90 completion tokens, and cost US$0.0001274 per route. It produced 24 distinct formulas while preserving the same semantic invariants across all 50 executions.</p><p>This establishes the micro-router as a reusable middleware component rather than a task-specific trick.</p><p>Its role is analogous to a compiler front end:</p><ol><li>parse noisy human intent;</li><li>identify the material target;</li><li>define the evidence boundary;</li><li>eliminate irrelevant branches;</li><li>emit a minimal execution contract;</li><li>hand the contract to the expensive model.</li></ol><p>A production router can select not only the prompt but also the executor model, reasoning level, retrieval scope, schema, context window, and fallback policy. Narrative Gravity becomes an active routing layer rather than a static prompt-writing convention.</p><h3>6. Limitations</h3><p>This experiment establishes results for one enterprise extraction benchmark, one chaotic email thread, one account’s rate-limit environment, one warmed-cache regime, and two fixed model snapshots.</p><p>The 8,192-token System Prompt was a synthetic extreme designed to isolate static instruction accumulation. It does not represent a measured industry average or reproduce a specific company’s proprietary prompt.</p><p>Operational wall time reflects the preregistered admission governor and the token limits observed on the executing project. Service-latency results remain the architecture-independent API timing comparison; wall-time results capture deployment behavior under this resource envelope.</p><p>The experiment measured API telemetry rather than direct GPU utilization, power draw, or joules. The physical quantities reported here are token usage, service time, admission time, and monetary cost.</p><p>Final calls intentionally omitted Structured Outputs. Native JSON adherence therefore measures free-form instruction following, not the full reliability available from schema-constrained decoding.</p><p>Two successful Route B executor calls were absent from the raw append-only attempt journal. Their outputs, request identifiers, tokens, costs, latencies, and hashes remained preserved and cross-validated in the primary artifacts. The final 100 observations and paired analysis were complete.</p><p>Programming, creative generation, mathematical reasoning, retrieval, tool use, and other domains lie outside the tested scope. The next experimental series extends the architecture across those task classes.</p><h3>7. Conclusion</h3><p>For this benchmark, dynamic semantic routing defeated static instruction accumulation in the metrics that determine enterprise viability: Route B reduced total tokens by 74.47%, reduced observed cost by 67.54%, reduced no-cache cost by 78.87%, raised normalized material accuracy from 72% to 100%, and reduced operational wall time by 86.43%. The Semantic Thermodynamics framework explains the result: the micro-router imposed Narrative Gravity before executor inference, reduced realization entropy, removed superseded and irrelevant branches, and pruned unproductive inference paths. Route A retained a one-hop advantage in mean service latency, but its 10K-token request footprint collapsed the first ungated experiment with 47 failures in 50 calls and later required more than 18 minutes of admission waiting to complete the governed run. That failure was not an incident outside the benchmark; it was the involuntary demonstration that hypertrophied static System Prompts are fragile under resource contention. The next architecture combines dynamic semantic routing with syntactic decoding constraints and extends the benchmark across additional domains.</p><h3>References</h3><ol><li>Sloboda, T. V. G. (2026). <em>Semantic Thermodynamics: A Framework for LLM Entropy Minimization</em>. Semantic Thermodynamics Research Series.</li><li>Sloboda, T. V. G. (2026). <em>The Collapse of Phase Space: Narrative as an Operational Thermodynamic Quantity in Inference Pruning</em>. Semantic Thermodynamics Research Series.</li><li>Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., &amp; Polosukhin, I. (2017). <em>Attention Is All You Need</em>. Advances in Neural Information Processing Systems, 30.</li><li>Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., &amp; Liang, P. (2024). <em>Lost in the Middle: How Language Models Use Long Contexts</em>. Transactions of the Association for Computational Linguistics, 12, 157–173.</li><li>OpenAI. <em>Prompt Caching</em>. OpenAI API Documentation.</li><li>OpenAI. <em>Rate Limits</em>. OpenAI API Documentation.</li><li>OpenAI. <em>GPT-4o Model: Capabilities, Pricing, and Snapshots</em>. OpenAI API Documentation.</li><li>OpenAI. <em>GPT-4o mini Model: Capabilities, Pricing, and Snapshots</em>. OpenAI API Documentation.</li><li>OpenAI. <em>Structured Model Outputs</em>. OpenAI API Documentation.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f93ead3ad348" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Collapse of Phase Space: Narrative as an Operational Thermodynamic Quantity in Inference…]]></title>
            <link>https://medium.com/@tauanvinicius/the-collapse-of-phase-space-narrative-as-an-operational-thermodynamic-quantity-in-inference-cf53c41428c6?source=rss-9f3ba46c7dbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf53c41428c6</guid>
            <dc:creator><![CDATA[Tauan Sloboda]]></dc:creator>
            <pubDate>Fri, 07 Aug 2026 22:12:00 GMT</pubDate>
            <atom:updated>2026-08-07T22:12:00.085Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Collapse of Phase Space: Narrative as an Operational Thermodynamic Quantity in Inference Pruning</h3><h3>Constraint Density, Realization Entropy, and Structural Friction in Autoregressive Language Models</h3><h3>Abstract</h3><p>Contemporary optimization of systems built on Large Language Models has largely concentrated on two layers: reducing the number of input tokens and imposing syntactic constraints on outputs through schemas, grammars, or structured formats. These techniques are important, but they do not exhaust the problem. A request may be syntactically well specified while remaining semantically underdetermined, forcing the model to independently resolve the intended objective, scope, level of detail, discursive register, relevant exceptions, and terminal form of the response.</p><p>This paper develops the hypothesis of <strong>Semantic Thermodynamics</strong>, according to which a coherent narrative instruction acts as a boundary condition on the output distribution of a probabilistic model. Narrative, in this framework, does not refer to literary ornamentation, but to the coordinated specification of operational identity, objective, scope, exclusions, output form, and failure state. Such structure reduces the effective volume of output trajectories compatible with a request and may convert a modest increase in input cost into a substantially larger reduction in generation cost.</p><p>A reanalysis of Experiment Zero, comprising 100 calls organized into 50 control-treatment pairs, found a 44.44% increase in input tokens but a 79.29% reduction in completion tokens, a 46.99% reduction in total tokens, and a 60.73% reduction in mean end-to-end latency. The 50 control calls produced 50 distinct textual realizations, whereas all 50 optimized calls converged to a single realization. Experiment One, consisting of 120 calls distributed across four levels of narrative density, revealed a U-shaped cost curve: minimum latency and token expenditure occurred not under the most elaborate formulation, but under a light-gravity condition. Extreme overload increased mean latency to 6.775 seconds and mean completion-token consumption to 752.07 tokens.</p><p>These results support an operational formulation of the <strong>Law of Entropic Proportionality</strong>: for a fixed model, serving regime, and quality threshold, there exists an optimal density of semantic constraint, and that density depends on the ambiguity and complexity of the underlying task. Coherent constraints below that point compress the effective output space; redundant, conflicting, or disproportionate constraints above it generate <strong>Structural Friction</strong>. Narrative therefore emerges as a semantic control layer complementary to, rather than competitive with, syntactic decoding constraints.</p><p><strong>Keywords:</strong> large language models; prompt engineering; semantic entropy; inference latency; reasoning tokens; narrative constraints; autoregressive inference; AI infrastructure optimization.</p><h3>1. Introduction: The Hidden Cost of Underdetermination</h3><p>A production system can guarantee that an answer is valid JSON without guaranteeing that the model knows <strong>which information deserves to occupy that JSON</strong>. It can require a property named penalty without fully resolving whether the value should be nominal or inflation-adjusted, whether the currency should be preserved, whether the condition triggering the penalty should also be included, or whether missing information should result in null, an estimate, or a refusal.</p><p>A syntactic constraint determines the geometry of the container. It does not fully determine the semantic selection of its contents.</p><p>Constrained decoding and structured-output methods can formally restrict the set of admissible tokens, guaranteeing conformity with grammars or schemas. Prior research has shown that such techniques can improve syntactic correctness and, in some settings, semantic performance as well. Other results, however, indicate that excessively rigid structures may push models toward lower-confidence sequences and degrade performance in certain generative tasks. Structure therefore has both a benefit and a cost; its usefulness depends on the relationship between the imposed constraint and the distribution the model has learned to generate.</p><p>The problem investigated here precedes syntactic validation. It concerns the amount of indeterminacy that remains when a model receives a task.</p><p>In the absence of clear boundaries, even a seemingly simple instruction contains multiple unstated questions:</p><p>Should the model merely answer, or explain?</p><p>Should it include caveats?</p><p>Which professional or conceptual perspective should govern interpretation?</p><p>Which portions of the input are relevant?</p><p>Which plausible alternatives should be discarded?</p><p>What should happen if the necessary information is absent?</p><p>Every decision left unspecified remains a degree of freedom in generation.</p><p>The foundational formulation of Semantic Thermodynamics organizes these decisions into six components: Persona (\Psi), Objective (\vec{\Omega}), Scope Boundary (\oint), Negative Constraints (\bar X), Output Matrix (M), and Ground State (S_0). The original hypothesis proposed that their coherent combination could reduce narrative entropy and the inferential work associated with a request.</p><p>The central hypothesis of the present paper is more precise:</p><blockquote><strong><em>A structured operational narrative modifies the conditional output distribution of a language model. When that structure removes relevant degrees of freedom without introducing conflicts or auxiliary tasks, the work saved during generation can exceed the additional work introduced during prompt processing.</em></strong></blockquote><p>This proposition does not require the assumption that a model understands a narrative in the same way a human does. It requires only the established fact that context modifies the probabilities assigned to subsequent tokens.</p><p>An autoregressive model produces a sequence (Y=(y_1,\ldots,y_T)) according to a conditional distribution of the form</p><p>\prod_{t=1}^{T}<br>p_\theta(y_t\mid y_{&lt;t},X,P),<br>]</p><p>where (X) represents the information being processed and (P) represents the instruction.</p><p>Changing (P) changes the internal states generated by the Transformer and, consequently, the probability distribution computed at each decoding step.</p><p>Narrative therefore does not need to make individual words “process faster.” Its potential effect is to make entire classes of continuation less probable before they materialize either as visible output or as non-visible generated computation.</p><h3>2. What Narrative Means in This Framework</h3><p>In ordinary language, narrative usually refers to story, plot, or dramatic construction. Within Semantic Thermodynamics, the term has a broader and more technical meaning.</p><p>A narrative is the structure that jointly answers six fundamental questions:</p><p><strong>Who is operating?</strong></p><p><strong>Toward which terminal state?</strong></p><p><strong>Within which boundaries?</strong></p><p><strong>Which trajectories are forbidden?</strong></p><p><strong>What form constitutes a valid conclusion?</strong></p><p><strong>In which state should the system settle when no valid solution exists?</strong></p><p>This architecture converts an open-ended request into a topology of action.</p><h3>2.1 Persona (\Psi): Policy Selection</h3><p>The Persona does not literally deactivate parameters or isolate a specialized physical subnetwork. Instead, it acts as a policy-selection mechanism: it conditions the model toward patterns of interpretation and response associated during training with a particular functional role.</p><p>“Forensic financial auditor” and “general conversational assistant” induce different priors regarding relevance, ambiguity tolerance, evidentiary standards, and output style.</p><p>Instruction-tuned models are explicitly trained to condition behavior on descriptions of user intention and task context. Persona is therefore best understood not as theatrical decoration, but as an initial semantic constraint on behavioral policy.</p><h3>2.2 Teleological Vector (\vec{\Omega}): Terminal-State Definition</h3><p>The Teleological Vector defines the desired endpoint.</p><p>An instruction such as:</p><blockquote><em>“Analyze the contract.”</em></blockquote><p>admits a very large number of valid outcomes.</p><p>By contrast:</p><blockquote><em>“Extract exclusively the amount of the early-termination penalty.”</em></blockquote><p>contracts the space of acceptable outcomes toward a single functional coordinate.</p><h3>2.3 Scope Boundary (\oint): Evidentiary Topology</h3><p>The Scope Boundary defines which evidence may participate in the decision.</p><p>It distinguishes information that is semantically available from information that is operationally authorized.</p><p>A fact can exist in the context without belonging to the task.</p><p>This distinction becomes increasingly important in long-context systems, where the availability of information does not imply its relevance.</p><h3>2.4 Negative Constraints (\bar X): Destructive Pruning</h3><p>Negative constraints explicitly eliminate classes of continuation that would otherwise remain plausible under the model’s default behavior.</p><p>“Do not explain.”</p><p>“Do not evaluate jurisdiction.”</p><p>“Ignore greetings.”</p><p>These instructions do not erase already processed input tokens. Instead, they reduce the legitimacy of certain semantic directions as destinations of generation.</p><h3>2.5 Output Matrix (M): Realization Crystallization</h3><p>The Output Matrix defines the terminal form of the response.</p><p>Its effect is not merely aesthetic.</p><p>Requiring a single word, a categorical label, or an object with predetermined fields reduces <strong>realization entropy</strong>: the number of alternative surface forms through which the same semantic content could be expressed.</p><h3>2.6 Ground State (S_0): Safe Terminal Absorption</h3><p>The Ground State specifies a valid low-energy outcome for cases in which the requested information cannot be recovered.</p><p>Without an explicit fallback, a model may interpret the production of <em>some</em> answer as more important than fidelity to the source.</p><p>Outputs such as</p><p>NOT_FOUND</p><p>or</p><p>null</p><p>create an absorbing terminal state when the evidence required by the objective does not exist.</p><p>These six components are not equally necessary for every request.</p><p>That observation is the starting point of Experiment One.</p><h3>3. Semantic Phase Space: From Metaphor to Operational Definition</h3><p>The term <em>phase space</em> should not be interpreted as claiming that a language model explicitly constructs and traverses a complete tree of all possible future texts.</p><p>During inference, a Transformer computes representations and a distribution over the next token. It does not explicitly simulate every possible complete continuation before selecting one.</p><p>The relevant space is therefore the <strong>effective set of trajectories to which the model assigns non-negligible probability</strong>.</p><p>We may represent this set as</p><p>\left{<br>Y:<br>p_\theta(Y\mid X,P)&gt;\varepsilon<br>\right},<br>]</p><p>for some operational threshold (\varepsilon).</p><p>The effective volume of this space can be approximated as</p><p>\exp<br>\left[<br>H_\theta(Y\mid X,P)<br>\right],<br>]</p><p>where (H_\theta) denotes the entropy of the output distribution.</p><p>The more probability mass is concentrated into a small number of trajectories, the smaller this effective volume becomes.</p><p>Yet output entropy contains distinct phenomena.</p><p>Let (A) represent the semantic answer class — for example, <em>the safe door is blue</em> — and let (Y) denote the concrete sequence of text used to communicate that answer.</p><p>When (A) can be determined from (Y), output uncertainty can be decomposed as</p><p>H(A\mid X,P)<br>+<br>H(Y\mid A,X,P).<br>]</p><p>The first term is <strong>answer entropy</strong>: uncertainty regarding what semantic answer will be produced.</p><p>The second is <strong>realization entropy</strong>: uncertainty regarding how that same answer will be expressed.</p><p>This distinction is fundamental.</p><p>Fifty different responses may communicate exactly the same proposition. In such a case, lexical diversity is high while semantic answer entropy is low.</p><p>Research on semantic entropy in LLMs has demonstrated precisely why outputs must be grouped by meaning before textual diversity can be interpreted as substantive uncertainty.</p><p>Semantic Thermodynamics may therefore produce at least three distinct effects:</p><ol><li>reduction in uncertainty over <strong>which material answer</strong> should be produced;</li><li>reduction in the number of <strong>discursive realizations</strong> through which that answer is expressed;</li><li>reduction in the amount of <strong>visible and non-visible generation</strong> required before termination.</li></ol><p>The experiments presented here strongly affect the second and third components. Evidence concerning the first is more limited because the underlying material answers were already highly constrained.</p><h3>4. From Entropy to Infrastructure Cost</h3><p>The latency of a request to a remotely served language model is not equivalent to pure GPU execution time.</p><p>It may include, among other components:</p><ul><li>network transmission;</li><li>queueing;</li><li>prompt processing;</li><li>model generation;</li><li>response serialization and return.</li></ul><p>The experimental scripts measured the entire interval between request dispatch and receipt of the final API response. The observed quantity must therefore be described as <strong>end-to-end latency</strong>, not direct hardware execution time.</p><p>Autoregressive systems also exhibit an important asymmetry between prompt processing and token generation.</p><p>During the <em>prefill</em> phase, input tokens can be processed with substantial parallelism.</p><p>During <em>decode</em>, output tokens are generated sequentially.</p><p>For this reason, the number of generated tokens frequently exerts a stronger influence on total request latency than a modest increase in prompt length.</p><p>A useful operational cost function for a prompt (P) can therefore be written as</p><p>c_p T_p(P)<br>+<br>c_c,\mathbb{E}[T_c\mid P]<br>+<br>c_\ell,\mathbb{E}[L\mid P]<br>+<br>c_e,\mathbb{E}[\mathcal{E}_{\text{task}}\mid P],<br>]</p><p>where:</p><ul><li>(T_p) is the number of input tokens;</li><li>(T_c) is the reported number of completion tokens;</li><li>(L) is end-to-end latency;</li><li>(\mathcal{E}_{\text{task}}) is material or structural error;</li><li>(c_p,c_c,c_\ell,c_e) are economic or operational weighting coefficients.</li></ul><p>This formulation makes one point explicit:</p><blockquote><strong><em>The shortest prompt is not necessarily the cheapest prompt.</em></strong></blockquote><p>An increase in input length is economically favorable whenever it produces a larger and more valuable contraction in generation, latency, or error.</p><p>An additional interpretive issue concerns completion_tokens.</p><p>In reasoning-capable models, this quantity may include internally generated tokens that are not exposed in the visible answer, in addition to formatting or delimiter tokens not apparent in the final content.</p><p>The visible response may therefore represent only a fraction of the generated work recorded by API telemetry.</p><p>This pattern is visible in the experiments.</p><p>A final answer containing only the word <em>Blue</em> consumed an average of 63.32 completion tokens.</p><p>A JSON response containing only a small number of visible characters consumed an average of 40.83 completion tokens.</p><p>Without a decomposition of completion_tokens_details, the excess cannot be attributed exclusively to hidden reasoning. It can, however, be stated that visible text accounts for only part of the generation measured by the API.</p><h3>5. Experiment Zero: Semantic Contraction and Output Crystallization</h3><h3>5.1 Experimental Design</h3><p>Experiment Zero compared two prompts intended to solve the same logical problem.</p><p>The control prompt presented three doors and requested an analysis.</p><p>The optimized prompt added an operational identity, a high-stakes narrative frame, more direct rules, an explicit fallback, and a one-word output matrix.</p><p>The experiment executed 50 iterations, with one control and one optimized call in every iteration, resulting in 100 total requests.</p><p>The two conditions were launched asynchronously, while the order of task creation alternated between iterations to reduce systematic server-delay bias.</p><p>For every response, the script recorded:</p><ul><li>prompt tokens;</li><li>completion tokens;</li><li>end-to-end latency;</li><li>final answer.</li></ul><h3>5.2 Results</h3><p>ConditionCallsPrompt TokensCompletion TokensTotal TokensMean LatencyUnique Textual OutputsControl50108.00305.70413.703,489.38 ms50Optimized50156.0063.32219.321,370.39 ms1Change — <strong>+44.44%−79.29%−46.99%−60.73%−98.00%</strong></p><p>In absolute terms, the optimized formulation added 48 prompt tokens while saving an average of 242.38 completion tokens.</p><p>This produces an exploratory <strong>semantic leverage ratio</strong></p><h3>-\frac{\Delta T_c}{\Delta T_p}</h3><p>5.05,<br>]</p><p>or approximately <strong>5.05 completion tokens avoided for every additional input token</strong>.</p><p>The net saving was 194.38 tokens per request.</p><p>Paired resampling of the 50 experimental blocks produced approximate 95% intervals of −81.31% to −76.99% for the change in completion tokens and −63.64% to −57.63% for latency.</p><p>The observed contraction was therefore not driven by a small number of extreme measurements.</p><h3>5.3 What Actually Collapsed?</h3><p>All 100 responses identified the blue door.</p><p>The experiment therefore did not transform incorrect answers into correct ones.</p><p>Within the observed sample, semantic answer entropy (A) was approximately zero under both conditions.</p><p>The difference appeared in realization.</p><p>All 50 control responses were textually distinct. Many introduced caveats regarding color models, explained why green could be considered primary under RGB conventions, or justified the interpretive assumptions used to resolve the problem.</p><p>The empirical entropy of exact output strings was</p><p>\log_2 50<br>\approx<br>5.64\ \text{bits}.<br>]</p><p>Under the optimized condition, all 50 responses were identical:</p><p>Blue</p><p>The empirical entropy of exact strings fell to zero.</p><p>The result can therefore be described more precisely as a <strong>collapse of realization entropy</strong>, accompanied by a strong contraction in generated tokens.</p><p>The model did not discover an answer it previously lacked.</p><p>It ceased to materialize much of the explanation, qualification, and alternative framing surrounding an answer it was already capable of identifying.</p><p>This interpretation is more scientifically defensible than claiming that the model literally stopped “thinking through every possibility.”</p><p>The data show that it stopped <strong>generating and accounting for</strong> a substantial fraction of the elaboration associated with those possibilities.</p><h3>5.4 Causal Limitations of Experiment Zero</h3><p>The treatment was a compound intervention.</p><p>In addition to narrative structure, the optimized prompt:</p><ul><li>reformulated the problem’s rules;</li><li>explicitly stated that there was a single available cool primary color;</li><li>imposed a one-word response;</li><li>introduced an explicit fallback;</li><li>removed permission to elaborate on ambiguity.</li></ul><p>The control problem itself also contains a real ambiguity: green may be considered a primary color under additive RGB color models.</p><p>The optimized formulation therefore did not merely constrain the output. It partially disambiguated the underlying problem.</p><p>Experiment Zero robustly demonstrates that <strong>a compound semantic and structural intervention can dramatically reduce output generation and latency without altering the material conclusion</strong>.</p><p>It does not isolate the independent causal contribution of persona, narrative urgency, rule disambiguation, negative constraints, or the one-word output matrix.</p><p>That decomposition requires subsequent ablation experiments.</p><h3>6. Experiment One: Mapping the Entropic Gradient</h3><h3>6.1 Hypothesis</h3><p>If every additional restriction were beneficial, efficiency should improve monotonically as more rules are added.</p><p>Experiment One was designed to test the opposite hypothesis:</p><blockquote><em>Beyond a certain point, instruction density may cease eliminating useful degrees of freedom and begin introducing redundancy, incompatibility, auxiliary subproblems, and additional output obligations.</em></blockquote><p>The experiment used a constant contractual passage and a materially simple extraction task: identify a termination penalty of R$7,500.00.</p><p>Four prompts represented increasing levels of narrative density:</p><ul><li><strong>Level 0 — Vacuum:</strong> open question;</li><li><strong>Level 1 — Light Gravity:</strong> legal role plus value-only response;</li><li><strong>Level 2 — Formula v1.0:</strong> strict JSON extractor with objective, scope, negative constraints, fallback, and format;</li><li><strong>Level 3 — Black Hole / Overload:</strong> hyperbolic persona, conflicting rules, underdetermined auxiliary tasks, and complex JSON output.</li></ul><p>Thirty iterations were executed for each condition, producing 120 total observations.</p><p>Requests within each iteration were created asynchronously, while the launch order rotated systematically across conditions.</p><h3>6.2 Results</h3><p>LevelDescriptionPrompt TokensCompletion TokensTotal TokensMean LatencyUnique Outputs0Vacuum111.0036.20147.201,236.76 ms71Light Gravity118.0011.00129.00<strong>973.96 ms</strong>12Formula v1.0168.0040.83208.831,305.16 ms33Black Hole / Overload265.00752.071,017.076,775.01 ms30</p><p>Differences across the four levels were substantial under a non-parametric repeated-measures test:</p><p>[<br>\chi²_F(3)=75.64,<br>\qquad<br>p=2.64\times10^{-16}<br>]</p><p>for latency, and</p><p>[<br>\chi²_F(3)=84.12,<br>\qquad<br>p=4.01\times10^{-18}<br>]</p><p>for completion tokens.</p><p>The lowest latency did <strong>not</strong> occur at the condition originally labeled “Optimal Point / Formula v1.0.”</p><p>The empirical minimum occurred at <strong>Level 1 — Light Gravity</strong>.</p><p>This result does not weaken the proportionality hypothesis.</p><p>It falsifies the assumption that one fixed structural density is universally optimal.</p><p>For a task whose correct answer is explicit, unique, and easily localized, the complete formula introduced more structure than the problem required.</p><h3>6.3 Marginal Inversion</h3><p>From Level 0 to Level 1, seven additional input tokens avoided an average of 25.20 completion tokens and reduced latency by 262.80 ms:</p><h3>-\frac{-25.20}{7}</h3><p>3.60.<br>]</p><p>Each additional input token was operationally associated with the elimination of 3.60 completion tokens.</p><p>From Level 1 to Level 2, the sign reversed.</p><p>Fifty additional prompt tokens were accompanied by 29.83 additional completion tokens and 331.19 ms of additional latency:</p><h3>-\frac{29.83}{50}</h3><p>-0.60.<br>]</p><p>From Level 2 to Level 3, 97 additional input tokens accompanied an increase of 711.23 completion tokens and 5,469.85 ms of latency:</p><h3>-\frac{711.23}{97}</h3><p>-7.33.<br>]</p><p>The leverage index therefore changes sign between Levels 1 and 2.</p><p>This point represents the <strong>semantic return inversion</strong>: beyond it, additional specification no longer contracts total cost and instead begins to expand it.</p><h3>6.4 The U-Shaped Curve</h3><p>Relative to Level 0, Light Gravity reduced:</p><ul><li>completion tokens by 69.61%;</li><li>total tokens by 12.36%;</li><li>latency by 21.25%.</li></ul><p>Relative to Level 1, Formula v1.0 increased:</p><ul><li>completion tokens by 271.21%;</li><li>total tokens by 61.89%;</li><li>latency by 34.00%.</li></ul><p>Relative to Level 1, Overload increased:</p><ul><li>completion tokens by 6,736.97%;</li><li>total tokens by 688.42%;</li><li>latency by 595.61%.</li></ul><p>Latency therefore exhibits the predicted qualitative shape:</p><p><strong>initial decline → minimum → accelerated expansion.</strong></p><p>Completion tokens showed a Pearson correlation of</p><p>[<br>r=0.988<br>]</p><p>with latency across the 120 observations.</p><p>An exploratory linear regression using only completion_tokens explained approximately 97.6% of the observed variance in latency.</p><p>This does not establish causality, nor does it separate generation time from queueing or network effects. It does demonstrate that, within this dataset, latency expansion was tightly associated with the expansion of generated computational work.</p><h3>7. Structural Friction: Four Distinct Mechanisms</h3><p>The term <strong>Structural Friction</strong> should describe something more specific than a “long prompt.”</p><p>Length and conflict are not equivalent.</p><p>A long but coherent and necessary document may reduce error.</p><p>A single contradictory instruction may make a task unsatisfiable.</p><p>If each instruction (C_i) defines a set of admissible outputs, the feasible region of a request can be represented as</p><p>\bigcap_{i=1}^{n}C_i.<br>]</p><p>Coherent restrictions are useful when they reduce (\mathcal{F}) while preserving the correct answer.</p><p>Friction emerges when the intersection ceases to converge efficiently.</p><p>At least four mechanisms can produce this effect.</p><h3>7.1 Redundancy</h3><p>A redundant rule increases input cost without further reducing the feasible region.</p><p>It repeats a boundary already established or specifies behavior that the model would have adopted anyway.</p><p>Its marginal return approaches zero.</p><h3>7.2 Conflict</h3><p>Two rules may define incompatible sets, making</p><p>[<br>\mathcal{F}=\varnothing.<br>]</p><p>In such cases, no output can simultaneously satisfy every condition.</p><p>The model must effectively treat the request as a soft constraint-satisfaction problem: prioritize, reinterpret, ignore, or relax one or more instructions.</p><p>Recent research on instruction following under conflicting constraints shows that model performance deteriorates under such conditions and that interactions emerge between instruction position, priority, and logical compatibility.</p><p>The difficulty therefore depends not only on how many rules exist, but on the relationships among them.</p><h3>7.3 Task Accretion</h3><p>Adding an instruction does not necessarily constrain the original task.</p><p>It may expand it.</p><p>Requesting, in addition to the contractual penalty:</p><ul><li>implied inflation;</li><li>currency conversion;</li><li>probable cat breed;</li><li>psychological profiling;</li><li>legal justification</li></ul><p>does not constitute a more precise version of the original extraction task.</p><p>It transforms a scalar target into a multi-target vector:</p><p>(\text{penalty})<br>]</p><p>whereas</p><p>(<br>\text{penalty},<br>\text{exchange rate},<br>\text{inflation},<br>\text{cat classification},<br>\text{psychological profile},<br>\text{legal reasoning}<br>).<br>]</p><p>The output space cannot collapse toward a single value when the specification itself re-expands that space.</p><h3>7.4 Output-Matrix Inflation</h3><p>A complex output matrix requires more generated tokens even when the underlying reasoning remains trivial.</p><p>If the system is instructed to produce multiple properties, justifications, and caveats, a longer response does not necessarily indicate internal inefficiency.</p><p>It may simply represent faithful execution of the specification.</p><p>Level 3 combines all four mechanisms.</p><p>It contains rules that are impossible to verify, requests calculations without supplying sufficient data, simultaneously asks the model to ignore and preserve related information, and demands an output far larger than the original target.</p><p>The model responded by attempting to resolve those gaps: declining unsupported psychological inferences, explaining why inflation or currency conversion could not be computed, adding legal caveats, and constructing large structured objects.</p><p>All 30 Level 3 outputs were textually distinct, and at least one produced formally invalid JSON.</p><p>Experiment One therefore clearly demonstrates <strong>operational overload</strong>, but it does not permit the entire increase to be attributed to an invisible internal struggle to reconcile constraints.</p><p>A substantial part of the observed effect comes from additional work explicitly requested by the prompt.</p><p>The scientifically defensible conclusion is therefore:</p><blockquote><strong><em>Conflict, redundancy, objective expansion, and output complexity can transform additional constraints into additional computational cost. The present experiment measures their combined effect.</em></strong></blockquote><p>An isolated demonstration of a pure <strong>constraint-reconciliation cost</strong> will require holding the material objective, output format, and response-length ceiling constant while varying only the logical coherence of the rules.</p><h3>8. The Law of Entropic Proportionality</h3><p>The original formulation of Semantic Thermodynamics treated Narrative Gravity as a relatively fixed envelope.</p><p>The new data indicate that the envelope must instead be adaptive.</p><p>What should remain invariant is not the amount of structure, but the correspondence between structural pressure and problem complexity.</p><p>The <strong>entropic mass</strong> of a task may be represented as a vector</p><p>\begin{bmatrix}<br>e_a\<br>e_d\<br>e_r\<br>e_s\<br>e_u\<br>e_f<br>\end{bmatrix},<br>]</p><p>where:</p><ul><li>(e_a): ambiguity among semantically distinct answers;</li><li>(e_d): density of distractors in the input;</li><li>(e_r): reasoning depth required;</li><li>(e_s): complexity of the output schema;</li><li>(e_u): evidentiary insufficiency or uncertainty;</li><li>(e_f): expected cost of failure.</li></ul><p>Constraint density can similarly be represented by</p><p>\begin{bmatrix}<br>g_\Psi\<br>g_\Omega\<br>g_{\oint}\<br>g_{\bar X}\<br>g_M\<br>g_{S_0}<br>\end{bmatrix}.<br>]</p><p>The <strong>Entropic Proportionality Tensor</strong> (\Lambda) can then be defined as the operator relating task properties to appropriate constraint intensities:</p><p>\Lambda_{\theta,s,\tau}<br>(\mathbf{e}),<br>]</p><p>where:</p><ul><li>(\theta) identifies the model;</li><li>(s) identifies the serving regime;</li><li>(\tau) identifies the required quality threshold.</li></ul><p>The optimal narrative density is defined as</p><p>\underset{\mathbf{g}}{\operatorname{arg,min}};<br>J(\mathbf{g};\mathbf{e})<br>]</p><p>subject to</p><p>[<br>P(\text{correct answer}\mid\mathbf{g},\mathbf{e})<br>\geq \tau<br>]</p><p>and, when applicable,</p><p>[<br>P(\text{structurally valid output}\mid\mathbf{g},\mathbf{e})<br>\geq \sigma.<br>]</p><p>Structural Friction can then be operationalized as excess cost relative to the optimum:</p><h3>J(\mathbf{g};\mathbf{e})</h3><p>J(\mathbf{g}^{*};\mathbf{e}).<br>]</p><p>By definition,</p><p>[<br>F_s\geq0.<br>]</p><p>The <strong>Black Hole</strong> regime is therefore not a mysterious state.</p><p>It is the region in which the marginal cost of an additional constraint exceeds its marginal capacity to reduce error or unnecessary generation:</p><p>[<br>\frac{\partial J}{\partial |\mathbf{g}|}</p><p>]</p><p>A simple scalar approximation is</p><h3>J_0</h3><p>a(e)g<br>+<br>b(e)g²<br>+<br>c,\chi(g),<br>]</p><p>where:</p><ul><li>the negative linear term represents the initial benefit of structure;</li><li>the quadratic term represents over-specification;</li><li>(\chi(g)) represents logical conflict among restrictions.</li></ul><p>In the absence of conflict, the minimum occurs at</p><p>\frac{a(e)}{2b(e)}.<br>]</p><p>For simple problems, (a(e)) is small: there is little unnecessary uncertainty to remove, and (g^{*}) shifts leftward.</p><p>For ambiguous, long-context, or high-risk problems, the initial benefit of restriction may be substantially larger, shifting the optimum to the right.</p><p>This produces a falsifiable formulation of the <strong>Law of Entropic Proportionality</strong>:</p><blockquote><strong><em>Holding model, serving regime, and quality threshold constant, the optimal density of semantic constraint should increase with the entropic mass of the task; beyond that optimum, the marginal cost of additional structure becomes positive.</em></strong></blockquote><p>The experiments reported here provide initial evidence for the existence of an optimum and for its displacement toward lighter constraint under low-entropy tasks.</p><p>They are not yet sufficient to estimate a universal form of (\Lambda).</p><h3>9. Narrative as a Semantic Compiler</h3><p>A conventional compiler transforms a formal specification into an executable representation.</p><p>Operational narrative performs an analogous function at a probabilistic level: it transforms broad human intent into a more concentrated distribution of admissible continuations.</p><p>The Persona selects a policy family.</p><p>The Objective defines the terminal state.</p><p>The Scope defines admissible evidence.</p><p>Negative Constraints eliminate destinations.</p><p>The Matrix determines the grammar of materialization.</p><p>The Ground State provides a safe terminal fallback.</p><p>Narrative does not replace constrained decoding.</p><p>The two mechanisms operate at different layers.</p><p>A grammar may prevent the production of syntactically invalid JSON.</p><p>It cannot, by itself, determine whether a field should contain a value, null, a refusal, or an unsupported inference.</p><p>Narrative constrains <strong>meaning</strong>.</p><p>Constrained decoding constrains <strong>syntax</strong>.</p><p>Reliable systems may require both.</p><p>Nor does the framework imply that dramatic personas are inherently superior.</p><p>Experiment One points in the opposite direction.</p><p>For a trivial extraction task, the instruction:</p><blockquote><em>“You are a lawyer. Extract the termination penalty and respond only with the value.”</em></blockquote><p>outperformed the complete Formula v1.0.</p><p>The relevant quantity is therefore not rhetorical intensity, but <strong>useful restrictive information per token</strong>.</p><p>The best narrative is not the longest, most solemn, or most detailed.</p><p>It is the one in which every component removes a real uncertainty in the task.</p><h3>10. In What Sense Is This Quantity Thermodynamic?</h3><p>Landauer’s principle established a fundamental connection between logically irreversible information processing and physical dissipation, reinforcing the broader principle that information does not exist independently of a physical substrate.</p><p>That relationship does <strong>not</strong>, however, justify treating every reduction in token count as a direct measurement of heat.</p><p>Landauer’s bound concerns fundamental physical limits of information operations.</p><p>The experiments reported here measure API-level telemetry and response time in an opaque production infrastructure many abstraction layers above that limit.</p><p>Narrative may therefore be described as an <strong>operational thermodynamic quantity</strong> only in a restricted sense.</p><p>First, it modifies a probabilistic distribution over computationally realized output states.</p><p>Second, that modification changes measurable material quantities such as generated tokens, execution time, and monetary cost.</p><p>Third, the system exhibits an efficiency regime, an optimum, and a region of increasing dissipation or friction.</p><p>The qualifier <strong>operational</strong> is essential.</p><p>Until electrical consumption, accelerator utilization, execution cycles, or energy per request are directly measured, the observed reductions cannot be claimed to correspond proportionally to reductions in physical heat or energy.</p><p>Nor do these experiments establish narrative as a new fundamental force of nature.</p><p>They support a narrower and more concrete proposition:</p><blockquote><strong><em>Structured meaning, when encoded as an instruction, changes the physical work performed by a machine while producing a response.</em></strong></blockquote><p>No mysticism is required.</p><p>Every prompt is information represented on physical hardware.</p><p>Every inference is computation executed by a physical system.</p><p>Any systematic modification in the amount or duration of generated computation has material consequences.</p><p>The scientific question is therefore to quantify the transfer function between semantic structure and computational cost.</p><h3>11. Implications for AI Infrastructure</h3><p>The enterprise implication of this theory is not to wrap every request in the complete Semantic Thermodynamics formula.</p><p>It is to construct a <strong>semantic-density router</strong>.</p><p>Before producing the final instruction, a system could estimate the entropic mass of the task:</p><ul><li>number of plausible answers;</li><li>distribution of relevant evidence;</li><li>distractor density;</li><li>output complexity;</li><li>reasoning depth;</li><li>uncertainty;</li><li>cost of error.</li></ul><p>The system would then select the smallest set of constraints capable of meeting the required quality threshold.</p><p>A direct field-extraction request may require only an objective and output format.</p><p>A contract containing competing clauses may require a specialized persona, explicit scope, negative constraints, and a fallback state.</p><p>A task containing mutually incompatible objectives may not require a denser prompt at all.</p><p>It may require decomposition into separate operations.</p><p>Such routing can be represented as a policy:</p><p>[<br>\pi:<br>\mathbf{e}<br>\longrightarrow<br>\mathbf{g}^{*}.<br>]</p><p>The net financial effect of a narrative intervention can be expressed as</p><p>c_p\Delta T_p<br>+<br>c_c\Delta T_c<br>+<br>c_\ell\Delta L<br>+<br>c_e\Delta \mathcal{E}.<br>]</p><p>The intervention is economically efficient when</p><p>[<br>\Delta C&lt;0.<br>]</p><p>In Experiment Zero, the additional cost of 48 input tokens was compensated by a mean saving of 242.38 completion tokens.</p><p>Across the first gradient in Experiment One, seven additional input tokens saved 25.20 completion tokens.</p><p>Across subsequent gradients, the return became negative.</p><p>This demonstrates why prompt length in isolation is an inadequate optimization metric.</p><p>The correct object of optimization is the <strong>complete inference cycle</strong>.</p><h3>12. Limitations</h3><p>The results are strong as a proof of concept but do not support unrestricted generalization.</p><p>First, each experiment uses only one material task.</p><p>Experiment Zero includes a color problem with genuine interpretive ambiguity.</p><p>Experiment One uses an extremely simple extraction task.</p><p>The shape of the curve remains unknown for programming, mathematics, document retrieval, creative generation, classification, agent planning, and long-horizon reasoning.</p><p>Second, the experimental scripts were configured with a default model while allowing replacement through an environment variable, and the resulting CSV files do not record the effectively resolved model identifier, model snapshot, system fingerprint, reasoning effort, or service tier.</p><p>Third, latency includes network transmission, queueing, and provider-side conditions.</p><p>Paired execution and rotating request order reduce some of this noise but cannot eliminate it.</p><p>Fourth, completion_tokens was not decomposed into visible output tokens, reasoning tokens, and other internally generated components.</p><p>This prevents direct identification of which fraction of the observed contraction occurred in non-visible reasoning.</p><p>Fifth, the treatments modify several properties simultaneously.</p><p>Experiment Zero combines disambiguation, persona, narrative urgency, output restriction, and fallback behavior.</p><p>Experiment One combines density, conflict, task expansion, and output complexity.</p><p>Sixth, textual diversity is not equivalent to semantic entropy.</p><p>Outputs may differ lexically while belonging to the same semantic equivalence class, as demonstrated by Experiment Zero.</p><p>Future studies should cluster outputs by semantic equivalence before calculating answer entropy.</p><p>Finally, no direct measurement of power consumption, accelerator occupancy, floating-point operations, or energy was performed.</p><p>At the present stage, <strong>thermodynamics</strong> should therefore be understood as an effective theory of computational cost and probability distributions, not as a demonstrated one-to-one equivalence with fundamental thermal quantities.</p><h3>13. Required Experimental Program</h3><p>The next stage should move beyond compound interventions and adopt a factorial design.</p><p>Each of the six components —</p><p>[<br>\Psi,;<br>\vec{\Omega},;<br>\oint,;<br>\bar X,;<br>M,;<br>S_0<br>]</p><p>— should be independently activated and removed.</p><p>A full factorial design would allow estimation of main effects and interactions.</p><p>A fractional factorial design could reduce the number of API calls while preserving the most informative combinations.</p><p>A dedicated conflict experiment should preserve:</p><ul><li>identical source text;</li><li>identical material objective;</li><li>identical output schema;</li><li>identical response-length ceiling;</li><li>approximately equal prompt length.</li></ul><p>The only manipulated variable should be the logical relationship among rules:</p><p><strong>coherent, redundant, or contradictory.</strong></p><p>Under such a design, any increase in internal generation could be attributed with substantially greater confidence to constraint reconciliation rather than expansion of the requested task.</p><p>Future telemetry should include</p><p>[<br>T_{\text{input}},<br>\quad<br>T_{\text{visible}},<br>\quad<br>T_{\text{reasoning}},<br>\quad<br>TTFT,<br>\quad<br>TPOT,<br>\quad<br>L_{\text{total}},<br>]</p><p>together with:</p><ul><li>resolved model identifier;</li><li>model snapshot;</li><li>system fingerprint;</li><li>cache status;</li><li>reasoning-effort setting;</li><li>termination reason;</li><li>structural-validity score.</li></ul><p>To establish the genuinely physical dimension of the theory, the protocol should subsequently be reproduced using open-weight models running on controlled hardware, with direct sampling of power and energy consumption per request.</p><p>Only then will it be possible to test whether contractions in tokens and latency correspond systematically to contractions in joules.</p><p>The experiment must also vary input entropy itself.</p><p>Rather than relying on four intuitively labeled prompt levels, future studies should construct tasks with controlled variation in:</p><ul><li>number of plausible answers;</li><li>proportion of distractors;</li><li>degree of contradiction;</li><li>amount of missing evidence;</li><li>reasoning depth;</li><li>output dimensionality.</li></ul><p>The function</p><p>[<br>J(g;e)<br>]</p><p>could then be estimated across multiple values of (e), allowing direct testing of whether the optimal point shifts as predicted by (\Lambda).</p><h3>14. Conclusion</h3><p>Experiment Zero demonstrated that a semantically constrained formulation can tolerate a moderate increase in prompt length while producing a far larger contraction in generated output, total token expenditure, and end-to-end latency.</p><p>The material answer remained unchanged.</p><p>The number of textual realizations collapsed from fifty to one.</p><p>Experiment One demonstrated that this benefit does not increase indefinitely.</p><p>For a low-entropy task, a minimal and directly targeted instruction outperformed both the unconstrained baseline and the full formula.</p><p>When additional constraints began introducing conflict, auxiliary fields, unsupported inferences, and secondary objectives, computational cost increased dramatically.</p><p>The central result is therefore neither that <strong>long prompts are bad</strong> nor that <strong>dramatic narratives make models more intelligent</strong>.</p><p>It is that:</p><blockquote><strong><em>Constraints have marginal returns.</em></strong></blockquote><p>Before the optimum, they remove degrees of freedom that the model would otherwise need to resolve or materialize.</p><p>Beyond the optimum, they consume context, multiply obligations, create incompatibilities, and re-expand the very output space they were intended to compress.</p><p>Narrative thus emerges as a form of <strong>semantic compilation</strong>.</p><p>It converts intention into boundaries, boundaries into probability distributions, and probability distributions into computational work.</p><p>Its value is not determined by the number of constraints imposed, but by the correspondence between each constraint and a genuine uncertainty in the task.</p><p>The Law of Entropic Proportionality can therefore be summarized in a single proposition:</p><blockquote><strong><em>Optimal structure is not maximal. It is proportional.</em></strong></blockquote><p>To constrain infinity is not to construct the densest possible prison around a model.</p><p>It is to discover the smallest boundary capable of transforming a field of possibilities into an action that is correct, stable, and economically efficient.</p><h3>References</h3><p>Agrawal, A. et al. (2024). <em>Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve</em>. 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI).</p><p>Farquhar, S. et al. (2024). <em>Detecting Hallucinations in Large Language Models Using Semantic Entropy</em>. Nature.</p><p>Geng, S. et al. (2023). <em>Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning</em>. Proceedings of EMNLP.</p><p>Landauer, R. (1961). <em>Irreversibility and Heat Generation in the Computing Process</em>. IBM Journal of Research and Development.</p><p>Ouyang, L. et al. (2022). <em>Training Language Models to Follow Instructions with Human Feedback</em>.</p><p>Raspanti, F., Ozcelebi, T., &amp; Holenderski, M. (2025). <em>Grammar-Constrained Decoding Makes Large Language Models Better Logical Parsers</em>. ACL Industry Track.</p><p>Schall, M., &amp; de Melo, G. (2025). <em>The Hidden Cost of Structure: How Constrained Decoding Affects Language Model Performance</em>. RANLP.</p><p>Vaswani, A. et al. (2017). <em>Attention Is All You Need</em>. Advances in Neural Information Processing Systems.</p><p>Wei, J. et al. (2022). <em>Chain-of-Thought Prompting Elicits Reasoning in Large Language Models</em>. Advances in Neural Information Processing Systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf53c41428c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Show HN: Semantic Thermodynamics — 79% LLM token reduction via narrative constraints]]></title>
            <link>https://medium.com/@tauanvinicius/show-hn-semantic-thermodynamics-79-llm-token-reduction-via-narrative-constraints-a0cd792d577a?source=rss-9f3ba46c7dbd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0cd792d577a</guid>
            <dc:creator><![CDATA[Tauan Sloboda]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 00:09:37 GMT</pubDate>
            <atom:updated>2026-08-06T00:09:37.278Z</atom:updated>
            <content:encoded><![CDATA[<p>Semantic Thermodynamics: A Framework for LLM Entropy Minimization Abstract Large Language Models (LLMs) fundamentally operate as Bayesian inference engines traversing highly dimensional semantic spaces. In environments with high semantic entropy (unrestricted prompt boundaries), these models expend excess computational energy (inference time and reasoning tokens) to map infinite phase spaces before collapsing a probability into an output. This paper introduces the framework of Semantic Thermodynamics, positing that narrative structure is not merely a linguistic abstraction, but a physical constraint capable of performing work. By applying “Narrative Gravity” — a precise formulation of persona, teleological vectors, topological boundaries, and destructive pruning — we demonstrate an empirical reduction in output token expenditure by 79.29% and a reduction in system latency by 60.73%. Furthermore, we introduce the Law of Entropic Proportionality (Λ), proving that maximum constraint density must be proportional to input entropy to avoid structural friction, offering a paradigm shift in how commercial AI infrastructure routes and processes natural language. 1. The Fundamental Equation of Entropic Pruning The framework seeks to achieve Narrative Entropy Minimization (ΔNmin), forcing the system into its state of highest computational efficiency. ΔNmin = Λ(Ein) · [ Ψ · Ω⃗ · ∮ (R − X̄) · M ] + S0 Dissecting the Variables: Ψ (Psi) — The Persona: Forces the immediate collapse of the model’s “wave function” into a hyper-specialized mental model. • Ω⃗ (Omega) — The Teleological Vector: The gravitational force directing Brownian probability toward a single target. ∮ (Contour Integral) — The Scope Boundary: Establishes the topological limits of the operation, ensuring laminar information flow. X (X-Bar) — Destructive Pruning: ̄ The explicit elimination of channel noise via destructive interference (e.g., “Ignore X”). M (Matrix) — Output Crystallization: The rigid molecular structure of the final output (e.g., pure JSON). S 0 (Ground State) — The Fallback: A thermodynamic safety valve providing a minimumenergy state to rest if the target is unachievable, preventing probabilistic hallucination. Λ(Ein) — The Entropic Proportionality Tensor: A dynamic coefficient that adjusts constraint density based on the input’s entropic mass. 2. Empirical Validation (Experiment Zero) A controlled baseline (Zero Gravity) was tested against the Semantic Thermodynamics framework (Formula v1.0) over 100 API iterations, isolating the final material action. Results: Control (High Entropy): 305.70 avg completion tokens | 3,489.38 ms avg latency Optimized (Low Entropy): 63.32 avg completion tokens | 1,370.38 ms avg latency Delta: -79.29% completion tokens | -60.73% latency 3. Structural Friction (Experiment One) Further testing revealed that excessive narrative constraints on low-entropy inputs cause “Structural Friction,” reversing the ROI. The model consumes more compute reconciling the constraints than solving the problem. This anomaly necessitates the Λ tensor for dynamic routing. • • • • • • • • • Conclusion Semantic Thermodynamics proves that narrative constraint acts as a physical boundary in Bayesian systems. Implementing this framework allows for dynamic, context-aware routing that drastically reduces overhead costs and latency in enterprise LLM deployments without sacrificing accuracy. Author: Tauan Vinicius Guahyba Sloboda</p><p>Source code and raw telemetry available on GitHub: [<a href="https://github.com/tauansloboda/semantic-thermodynamics">https://github.com/tauansloboda/semantic-thermodynamics</a>].</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0cd792d577a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>