<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Smit Sojitra</title>
    <description>The latest articles on DEV Community by Smit Sojitra (@smit153).</description>
    <link>https://dev.to/smit153</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4168452%2F7b60b4ef-4afe-42fb-9a2e-b0835f6fe644.jpg</url>
      <title>DEV Community: Smit Sojitra</title>
      <link>https://dev.to/smit153</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/smit153"/>
    <language>en</language>
    <item>
      <title>AI just cracked a 25-year-old conjecture. To get why, start with P vs NP.</title>
      <dc:creator>Smit Sojitra</dc:creator>
      <pubDate>Sat, 31 Oct 2026 06:43:03 +0000</pubDate>
      <link>https://dev.to/smit153/ai-just-cracked-a-25-year-old-conjecture-to-get-why-start-with-p-vs-np-om</link>
      <guid>https://dev.to/smit153/ai-just-cracked-a-25-year-old-conjecture-to-get-why-start-with-p-vs-np-om</guid>
      <description>&lt;p&gt;An AI model just disproved a hypothesis that complexity theorists had been building on since 1999.&lt;/p&gt;

&lt;p&gt;On October 25, OpenAI posted a 67-page preprint titled "The Exponential Time Hypothesis is False", found by an internal model and partly checked in the Lean proof checker. Anthropic soon posted a refutation of its own. Lance Fortnow: "it is safe to assume now that the exponential-time hypothesis is toast."&lt;/p&gt;

&lt;p&gt;Some coverage said P vs NP was about to fall, or encryption was about to break. To see what actually changed, start with P vs NP.&lt;/p&gt;

&lt;h2&gt;
  
  
  A puzzle that's quick to check and slow to solve
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(a ∨ b ∨ c) ∧ (¬a ∨ d ∨ e) ∧ (¬c ∨ f ∨ g)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;∨ is OR, ∧ is AND, ¬ is NOT. Set each letter true or false so every bracket has a true part. That's &lt;strong&gt;3-SAT&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Checking an answer takes one pass. Finding one means searching 2ⁿ assignments: about a quadrillion at 50 variables. The best algorithm before October, PPSZ, gets that to about 1.307ⁿ. Faster, still exponential.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feis8fggquza3c35u8o40.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feis8fggquza3c35u8o40.png" alt="Left: three clauses checked against one answer, a = false, b = true, c = false, each ticked and circled &amp;quot;one pass&amp;quot;. Right: a hand-drawn grid of 256 cells, one per assignment of 8 variables. Brute force has slashed through 173 of them in red before hitting the one that works, circled in yellow as guess 174." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full version has a live puzzle you can solve by hand before brute force grinds through it. &lt;strong&gt;&lt;a href="https://smiit.in/writing/p-vs-np" rel="noopener noreferrer"&gt;Read more and try it here&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  P is what we can solve fast. NP is what we can check fast.
&lt;/h2&gt;

&lt;p&gt;"Fast" means &lt;strong&gt;polynomial time&lt;/strong&gt;, steps growing like n² or n³. &lt;strong&gt;P&lt;/strong&gt; is problems you can solve that fast: sorting, shortest paths. &lt;strong&gt;NP&lt;/strong&gt; is problems where an answer can be checked that fast: 3-SAT, big Sudokus, exam scheduling.&lt;/p&gt;

&lt;p&gt;Is everything easy to check also easy to solve? That's P vs NP, with a million-dollar prize since 2000. Most researchers think no. Nobody has proved it.&lt;/p&gt;

&lt;p&gt;In 1971 Stephen Cook showed every NP problem translates into SAT in polynomial time. Problems everything in NP reduces to are &lt;strong&gt;NP-hard&lt;/strong&gt;, and if they're in NP too, &lt;strong&gt;NP-complete&lt;/strong&gt;. A fast algorithm for any one of them makes all of NP fast.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F658u8dlafa4sj0f54ear.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F658u8dlafa4sj0f54ear.png" alt="Two maps side by side. Left, &amp;quot;if P ≠ NP&amp;quot;: a big NP circle holds a small P circle with sorting, paths and primes; factoring floats in NP outside P; an NP-hard blob overlaps NP, and the overlap holding 3-SAT, Sudoku and routes is NP-complete; halting sits in NP-hard outside NP. Right, &amp;quot;if P = NP&amp;quot;: the P circle fills all of NP." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ETH: a bet on how hard 3-SAT really is
&lt;/h2&gt;

&lt;p&gt;Between polynomial and exponential there's a middle zone, like 2^√n, called &lt;strong&gt;sub-exponential&lt;/strong&gt;. In 1999 Russell Impagliazzo and Ramamohan Paturi bet 3-SAT can't get there: for some fixed δ &amp;gt; 0, it needs 2^(δn) time. That's ETH.&lt;/p&gt;

&lt;p&gt;The logic runs one way. ETH true means P ≠ NP. ETH false says nothing about P = NP.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmk4iv4fxpjlx95pv7ksr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmk4iv4fxpjlx95pv7ksr.png" alt="A chain of three cards joined by &amp;quot;implies&amp;quot; arrows: SETH, ETH, P ≠ NP. SETH and ETH are scribbled out in red and marked &amp;quot;refuted&amp;quot;, footnoted as claimed in October 2026 and under expert review. P ≠ NP is circled in green and marked &amp;quot;still open&amp;quot;. Below: P = NP would knock out ETH. Knocking out ETH does not give P = NP." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lots of results said "no algorithm for X beats this, assuming ETH". Fortnow: "The fact that ETH and SETH fail doesn't mean their implications are false." They just need a new foundation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the AI actually proved
&lt;/h2&gt;

&lt;p&gt;A deterministic algorithm that counts every satisfying assignment in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(n+m)^O(1) · 2^( n / (log n)^(1/2 + o(1)) )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exponent is n divided by about √log n, and that divisor keeps growing, so eventually this beats 2^(δn) for any δ. That's what ETH ruled out.&lt;/p&gt;

&lt;p&gt;Watch the brackets. "2ⁿ divided by √log n" would barely beat brute force (about 2^998.6 at n = 1,000). The real bound puts the division inside the exponent: about 2^380.&lt;/p&gt;

&lt;p&gt;Impagliazzo, Paturi and MIT's Ryan Williams are reviewing it. Fortnow notes the Lean proof gives "a slightly weaker bound". It isn't peer reviewed yet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sub-exponential doesn't mean fast
&lt;/h2&gt;

&lt;p&gt;The paper hides its constants, and the new curve only beats PPSZ once √log n outgrows them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq3asisdly1e1wsde2kja.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq3asisdly1e1wsde2kja.png" alt="A chart of exponent per variable against the number of variables on a log scale. PPSZ is a flat line at 0.386. Three falling curves for hidden constant C = 1, 2 and 6 cross it at about 820 variables, about 400 billion, and about 10^105. Illustration, not numbers from the paper." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My illustration: with C = 1 it wins from about 820 variables. With C = 6, you'd need more variables than atoms in the universe. It's a "galactic" algorithm, and nobody will ever run it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it doesn't spread to every NP problem
&lt;/h2&gt;

&lt;p&gt;Reductions to 3-SAT inflate the size. Turn n items into n² variables and the gain is gone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ubuvp8gl2l3ua89zy9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ubuvp8gl2l3ua89zy9b.png" alt="Two lanes showing the exponent cost per original item, where brute force costs 1. If the reduction makes 3n variables, the cost goes 1.63, 1.06, 0.78 as n goes from 10 to a million, so the speedup is kept. If it makes n² variables, the cost goes 4.66, 269, 190,240, so the speedup is lost." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The paper says the result "does not imply that general NP problems admit subexponential time algorithms". Fortnow: "It gives nothing new for Subset Sum or Traveling Salesman."&lt;/p&gt;

&lt;h2&gt;
  
  
  So is P = NP now? And encryption?
&lt;/h2&gt;

&lt;p&gt;No. Sub-exponential time for all of NP would need 3-SAT in 2^(n^o(1)), and this is nowhere near. Williams still says people should "put a little more weight on the plausibility of P = NP, but one's weight may vary."&lt;/p&gt;

&lt;p&gt;RSA rests on factoring, which isn't believed to be NP-complete and already has a sub-exponential algorithm, the number field sieve. Encoding it as SAT is the losing case above. Williams asked OpenAI whether it breaks any cryptosystem, and they said they're reasonably confident it doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this can't tell you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Whether the proof holds. The review is ongoing.&lt;/li&gt;
&lt;li&gt;How fast it really is. The constants aren't published.&lt;/li&gt;
&lt;li&gt;Who found what first. Anthropic's Levent Alpöge suggested OpenAI built on existing work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If someone pushes 3-SAT to 2^(n^o(1)), every NP problem goes sub-exponential and this gets much louder. Until then, one of the safest bets in computer science lost, and it lost to a machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://smiit.in/writing/p-vs-np" rel="noopener noreferrer"&gt;The full version with five live demos&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://smiit.in/writing/long-session-cost" rel="noopener noreferrer"&gt;Why message 80 costs more than message 8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;More posts: &lt;a href="https://smiit.in/writing" rel="noopener noreferrer"&gt;smiit.in/writing&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Did you expect ETH to fall before P vs NP got any closer? Tell me in the comments.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>ai</category>
      <category>algorithms</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Long AI Coding Sessions Get Expensive (Quadratic Attention Explained)</title>
      <dc:creator>Smit Sojitra</dc:creator>
      <pubDate>Sat, 24 Oct 2026 04:37:00 +0000</pubDate>
      <link>https://dev.to/smit153/why-long-ai-coding-sessions-get-expensive-quadratic-attention-explained-1nfk</link>
      <guid>https://dev.to/smit153/why-long-ai-coding-sessions-get-expensive-quadratic-attention-explained-1nfk</guid>
      <description>&lt;p&gt;Type "rename this variable" as the 8th message of a Claude Code session. Now type it again as the 80th. Same words, same answer, and with my sample numbers the second one costs about three times as much. Turn prompt caching off and it's six.&lt;/p&gt;

&lt;p&gt;Nothing's broken. A long session walks into a quadratic curve twice: once inside the model, where every token looks at every earlier token, and once on your bill, where every turn ships the whole conversation again. Caching makes the repeat cheaper. It doesn't change the shape.&lt;/p&gt;

&lt;h2&gt;
  
  
  The model has no memory
&lt;/h2&gt;

&lt;p&gt;Claude Code's docs put it bluntly: "The model doesn't remember anything between requests, so Claude Code re-sends the full context." And one message from you is rarely one request. Every tool call sends its result back as a new request carrying everything before it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Everyone checks everyone, so the work is n²
&lt;/h2&gt;

&lt;p&gt;Inside the model, each token gets a &lt;strong&gt;query&lt;/strong&gt; (what it's looking for), a &lt;strong&gt;key&lt;/strong&gt; (what it offers) and a &lt;strong&gt;value&lt;/strong&gt; (what it hands over). A token compares its query with every key, softmax turns the scores into weights, and the output is the weighted mix of values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Attention(Q, K, V) = softmax(Q·Kᵀ / √d_k) · V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Q·Kᵀ is every query against every key: n tokens, an n × n grid. Language models only look backwards, which trims the grid to a triangle of about n²/2 cells. That's still quadratic. Double the tokens, four times the work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmp5be60peowgvayhzkj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmp5be60peowgvayhzkj5.png" alt="Ten words of a sentence, each compared with every earlier word, form a triangle of 55 cells. The row for the word " width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The full version has a live grid you can type into and double. &lt;strong&gt;&lt;a href="https://smiit.in/writing/long-session-cost/" rel="noopener noreferrer"&gt;Read more and try it here&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;FlashAttention fixed the memory side by never storing the whole grid. It still computes every cell, so the time stays quadratic.&lt;/p&gt;

&lt;h2&gt;
  
  
  The KV cache helps, but not how you'd think
&lt;/h2&gt;

&lt;p&gt;Replies come out one token at a time. The KV cache keeps the keys and values of old tokens in GPU memory so they aren't recomputed. Plenty of explainers say this makes generation linear. It doesn't. Each new token still does one dot product per earlier token, so a whole reply is still about n²/2. What the cache saves is the rerun, which would push the total toward cubic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7il8sc2id733rcnnsktw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7il8sc2id733rcnnsktw.png" alt="Two rows of three small triangles. With a KV cache each step adds one new white row and reuses the grey rest. Without it, the whole triangle is white and redone every step. For a 100,000-token prompt and a 1,000-token reply: about 5.1 billion dot products with the cache, about 5 trillion without." width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;None of this shows up on your bill directly. Anthropic says a 900k-token request "is billed at the same per-token rate as a 9k-token request." So what makes the bill quadratic?&lt;/p&gt;

&lt;h2&gt;
  
  
  Your bill is quadratic for a dumber reason
&lt;/h2&gt;

&lt;p&gt;Say a session starts with S tokens (system prompt, tools, CLAUDE.md) and each turn adds about a. Turn k sends roughly S + k·a, so K turns add up to about S·K + a·K²/2. The same triangle again: every turn is a row, and every row re-sends everything above it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6dveze2gdgs1bhh5ebpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6dveze2gdgs1bhh5ebpg.png" alt="Six bars that grow longer with each request. In each bar the grey part was already sent and is read from cache, and a short white block at the end is new this turn and written to cache." width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompt caching lowers the slope, not the shape
&lt;/h2&gt;

&lt;p&gt;If the start of a request exactly matches something processed recently, the API skips the recompute and bills that part much cheaper. Anthropic doesn't say what it stores. Open-source servers like vLLM cache the KV blocks of earlier requests, so my guess is it's the same idea.&lt;/p&gt;

&lt;p&gt;On Claude Sonnet 5.5, per million tokens: $2 input, $2.50 to write the 5-minute cache, $0.10 to read it, $10 output (Anthropic's pricing page, October 2026). A 20× discount on reads sounds like it solves everything, but the cached part is exactly the part that grows. You still re-read the whole history every turn, just cheaper, and a fraction of a quadratic is still a quadratic.&lt;/p&gt;

&lt;p&gt;My sample session: Sonnet 5.5, a 20k-token start, 3k tokens added and 4 API requests per message. Message 8 costs about $0.05 and message 80 about $0.16. The whole 80 messages come to about $8.10, or about $112 with no caching. Cache reads are around two-thirds of the cached bill. That's the re-sending, on sale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F02c9j67fmz9f021bjpkh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F02c9j67fmz9f021bjpkh.png" alt="Four bars. With caching on, message 8 costs $0.05 and message 80 costs $0.16, about 3 times as much. With caching off, message 8 costs $0.41 and message 80 costs $2.60, about 6 times as much. Sample values, not a measurement." width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Watch the timer, too. Claude Code's docs say the cache lasts an hour on a subscription but five minutes on an API key or once you're on usage credits. Grab a coffee on an API key and your next message rewrites the whole context at the write price.&lt;/p&gt;

&lt;p&gt;The full post has a simulator with sliders for all of this. &lt;strong&gt;&lt;a href="https://smiit.in/writing/long-session-cost/" rel="noopener noreferrer"&gt;Try it here&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually moves the curve
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6cpl0hfpnac8gsxuhgaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6cpl0hfpnac8gsxuhgaf.png" alt="Six bars for the total cost of the same 80-message session on Sonnet 5.5. No caching: $112.10. 1-hour cache: $8.62. Default caching: $8.13. A 20-minute break before message 60: $8.72. /compact at message 41: $5.80. /clear at message 41: $5.70. Sample values." width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;/clear resets the triangle.&lt;/strong&gt; The system prompt and tools stay cached. Anthropic's docs: "/clear costs nothing."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/compact is a big request itself.&lt;/strong&gt; It reads the whole conversation to write the summary, so it saves about what /clear does but pays for one large read first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long breaks hurt most late in a session.&lt;/strong&gt; A 20-minute break before message 60 on the 5-minute cache takes that one message from about $0.13 to about $0.72.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switching models throws the cache away.&lt;/strong&gt; So does connecting an MCP server whose tools load up front.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subagents get their own context.&lt;/strong&gt; Their noisy output stays out of your main conversation, so it isn't re-sent on every later message.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this can't tell you
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It's a model with sample values, not your bill. Run &lt;code&gt;/usage&lt;/code&gt; in Claude Code for your real numbers.&lt;/li&gt;
&lt;li&gt;On Pro or Max you hit usage limits rather than a dollar figure, but the same curve decides how fast.&lt;/li&gt;
&lt;li&gt;The attention maths is textbook, not Claude. Anthropic doesn't publish its architecture, so tricks like grouped KV heads change the constants, though not the n² shape of standard attention.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'd actually do
&lt;/h2&gt;

&lt;p&gt;Treat a session like a branch, not a home. One task per session, /clear when the task changes. Keep CLAUDE.md short, since it rides along on every request. Pick the model at the start and leave it alone. On an API key, if you wander off mid-task, set &lt;code&gt;promptCacheTtl&lt;/code&gt; to &lt;code&gt;1h&lt;/code&gt; or /compact before you go. None of that changes the shape. It just keeps you on the cheap end of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Read more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://smiit.in/writing/long-session-cost/" rel="noopener noreferrer"&gt;Your AI coding session gets pricier with every message, full version with live demos&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;More posts: &lt;a href="https://smiit.in/writing" rel="noopener noreferrer"&gt;smiit.in/writing&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How long do your sessions usually run before you /clear? Tell me in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>performance</category>
    </item>
    <item>
      <title>Your model doesn't need to write the answer. It needs to point at it.</title>
      <dc:creator>Smit Sojitra</dc:creator>
      <pubDate>Thu, 15 Oct 2026 21:46:23 +0000</pubDate>
      <link>https://dev.to/smit153/your-model-doesnt-need-to-write-the-answer-it-needs-to-point-at-it-44p4</link>
      <guid>https://dev.to/smit153/your-model-doesnt-need-to-write-the-answer-it-needs-to-point-at-it-44p4</guid>
      <description>&lt;p&gt;You gave the LLM the answer. So why is it writing it out from scratch?&lt;/p&gt;

&lt;p&gt;Send a model a support ticket and four labels, and ask which one fits. It writes back &lt;code&gt;{"label": "billing"}&lt;/code&gt;, one token at a time. The word "billing" was in your prompt the whole time.&lt;/p&gt;

&lt;p&gt;Extraction is the same. The invoice number is in the PDF, and the model types it back to you. Usually it types it right.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing is a loop, and a writer can write anything
&lt;/h2&gt;

&lt;p&gt;An LLM reads your prompt in one pass, then writes the answer one token at a time, each token another trip through the model. That's also why output costs more: on Anthropic's price list, Sonnet 5.5 is $2 per million input tokens and $10 per million output.&lt;/p&gt;

&lt;p&gt;For a short label the cost isn't the real problem. The problem is that a writer can write &lt;em&gt;anything&lt;/em&gt;: "Billing", "billing_dispute", "Sure! The label is billing." So you add a parser, a retry, a schema. JSON mode helps, but it's "a format constraint, not a correctness guarantee," as one guide puts it.&lt;/p&gt;

&lt;p&gt;A pointer works differently. It reads the input once and scores what's already there: each of your labels, or each possible span of the document. The answer can only be something from the input.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6ykirvcxuk7rstj6h9cd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6ykirvcxuk7rstj6h9cd.png" alt="Two flows. Write: the input goes into a model that loops once per token and emits {" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This isn't new. Pointer Networks (2015) picked elements of the input as output. SQuAD (2016) defined every answer as "a segment of text from the corresponding reading passage." BERT answered it by scoring each token as a possible start or end of the answer. Named entity recognition still returns &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; offsets today.&lt;/p&gt;

&lt;h2&gt;
  
  
  What ScaleDown's CDMs are
&lt;/h2&gt;

&lt;p&gt;ScaleDown launched four small task models on October 13 and calls them Constrained Decoding Models. Their partner post with LangChain sums up the idea: "a CDM is trained for one task and only returns answers that task allows, like a label from your list or spans of the input."&lt;/p&gt;

&lt;p&gt;Going by ScaleDown's docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Classify&lt;/strong&gt; scores your text against each label's rubric and returns &lt;code&gt;top_label&lt;/code&gt; plus scores that sum to 1.0. &lt;strong&gt;It points.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract&lt;/strong&gt; returns "the exact text span extracted from the input," with a confidence and &lt;code&gt;start&lt;/code&gt;/&lt;code&gt;end&lt;/code&gt; offsets. &lt;strong&gt;It points.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarize&lt;/strong&gt; is "a fluent rewrite - not a selection of lifted sentences." &lt;strong&gt;It writes.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compress&lt;/strong&gt; shrinks long context. The docs don't say whether it selects or rewrites.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the idea holds for two of the four. One naming note: "constrained decoding" usually means masking a normal LLM's tokens so it can't break your schema (Outlines, XGrammar). Here it's a product name.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real win is the receipt
&lt;/h2&gt;

&lt;p&gt;Speed is nice. The bigger deal is that a pointed answer comes with proof. If Extract says the invoice number sits at characters 8 to 17, you slice your own string and check. A written answer with two digits swapped looks exactly like a correct one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjpjt19xsw1rrda6vn0i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmjpjt19xsw1rrda6vn0i.png" alt="A made-up invoice line, " width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where they'd sit in an app
&lt;/h2&gt;

&lt;p&gt;Not instead of your main LLM. Around it. Small models do the routine jobs and the general model does what actually needs writing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5dvko49gonuglpo8cabw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5dvko49gonuglpo8cabw.png" alt="Architecture diagram. A user request goes to Classify, which routes it to the main LLM. Tool output goes through Compress before reaching the main LLM. The agent trace goes to a second Classify that checks for looping and can stop the run. Documents go to Extract, which writes spans with offsets into your database." width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The loop check comes from LangChain's example: stop the run when Classify scores "looping" above 0.8. That only works if 0.8 means something on your data. ScaleDown doesn't publish calibration numbers, and Classify "always returns a winner - even if the model is uncertain," so add an &lt;code&gt;other&lt;/code&gt; label and measure on a few hundred of your own examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jev, OpenAI and Cloudflare do half of this
&lt;/h2&gt;

&lt;p&gt;TypeSafe's Jev, OpenAI's Decisions API and Cloudflare's Clef all answer typed questions with probabilities. That's the Classify half. None of them document pointing at spans.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo901i242zdlxrtil36eg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo901i242zdlxrtil36eg.png" alt="Four small platforms, one per API, each with three slots: pick a label, point at spans, summarize. ScaleDown CDMs fills all three, $0.05 per million input tokens. TypeSafe Jev ($0.042), OpenAI Decisions ($0.10, secondary source, beta) and Cloudflare Clef ($0.038 to $0.24) fill only pick a label; the other two slots are empty outlines for not documented. Output is free on all four" width="799" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What pointing can't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The answer has to be in the input.&lt;/strong&gt; "How many items on this invoice?" needs adding up. A pointer has nothing to point at.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A valid label isn't a correct one.&lt;/strong&gt; It can point at the wrong thing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarize writes&lt;/strong&gt;, and Compress doesn't say. Don't assume the "can't invent text" property covers them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The big numbers are ScaleDown's.&lt;/strong&gt; The tweet says 200x faster and 467x cheaper. ScaleDown's own benchmark docs say 8 to 19.5% more accurate and 2.2x to 13.9x faster. Nobody independent has checked either yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your text leaves your servers.&lt;/strong&gt; It's a hosted API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Want the deeper dive? Check out the detailed blog with interactive examples here: &lt;strong&gt;&lt;a href="https://smiit.in/writing/answer-is-in-the-input" rel="noopener noreferrer"&gt;smiit.in/writing/answer-is-in-the-input&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Read more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://smiit.in/writing/jev" rel="noopener noreferrer"&gt;Jev: the AI that doesn't talk (and why that's the point)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://smiit.in/writing/long-session-cost" rel="noopener noreferrer"&gt;Your AI coding session gets pricier with every message. Here's why.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Which of your LLM calls are secretly multiple choice? Tell me in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
