<?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 Dev48V on Medium]]></title>
        <description><![CDATA[Stories by Dev48V on Medium]]></description>
        <link>https://medium.com/@dev48v?source=rss-1c98528dfca9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5cD-ozBLDszy87eN</url>
            <title>Stories by Dev48V on Medium</title>
            <link>https://medium.com/@dev48v?source=rss-1c98528dfca9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:32:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dev48v/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 Same Link Is Fine on Windows and Broken in CI: 9 of 95 in One Note Folder]]></title>
            <link>https://dev48v.medium.com/the-same-link-is-fine-on-windows-and-broken-in-ci-9-of-95-in-one-note-folder-bc7eb8d69036?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc7eb8d69036</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:58:44 GMT</pubDate>
            <atom:updated>2026-11-09T17:04:57.054Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rvi0eKWd0TgLKTBJ.png" /></figure><p>A pile of notes rots from the edges. The note is still there, still readable, still confidently telling you to <em>see the setup doc</em> — and the setup doc was renamed eight months ago.</p><p>Markdown does not notice. The link renders. The anchor renders. The code block you pasted out of a source file renders exactly as it did the day you pasted it, including the two lines that source file no longer contains.</p><p>stale reads a folder of notes and reports three kinds of rot - links whose target file is gone, anchors whose heading is gone, and fenced blocks that claim to be copied from a source whose lines have changed - with the evidence that produced every verdict.</p><p>👉 <strong>Live, with every table computed in your browser by a port of the same engine:</strong> <a href="https://dev48.in/agentlab/vol5-03-stale.html">https://dev48.in/agentlab/vol5-03-stale.html</a></p><h3>🔴 The corpus is invented</h3><p>There is no public archive of one person’s notes, and borrowing somebody else’s is both a privacy problem and a licensing one. So the <strong>30 notes and 6 source files</strong> were generated from the fixed seed 20260083, and re-running the generator reproduces the tree byte for byte.</p><p>What that costs: every point estimate below is a property of <em>this</em> tree and would move on a real one. What transfers is the shape — that the three option flags disagree with each other at all, and roughly by how much, follows from how markdown and filesystems work rather than from the draw. The defects were not placed to hit a target: the generator draws each reference from a distribution, and every number here was measured afterwards by running the tool.</p><p><strong>30 notes, 136 references checked, 45 stale.</strong></p><h3>The link that passes on your laptop and 404s in CI</h3><p>NTFS and APFS match filenames without regard to case. ext4 does not.</p><p>A link written as setup.md against a file called Setup.md works on the machine it was written on and breaks the moment the notes are published from Linux. A checker built on os.path.exists reports <strong>PASS</strong> on the first machine and <strong>FAIL</strong> on the second, and never mentions that it changed its mind.</p><p><strong>9 of the 95 link references — 9.5% — resolve only case-insensitively</strong>, across 9 notes and 7 target files.</p><pre>notes/cell-formatting.md:8 setup.md#step-1-install no notes/setup.md; notes/SETUP.md differs only in case</pre><p>So stale resolves against an <em>index</em> of the tree rather than against the filesystem, and the case rule is a flag with a printed value. The answer is a property of the notes.</p><p>It is also not pure subtraction. A link that fails on case never had its #fragment read, so switching to --case insensitive <strong>exposes 5 anchor references</strong> that were hiding behind a link failure. Fixing one check uncovers another.</p><h3>Two anchor conventions, disagreeing about four in ten</h3><p>GitHub lowercases a heading, <strong>deletes</strong> punctuation rather than replacing it, hyphenates the spaces, and suffixes a repeat with -1. The hand-rolled version everybody writes lowercases, hyphenates, and stops.</p><p>rollout--rollback has <strong>two</strong> hyphens, because the slash is deleted and both spaces around it survive. Nobody writes that anchor by hand, which is exactly why the naive checker calls the correct one broken.</p><p>Over the corpus’s <strong>27 anchor references the two conventions disagree on 11–40.7%</strong> — and in both directions: 6 that only the GitHub rule accepts, 5 that only the naive rule accepts. Neither is a superset of the other, so neither is the safe default.</p><p>The verdict on four in ten anchors is a property of the slugger you picked, not of the notes.</p><h3>One line of whitespace handling moves a third of the quote verdicts</h3><p>A fenced block can declare where it came from, and that declaration is the thing being checked:</p><p>Of <strong>14 quoted blocks, 7 differ from their source byte for byte. 2 of those 7–28.6% — are character-identical once whitespace is normalised</strong>: re-indented when they were pasted, or carrying a trailing space. Same notes, same sources, one flag.</p><p>stale defaults to exact, because indentation is semantic in the language most of these blocks are written in. But it prints resolved-after-normalising rather than resolved, so you can see which of the two answers you are reading.</p><h3>The number that decides whether anyone reads the report</h3><p>45 findings sounds like a working detector right up until you look at where they land.</p><p><strong>They land in 22 of 30 notes — 73%.</strong> And across all eight combinations of the three flags, the base rate never drops below <strong>60%</strong>:</p><p>Loosening every flag at once removes 11 findings and still leaves 60% of the pile flagged. A tool that flags three quarters of your notes has not triaged anything — it has handed you the folder back.</p><p>The flags are not the lever. The findings are <strong>not independent</strong>.</p><p>One file that got renamed shows up once per note that linked to it. Collapse the findings onto the thing you would actually repair and <strong>45 findings become 25 fixes, with the top four clearing 18 of them</strong>:</p><pre>6 target-missing: notes/setup-guide.md 5 target-missing: notes/index.md 4 target-missing: notes/old-glossary.md 3 case-only-match: notes/2026/Handoff-2025.md</pre><p>Nothing about the detector changed. Only what it counted. That is the difference between a list of symptoms and a list of jobs, and it is the only honest answer a sensitive detector has to its own base rate.</p><h3>How it is checked</h3><p>The page ships a JS port of the Python package. The day’s verifier lifts that port <strong>straight out of the HTML</strong> — the bytes the browser runs — evaluates it in Node, runs the Python package as a subprocess, and compares them on 76 trees: the real corpus under all eight flag settings, 60 generated ones, and the edge cases.</p><p><strong>1,933 references compared — verdict, reason, and evidence string, 9,162 assertions, 0 failures.</strong> Plus 84 pytest cases and a 36-check panel in the page itself.</p><p>A port that is only checked against itself is not checked. The failure worth guarding against is the one that does not look like a failure: both halves run, both produce a report, and the reports differ.</p><h3>Offline, standard library, no model</h3><p>No key, no network, no LLM. Python 3.8+, dependencies = [].</p><p>MIT. Part of Agent Lab Vol 5 — <em>reading the pile you already have</em>.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/the-same-link-is-fine-on-windows-and-broken-in-ci-9-of-95-in-one-note-folder-4g38"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc7eb8d69036" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TTFT and TPOT: The Latency Number You Report Hides the One Users Feel]]></title>
            <link>https://dev48v.medium.com/ttft-and-tpot-the-latency-number-you-report-hides-the-one-users-feel-a9fc1bea584a?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9fc1bea584a</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:58:10 GMT</pubDate>
            <atom:updated>2026-11-09T17:04:14.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dGEkLCZxl7nmXOQ7.png" /></figure><p>Push a simulated serving queue from 0.2 to 3.0 requests a second and mean end-to-end latency gets <strong>17x</strong> worse.</p><p>Over the same range, the 99th percentile time to first token gets <strong>762x</strong> worse — <strong>206 ms</strong> to <strong>157 s</strong>.</p><p>Both numbers describe the same 300 requests. Only one of them describes the empty box a user is staring at.</p><p>👉 <strong>Live, with sliders for arrival rate, prompt length and batch size:</strong> <a href="https://dev48.in/ai/days/day83-ttft-vs-tpot.html">https://dev48.in/ai/days/day83-ttft-vs-tpot.html</a></p><h3>The workload is simulated and seeded</h3><p>There is no GPU here and no model. There is a discrete-event simulation with a fixed seed ( mulberry32, seed 20261109): 300 requests, exponential inter-arrival times, log-normal prompt lengths (median 512 tokens) and output lengths (median 180 tokens), a FIFO queue, and a batch.</p><p>The cost model is two lines:</p><pre>prefill(group) = 8 ms + 0.08 ms x (total prompt tokens) decode step = 18 ms + 1.2 ms x (sequences in the batch)</pre><p>None of these figures are measurements of any real serving stack, and none of them are claims about one. They are the arithmetic of serving, which is the part that survives a change of hardware. Everything below comes out of that loop, and a Node verifier re-derives all of it from an independent token-by-token replay.</p><h3>Two clocks, glued by an identity</h3><p>Time to first token is the silence: queueing plus prefill, before anything appears. Time per output token is the cadence after it. They compose exactly:</p><pre>e2e = TTFT + TPOT x (output tokens - 1)</pre><p>Not approximately. Across all 300 requests the worst disagreement is <strong>3.64e-12 ms</strong>. The minus one is there because the first token is already paid for inside TTFT.</p><p>That identity is why a single total is useless for diagnosis. A slow total is a long silence, a slow cadence, or a long answer — three different causes with three different fixes, and the total cannot tell you which. In the default run the request with the worst TTFT and the request with the worst end-to-end are <strong>not the same request</strong>.</p><h3>The queue lands almost entirely on the silence</h3><p>TTFT p99 moves <strong>762x</strong>. TPOT p50 moves <strong>1.44x</strong>. Mean end-to-end — the column most dashboards actually plot — moves <strong>17x</strong>, because it is dominated by how many tokens the answers had, which is a property of the questions and not of the server.</p><p>A deploy that moved the first column from 55 ms to 76 seconds would show up on a mean-latency chart as a moderate regression.</p><h3>TPOT is batch size, and it is exactly batch size</h3><p>A decode step reads the weights out of memory once and uses them for every sequence in the batch. Fill the batch and time it:</p><p>The same number, divided two ways. Per token the fixed cost falls towards 1.2 ms; per <strong>sequence</strong> it only ever rises. The server gets 9.4x faster and every individual stream gets 4.9x slower, and only one of those is on a capacity dashboard.</p><p>Prompt length does not appear in the step expression at all. Measured in the clean room, TPOT across a 64x range of prompt lengths at four batch sizes has a total spread of <strong>8.38e-13 ms</strong> — floating-point noise, nothing else.</p><h3>Except that it leaks, and the leak is scheduling</h3><p>Put the same server under load and prompt length suddenly does move TPOT. Batch 16, 1.4 req/s. The control column prices prefill at zero and changes nothing else — same arrivals, same batch, same decoding:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*olSiPVxq7abwi92i.png" /></figure><p>median promptTPOT, prefill freeTPOT, prefill pricedserver time in prefill</p><p>The control column is identical to the last digit, because with prefill free the prompt does not exist. The priced column doubles. Nothing about decoding changed — somebody else’s 4,000-token prefill is holding the accelerator while your sequence waits for its next token. This is the effect chunked prefill exists to spread out, and it is why a TPOT regression can be caused by a change nobody made to decoding.</p><h3>The assertion that failed</h3><p>I expected the classic trade: make the scheduler wait to accumulate a full batch before prefilling, fuse the prefills, buy throughput, pay in TTFT. Half of it showed up.</p><p>2,048-token prompts, 0.8 req/s, batch 16:</p><p>The fusing worked exactly as advertised: prefill’s share of server time falls monotonically. Throughput moves <strong>−0.22%</strong>. This server is decode-bound, so the time the optimisation freed was never the bottleneck.</p><p>TTFT p50 went up <strong>5.1x</strong> anyway. The optimisation succeeded and only the bill arrived — charged to users, in a column the throughput dashboard does not have.</p><h3>A percentile over requests is not a percentile over tokens</h3><p>p99 TPOT usually means: average each request’s cadence, take the percentile over requests. That gives a two-token reply exactly as many votes as a two-thousand-token one. Weight by tokens emitted instead and the number moves — at 1.4 req/s, <strong>32.12 ms</strong> per request against <strong>31.27 ms</strong> per token.</p><p>Neither is wrong. They answer different questions, and a dashboard that does not say which one it is answering is not reporting anything.</p><h3>Budget the two separately, because one SLO cannot hold both</h3><p>Take a budget of <strong>TTFT p90 ≤ 1 s</strong> and <strong>TPOT p90 ≤ 60 ms</strong>, and sweep batch size at 2.0 req/s:</p><p>Small batches blow the TTFT ceiling on queueing. Large ones blow the TPOT ceiling on step time. <strong>No batch size satisfies both.</strong> That is not a tuning problem, it is a capacity verdict — and the split metrics are the only thing that can state it, because the same budget at 0.8 req/s and batch 16 is met comfortably (TTFT p90 <strong>129 ms</strong>, TPOT p90 <strong>30.9 ms</strong>).</p><p>An end-to-end budget would have been satisfied or violated by a change in answer length that nobody deployed.</p><h3>One bug worth keeping</h3><p>The batch-wait scheduler advances the clock to head.arrival + batchWindow, then tests whether the window has expired. That sum rounds a hair low in a double - 299.9999999999999 for a 300 ms window - so the test says no, the clock is advanced to the same instant again, and the loop spins forever on one timestamp. Fourteen window values hung before the comparison got an epsilon. The page now asserts that all 28 window-and-batch combinations terminate and serve all 300 requests.</p><h3>What is checked</h3><p>The page runs <strong>47 assertions</strong> in your browser, including the nearest-rank percentile against a hand-checked array, a fixed seed reproducing a run string-identically, the end-to-end identity to 1e-9 for every request, TTFT monotone in arrival rate, and TPOT invariant to prompt length in isolation and demonstrably not invariant under load.</p><p>A Node verifier lifts the same engine out of the HTML and adds <strong>177</strong> more, including an independent replay that records a timestamp for every one of ~70,000 tokens and re-derives TTFT, TPOT and end-to-end from that log rather than from the three scalars the page keeps. Both at zero failures.</p><p>Report TTFT and TPOT separately, at p90 or p99, and say which output length you assumed when you turned them into a total. Then when the total moves, the identity tells you which of the three terms moved.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/ttft-and-tpot-the-latency-number-you-report-hides-the-one-users-feel-31ff"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9fc1bea584a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prefix tuning changes no weights: 128 numbers steering a frozen model]]></title>
            <link>https://dev48v.medium.com/prefix-tuning-changes-no-weights-128-numbers-steering-a-frozen-model-7f954ade22d1?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f954ade22d1</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:57:44 GMT</pubDate>
            <atom:updated>2026-11-09T17:03:31.334Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n_6EqYDnr6oB5CTj.png" /></figure><p>LoRA computes W_eff = W + BA. It changes a weight matrix by a low-rank delta, and at serve time you can add the delta in and forget it was ever separate.</p><p>Prefix tuning never forms a delta. It leaves every weight bit-for-bit where it was and prepends P learned key rows and P learned value rows to the attention of <strong>every</strong> layer. Two concat lines, and the softmax does the rest.</p><p>That difference is the whole subject, and it is easy to lose in the phrase “parameter-efficient fine-tuning”, which gets applied to both.</p><p>👉 <strong>Live, with the training run executing in your browser:</strong> <a href="https://dev48.in/dl/day83-prefix-tuning.html">https://dev48.in/dl/day83-prefix-tuning.html</a></p><h3>🔴 The model is a toy and the numbers are a property of it</h3><p>The page builds a miniature decoder from a fixed seed: d = 8, 2 attention layers, 6 tokens per sequence, a 12-token vocabulary, 2 classes. <strong>624 numbers in total.</strong> Re-running reproduces it exactly.</p><p>What that costs: every point estimate below is a property of <em>this</em> model, and would move on a real one. What transfers is the shape — where the gradient stops, what the parameter count is a function of, and what happens when the prefix is left to grow unbounded.</p><h3>The whole method</h3><p>No W is read differently. No W is written. Every query now scores against P + T candidates instead of T, and a softmax that must sum to one has no choice but to spend some of its mass on the new rows.</p><p>That is the leverage. The prefix does not add a term to the output — it <strong>takes mass away</strong> from the real tokens and redirects it to vectors you control.</p><p>You cannot prepend to q. A query belongs to a token, and you are not adding tokens. That asymmetry is why this is key/value prefixing and not &quot;prompt tuning&quot;.</p><h3>Where the gradient stops</h3><p>After the softmax derivative you hold a gradient for all P + T key rows and all P + T value rows.</p><p>The first P of each were not computed from anything. They <em>are</em> the parameters, so their gradient is the answer and the chain ends there. The remaining T came out of W_k and W_v, so their gradient keeps travelling - back through those matrices, into x, and down to the layer below, because layer 0&#39;s prefix is only reachable through layer 1&#39;s attention.</p><p>dWq, dWk, dWv, dWo are never formed. Not computed and then zeroed - the lines that would build them are absent, and the page checks its own backward source for that.</p><p>Backprop is written out by hand, and every coordinate is checked against a central finite difference of the loss, which knows nothing about the derivation. <strong>All 64 coordinates of a P = 2 prefix agree to better than 1e-5 relative.</strong></p><h3>It trains, and the base comes back untouched</h3><p>The task is built so the frozen model cannot already do it: one signal token hidden among filler, label = which signal. The base sits at <strong>0.6941</strong> against a chance value of ln(2) = 0.6931, and gets <strong>62.5%</strong> right.</p><p>200 steps of SGD with momentum, moving <strong>128 numbers</strong>:</p><p>The last row is the claim of the method stated as a hash. All 624 frozen numbers are fingerprinted before the loop and again afterwards, compared element by element, and the base object is handed to Object.freeze recursively first - so an accidental write could not land even if a line tried.</p><p>And the control that makes the rest mean something: with P = 0 the prefix-aware forward pass returns <strong>bit-identical</strong> logits to a forward pass written without any prefix code at all, compared with Object.is. With P = 0, 80 steps at a learning rate of 5 leave the loss exactly where it started.</p><h3>Longer is not better</h3><p>Every extra slot is more capacity <em>and</em> more attention mass stolen from the input. The same loop, the same seed, at each P:</p><p>A <strong>single slot</strong> — 32 numbers — already solves it, just slower. The curve bottoms out at P = 4 and then turns around: by P = 16 the loss is worse than at P = 4, while <strong>0.839</strong> of the attention mass is going to the prefix. The model is spending most of its softmax on vectors instead of on its own input.</p><h3>What the reparameterisation trick is actually for</h3><p>Li &amp; Liang reported that optimising the table directly was unstable and generated it from a small embedding through an MLP instead, discarding the MLP afterwards. On this page the generator’s output layer is bounded, so |prefix| ≤ 45.255 is arithmetic rather than a hope.</p><p>Running both parameterisations at the same seed across a learning-rate sweep:</p><p>The column that matters is not the loss, it is the norm. The direct prefix is free coordinates and nothing bounds them: at lr = 100 the run ends at <strong>2.5643</strong>, above the chance value of 0.6931, with <strong>1.000</strong> of the attention mass on the prefix. That last number is the mechanism of the failure - one prefix key grows until it wins the softmax outright, the real tokens get nothing, and the model is no longer reading its input.</p><p>Be honest about the other half. Bounding does not make it better everywhere: at lr = 0.6 the reparameterised run reaches 0.00020 against the direct run&#39;s 0.00337, but high up the sweep it stops learning rather than exploding. It trades a blow-up for a ceiling.</p><p>There is also a parameter count that gets quoted two ways. With the generator you <strong>train 640</strong> numbers and <strong>ship 128</strong>, because the MLP is run once at the end and thrown away. Without it you train and ship the same 128.</p><h3>Why the ratio gets better as the model gets bigger</h3><p>A prefix costs 2 × L × P × d. The vocabulary is not in that formula, and neither is the feed-forward width - which is where most of a transformer&#39;s parameters actually live.</p><p>The toy row is the honest one to be suspicious of — 20.5% of a 624-number model is not a headline. The share falls to <strong>0.0324%</strong> by the bottom row because the prefix grows with L × d while the model grows with L × d².</p><h3>The trade, stated plainly</h3><p>Read the last three rows together, because they are the whole trade. LoRA’s delta disappears into the weights at serve time and costs nothing afterwards — but you can only have one folded in. A prefix never disappears: it occupies P slots of every attention, in every layer, for every token, forever. What you buy with that is the last row - two requests in the same batch can carry two different prefixes, because the prefix is data, not weights.</p><h3>And it is not a prompt</h3><p>A four-token prompt over this vocabulary has <strong>20,736</strong> possible settings and you would have to try them. The soft version is continuous, differentiable, and — decisively — injected into every layer rather than only the first.</p><p>The page carries 38 in-browser assertions covering all of this: the frozen weights, the gradient check, the P = 0 identity, the bound, and the divergence. All 38 pass, with the engine on the page being the same one every table above was computed by.</p><p><a href="https://dev48.in/dl/day83-prefix-tuning.html">https://dev48.in/dl/day83-prefix-tuning.html</a></p><p><em>Originally published at </em><a href="https://dev.to/dev48v/prefix-tuning-changes-no-weights-128-numbers-steering-a-frozen-model-3fci"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f954ade22d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RFC 6570 URI Templates: the `?` That Must Not Appear, and the Name That Must Repeat]]></title>
            <link>https://dev48v.medium.com/rfc-6570-uri-templates-the-that-must-not-appear-and-the-name-that-must-repeat-39fc784e49da?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/39fc784e49da</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:56:39 GMT</pubDate>
            <atom:updated>2026-11-09T17:02:06.619Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8U-HlyqTuUITe4Ng.png" /></figure><p>/users/{id}/repos{?page,per_page}. It looks like string formatting with a nicer syntax. It is a 40-page RFC because every one of the decisions you make by hand when you concatenate a URL has a wrong answer that ships.</p><p>I implemented all four levels <strong>from the grammar and the §3.2.1 expansion algorithm</strong>, not from a library: eight operators, both modifiers, strings, lists and associative arrays, with a per-character trace of which rule produced each run of output.</p><p>👉 <strong>Live, expanding in your browser:</strong> <a href="https://dev48.in/solve/day83-uri-template.html">https://dev48.in/solve/day83-uri-template.html</a></p><p>Every figure below is a count from the verifier or the in-page checks.</p><h3>The whole specification is five columns</h3><p>There is no branch anywhere in the engine on the operator character. There is one table.</p><p>Three of the eight are named. Two of the eight allow reserved characters. One column separates {var} from {+var}, and that column is the one people get wrong.</p><h3>The prefix is emitted once, and only if something survived</h3><p>This is the rule the spec exists for. The ? is not written when the expression is parsed - it is written when the first <em>defined</em> variable is about to be.</p><p>No dangling ?, no &amp;&amp;, no leading &amp;. There is nowhere to get it wrong because the flag lives in the loop.</p><p>And undefined is not the same as empty. An absent key and null are skipped entirely; an empty <strong>list</strong> and an empty <strong>map</strong> are also skipped, because there is nothing to join; an empty <strong>string</strong> is a value and keeps its name. A list holding one empty string has length 1, so it is defined:</p><p>Three operators, three different right answers for the same value, all from the ifemp column.</p><h3>{+var} is not &quot;the same but shorter&quot;</h3><p>Of the 128 ASCII code points, the default allow-set percent-encodes <strong>62</strong>. The reserved allow-set encodes <strong>44</strong>. The 18 characters in the gap are the URI structural punctuation : / ? # [ ] @ ! $ &amp; &#39; ( ) * + , ; =.</p><p>The ! is a sub-delim. It is data under {var} and punctuation under {+var}.</p><p>The consequence that actually bites is idempotence. + copies an existing %XX triplet through untouched; the default re-encodes the %:</p><p>That is the right way round. The default’s job is to make a value opaque, and running an opaque value through again should not be a no-op.</p><h3>The star is not “spread”. It is “use my separator.”</h3><p>Without *, a composite value is joined with <strong>commas</strong>, whatever operator you used. With *, the operator&#39;s own separator takes over.</p><p>Read the bottom three rows twice. <strong>A named operator with an exploded list repeats the variable name.</strong> The tempting reading of * is &quot;drop the name and spread the values&quot;, which gives ?red&amp;green&amp;blue - three parameters named red, green and blue, with no values. It is not a list at all.</p><p>The five unnamed operators expand identically whether you get this right or wrong. A test suite built on {/list*} will never catch it.</p><h3>An unexploded map loses the pairing entirely</h3><p>{keys} is six comma-separated items, not three pairs. Nothing in the output says which is which. And {+keys} is the same map under the reserved allow-set, where the comma value is a literal comma - the output has a run of three commas and is ambiguous by design.</p><h3>:3 counts characters of the decoded value</h3><p>Truncation happens <strong>before</strong> encoding, and it counts code points, not bytes and not output characters.</p><p>Counting the modifier against the output would cut a %2F triplet in half. Counting bytes would cut a 4-byte emoji in half - {e:2} over three 😀 gives exactly %F0%9F%98%80%F0%9F%98%80.</p><p>A prefix modifier on a list or a map is <strong>illegal</strong>, not “truncate each member”. The engine throws on all four forms tested.</p><h3>How it is checked</h3><p>The verifier never reads the page’s test data. It carries its own copy of every expansion printed in RFC 6570, and a <strong>second expander</strong> written from the §3.2.1 pseudocode in a deliberately different shape — regex scan, no trace, encoding via Node’s Buffer instead of the page&#39;s hand-written UTF-8.</p><ul><li><strong>120</strong> RFC example expansions, byte for byte: 120/120</li><li><strong>232</strong> combinations in an operator × modifier × value-shape sweep, both implementations: 232/232 identical</li><li><strong>128</strong> ASCII code points, both allow-sets</li><li><strong>695</strong> trace segments across the 120 vectors, every one reassembling into its expansion and carrying a rule</li><li><strong>63</strong> verifier asserts, <strong>0</strong> failures</li><li><strong>55</strong> in-page checks, <strong>0</strong> failures</li></ul><p>The page itself holds <strong>115</strong> section vectors plus <strong>66</strong> Appendix A level vectors and runs them on load, so the badge is measuring the same engine the tool uses.</p><h3>The one thing worth taking away</h3><p>If you are building a query string by concatenation, the bug is not the escaping. The bug is that you decided what ? means before you knew whether any parameter was defined.</p><p>Day 83 of SolveFromZero. Tomorrow: the reverse direction, and why matching a URI back to a template is not the same problem.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/rfc-6570-uri-templates-the-that-must-not-appear-and-the-name-that-must-repeat-19im"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39fc784e49da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Top-Rated Shop Has One Rating: Partial Pooling Cuts Total Error 5.30x]]></title>
            <link>https://dev48v.medium.com/your-top-rated-shop-has-one-rating-partial-pooling-cuts-total-error-5-30x-b30c5dd094cc?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b30c5dd094cc</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:56:36 GMT</pubDate>
            <atom:updated>2026-11-09T17:02:46.514Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wbwGYqz5dMzHBssS.png" /></figure><p>Forty shops. One has 860 ratings. Five have exactly one.</p><p>Shop #0 has a single rating, and that rating says <strong>80.43</strong>. It sits at the top of the leaderboard. Its true quality is <strong>57.61</strong> — above average, but nowhere near the top of anything.</p><p>Partial pooling estimates it at <strong>53.12</strong>, and across all forty shops it cuts total squared error from <strong>1763.35</strong> to <strong>332.54</strong>.</p><p>👉 <strong>Live, with the shrinkage weight recomputed as you drag the sample size:</strong> <a href="https://dev48.in/ml/day83-partial-pooling.html">https://dev48.in/ml/day83-partial-pooling.html</a></p><h3>The data is synthetic and seeded</h3><p>Every number here comes from a seeded generator: 40 groups, sizes 1, 1, 1, 1, 1, 2, ... 688, 860 for <strong>4,345 observations</strong>, true group means drawn from Normal(50, 4²) and observations from Normal(θ_g, 12²). That is the entire point of synthesising it - the <strong>true</strong> group means are known exactly, so every estimator is scored against the truth rather than against another estimate. Nothing on the page is fitted to real shop data and none of these figures are claims about real shops.</p><h3>Three estimators, scored against truth</h3><p>5.30x better than trusting every group, 2.39x better than trusting none of them. Nothing told it which groups were small.</p><h3>The weight is a ratio of two variances, not a tuning knob</h3><pre>lambda_g = tau^2 / (tau^2 + sigma^2 / n_g) estimate = lambda_g * ybar_g + (1 - lambda_g) * mu</pre><p>sigma²/n is how much of a group&#39;s average is sampling noise. tau² is how much real spread there is between groups. lambda is the share of what the group said that is signal. It is bounded in [0,1] by construction, because it is a ratio whose denominator contains its numerator.</p><p>Complete pooling is this method at lambda = 0. No pooling is this method at lambda = 1. They are not rivals of it, they are its two endpoints - and notice there is no threshold anywhere. No group is ever dropped for being &quot;too small&quot;; it is continuously discounted in proportion to how much of its number is noise.</p><h3>Both variances have to be estimated, and one of them is hard</h3><p>sigma² is easy: pool the within-group deviations over N − G = 4345 − 40 = 4305 degrees of freedom. The one-rating shops contribute nothing to it, which is correct - a single point has no spread.</p><p>tau² is the hard one, because you never see the true means. The naive answer, the spread of the 40 observed group averages, is <strong>83.658</strong> against a truth of <strong>16</strong> - a <strong>5.23x</strong> overstatement, because the one-rating shops are scattered by ±12 points of pure noise. Use that and lambda goes to nearly 1 and you shrink nothing.</p><p>The moment identity fixes it. The precision-weighted scatter Q of the group averages has expectation G − 1 = 39 if the groups are truly identical, so the excess is real spread:</p><p>Over 300 seeded worlds the estimates average <strong>144.069</strong> and <strong>16.124</strong> against truths of 144 and 16, and τ̂² was clamped to zero in 0 of the 300. The clamp is not decoration - a sample can genuinely look <em>tighter</em> than chance predicts, and the honest answer there is τ̂² = 0, which collapses the whole method to complete pooling.</p><h3>One group, sample size varied, truth held fixed</h3><p>The true score of shop #0 is 57.61 in every row — the true means come from their own seeded stream, so changing the sample size cannot disturb them. Only the evidence changes.</p><h3>It is not a hack — it is the estimator with lower expected error</h3><p>Over 300 independently seeded worlds:</p><p>Partial pooling beat both at once in <strong>300 of 300</strong>. Its <em>worst</em> world (507.22) is better than no pooling’s <em>best</em> one (337.75).</p><p>That is the James-Stein result in applied form. For a normal mean in three or more dimensions, using each group’s own average — unbiased, maximum likelihood, the obvious thing — is <strong>inadmissible</strong>: a shrunken estimator has lower expected total squared error for <em>every</em> possible set of true means. On 30 groups of 5, the classical James-Stein estimator scores <strong>350.76</strong> against the MLE’s <strong>806.59</strong>, a 2.30x improvement, winning <strong>58 of 60</strong> seeded worlds. Not 60 of 60 — inadmissibility is a statement about the expectation, and a page claiming otherwise would be lying to you.</p><h3>Error moved out of variance and into bias, deliberately</h3><p>Hold the forty true means fixed and redraw only the observations, 400 times. Now “bias” means something.</p><p>The one-rating group’s no-pooling estimate is almost perfectly <strong>unbiased</strong> and almost perfectly <strong>useless</strong> — its error is essentially all variance. Partial pooling takes on a real, systematic, never-averaging-away pull of −7.03 toward the middle, and the variance collapses by 134x. Total error falls 2.84x. The 860-rating group is left alone.</p><p>Being unbiased was never the objective. Being close was.</p><h3>The leaderboard lesson, measured</h3><p>Pick the single top shop, 200 seeded worlds:</p><p>Twelve of the forty groups have three ratings or fewer. The raw top five holds on average 2.87 of them — not because small groups are good, but because small groups have the widest distribution of outcomes and a maximum picks from the tails.</p><h3>What this costs</h3><p><strong>14 of 40 individual groups come out worse.</strong> Shop #11 has 3 ratings and a raw error of 0.157; partial pooling moves it to 4.052. The method optimises the sum, and individual groups pay for it.</p><p>So if your decision is about one named group — a safety alert, a fraud case, a single hospital’s mortality rate — the shrunken number is the wrong one to argue from. And the pooling assumption has to hold: it says the groups are exchangeable draws from one population, and shrinking toward a mean that no group belongs to makes things worse, not better.</p><h3>What this does not cover</h3><p>One normal-normal model with a scalar outcome, no predictors, no crossed or nested levels, and no full Bayes — tau² is a point estimate here and the uncertainty in it is never propagated. Group sizes vary but the within-group variance is assumed common across groups. Outcomes are Gaussian, so nothing here is a binomial or count hierarchy.</p><p><strong>37 in-page assertions, 56 verifier assertions, 0 failures.</strong> The verifier shares none of the page’s machinery: a different generator, and the shrinkage weight recovered three other ways — trapezoid quadrature over the Bayes posterior, a golden-section minimiser on the penalised least-squares objective, and a grid search over λ against empirical mean squared error on 300,000 draws.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/your-top-rated-shop-has-one-rating-partial-pooling-cuts-total-error-530x-40i0"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b30c5dd094cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five Prompts Beat Five Samples: 21/24 vs 15/24 on the Identical Five-Call Bill]]></title>
            <link>https://dev48v.medium.com/five-prompts-beat-five-samples-21-24-vs-15-24-on-the-identical-five-call-bill-68c1cde602b0?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/68c1cde602b0</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:55:27 GMT</pubDate>
            <atom:updated>2026-11-09T17:01:27.014Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ctDjfRBUWRKzAgVy.png" /></figure><p>Two methods, same model, same 24 questions, same budget of five calls per question.</p><p>Self-consistency — one prompt, five samples at temperature 0.3, majority vote — scores <strong>15/24</strong>.</p><p>An ensemble of five <em>different</em> prompts, plurality vote, scores <strong>21/24</strong>. The best single prompt on its own scores <strong>17/24</strong>.</p><p>👉 <strong>Live, with the correlation dial and every aggregation rule on sliders:</strong> <a href="https://dev48.in/prompt/day83-prompt-ensembling.html">https://dev48.in/prompt/day83-prompt-ensembling.html</a></p><h3>These are not the same technique</h3><p>Self-consistency varies <strong>the sampler’s dice</strong>. Every one of the k samples read identical words, so the vote cancels sampling noise and nothing else.</p><p>Prompt ensembling varies <strong>the prompt</strong>: a different phrasing, a different output format, the options listed in a different order. The members can disagree for a reason, and a vote only buys you something when the voters can disagree for a reason.</p><p>The ceiling makes the difference concrete. Push self-consistency to k = 301 and it lands on <strong>17/24</strong> — and not approximately. At k = 301 it reproduces that one prompt’s own greedy pick on <strong>24 of 24</strong> questions. The plurality over samples converges to the prompt’s most likely answer, so the prompt <em>is</em> the ceiling. k buys stability, never a second point of view.</p><h3>The engine simulates nothing about language</h3><p>24 arithmetic questions are DATA. Each has four options: the true value, an off-by-one, a digit swap, and a rounded figure. The in-page self-check re-evaluates 17 × 24 and the other 23 rather than trusting the stored answer.</p><p>A “prompt variant” is a scoring profile over those four options — how strongly it is drawn to the truth, to each of the three traps, and to whatever is listed first. Each question is tempting for one particular trap. A member goes wrong where its weakness meets a matching question, which is what makes two variants fail on <em>different</em> questions rather than the same ones.</p><p>Noise is a <strong>hash</strong> of (seed, member, question, option), not a stream. Reordering the member array therefore cannot change what any member answers, and the verifier proves it across all <strong>120</strong> permutations of five members on all 24 questions.</p><p>Mean pairwise error correlation across those five: <strong>−0.144</strong>.</p><h3>The finding: an ensemble only pays when the errors are uncorrelated</h3><p>Same machinery, same five members, same 24 questions, same seed, same 5× cost. One dial: blend each member’s profile toward the first member’s, so the set slides from five genuinely different prompts to five rewordings of one.</p><p>The gain does not merely shrink. It crosses zero and goes negative. Cost does not move.</p><p>The question to measure before shipping an ensemble is not “are my prompts different?” It is “do my prompts fail on different questions?”</p><h3>A majority of biased members is confidently wrong</h3><p>That last column is the part that should worry you.</p><p>A diverse ensemble that is wrong is wrong about 3-to-2 and looks shaky. A correlated ensemble that is wrong is wrong 5-to-0 and looks certain. The correlated set is less accurate <strong>and</strong> more convincing about it — so a gate that routes high-agreement answers past review fails in exactly the same direction the ensemble does.</p><p>And the bottom row is the limit case. Five identical calls at temperature zero return the single prompt’s own sheet under <strong>12 of 12</strong> rule × tie-break combinations, for 5× the bill. If your “variants” are politeness edits, that row is what you bought.</p><h3>The tie-break nobody writes down is order-dependent</h3><p>Five members over four options tie more often than people expect. Somebody has to decide, and in most code nobody decided: a loop that keeps a running maximum returns whichever tied option the <em>first</em> member voted for.</p><p>Over all 120 permutations of the five members, that default returns different answers on <strong>2 of 24</strong> questions. Listing the same five members in reverse takes the sheet from <strong>21/24 to 20/24</strong>. Nothing about the model, the prompts or the seed changed — only the order of an array.</p><p>Breaking ties on a property of the <em>options</em> instead (lowest listed position, summed confidence, Borda score) is invariant across all 120 orderings. It costs nothing.</p><h3>k is not a slider you push right</h3><p>Accuracy goes 17 → 18 → 20 → <strong>18</strong> → 21. Adding a member is not a safe move; a weak member’s votes land somewhere. And an even k sends half your sheet to the tie-break: k = 2 decides 12 of 24 questions by policy rather than by vote.</p><p>If you ensemble, use an odd k.</p><h3>And no aggregation rule wins everywhere</h3><p>Same engine, seven seeds:</p><p>Plurality beats confidence-weighted on three seeds and loses on three. One run does not establish an ordering between them.</p><p>Borda is at least as good as both on <strong>7 of 7</strong>, which is the strongest claim this page will make for any rule — and it is the only rule with a cost that is not in the call count. Borda needs every member to rank all the options, which is more output tokens per call, and a member that will not rank reliably cannot be in a Borda ensemble at all. It is also the only rule that can elect an option <strong>nobody</strong> put first: five members whose first choices are 0, 0, 1, 1, 3 elect option 2, the universal second choice, with zero first-place votes. A plurality vote cannot see it.</p><h3>What to actually do</h3><ol><li>Write variants that <strong>fail differently</strong>, not variants that <strong>read differently</strong>. Change the format, the option order, the reasoning demanded. Politeness edits produce the 5-identical-calls row.</li><li>Fan out in parallel, or the latency is k times too.</li><li>Pick an aggregation rule on purpose, and write the tie-break down.</li><li>Measure, on a held-out set, before shipping: every single variant’s accuracy, the pairwise error correlation, the agreement on the <strong>wrong</strong> answers, and accuracy at k = 1, 3, 5.</li></ol><p>If the ensemble is not beating your best single variant, or the correlation is high, ship k = 1 and keep the money. k prompts cost k times as much for a gain you have to measure rather than assume.</p><p><strong>186 verifier asserts over 120 member permutations, 42 in-page checks, 0 failures.</strong> Vanilla JS, one file, no build step, no network.</p><p>👉 <a href="https://dev48.in/prompt/day83-prompt-ensembling.html">https://dev48.in/prompt/day83-prompt-ensembling.html</a></p><p><em>Originally published at </em><a href="https://dev.to/dev48v/five-prompts-beat-five-samples-2124-vs-1524-on-the-identical-five-call-bill-12pl"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68c1cde602b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Cursor Jumps 28 Pixels or Glides 4: Same Packets, One Delayed Clock]]></title>
            <link>https://dev48v.medium.com/the-cursor-jumps-28-pixels-or-glides-4-same-packets-one-delayed-clock-c2399bd39dd9?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2399bd39dd9</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:55:01 GMT</pubDate>
            <atom:updated>2026-11-09T17:00:48.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qKRRu_0Tbu03ll75.png" /></figure><p>A multiplayer cursor looks like a drawing problem. It is a timing problem.</p><p>Everyone else in the file is a stream of sparse positions that arrive late, out of order, and sometimes not at all. The screen redraws about sixty times a second. The positions do not. Almost every frame you paint is therefore something you made up, and the whole craft of the feature is in how you make it up.</p><p>👉 <strong>Live, with every table computed in your browser by the same engine:</strong> <a href="https://dev48.in/design/day83-presence-cursors.html">https://dev48.in/design/day83-presence-cursors.html</a></p><h3>🔴 The wire is simulated</h3><p>There is no socket here. A seeded transport models a <strong>90 ms latency floor, 100 ms of uniform jitter and a 12% drop rate</strong>, and the clock is an explicit fixed 16 ms step, so the replay is a pure function of (seed, settings) and reproduces byte for byte. The digest over every rendered position of every frame is 31da09e9 on every machine.</p><p>What that costs: the point estimates below are properties of this draw. What transfers is the shape — that jitter wider than the send interval reorders packets at all, that a leading-edge throttle strands the last sample — follows from how clocks and queues work, not from the seed.</p><p><strong>240 frames, 3824 ms, 4 peers, 240 packets sent, 202 delivered, 34 dropped.</strong></p><h3>Teleporting versus gliding, from identical packets</h3><p>Assign the newest packet straight to the element and the cursor sits still, then hops. Interpolate between the last two samples and it never stops moving.</p><p>Same replay, same 202 delivered packets. The only difference is whether the frames <em>between</em> two packets are drawn or skipped:</p><p><strong>6.8× smaller</strong>, for free, out of data you already had.</p><p>The eye is very good at spotting things that move in discrete hops, because nothing physical does. A cursor that is smoothly 300 ms behind reads as presence. A cursor that is exactly right in lurches reads as a bug.</p><h3>Why the renderer has to run in the past</h3><p>To interpolate <em>between</em> two samples you need the second one, and it has not arrived yet. So the renderer draws what the world looked like a moment ago.</p><p>Sweeping that one number over the whole replay:</p><p>At zero delay there is nothing in front of the render time, ever, so every frame holds the last known point — which is the hopping you were trying to remove, dressed up as interpolation. The delay has to clear the latency floor <em>plus</em> the jitter <em>plus</em> one send interval before any of this works at all. Below 180 ms, almost none of it does.</p><h3>Throttling is coalescing, not sampling</h3><p>A pointer fires once a frame. Sixty-plus messages a second per person, through a socket that also carries the edits.</p><p>The slot matters more than the interval: push never sends, it overwrites a single pending position, so what finally goes out is where the pointer <em>is</em>, not where it happened to be at a tick boundary.</p><p>63 pointer events on a 16 ms clock, one second:</p><p><strong>63 events become exactly 16 messages.</strong> Nothing visible changes, because the interpolator fills the gaps.</p><h3>The trailing edge is the half everyone forgets</h3><p>A leading-edge throttle fires at once and then ignores everything until the interval is up. Stop the pointer inside that window — which is what happens every single time somebody finishes a gesture and parks on a word — and the final position is sitting in the pending slot when the events stop.</p><p>Nothing ever sends it.</p><p>A pointer moving 0 → 60 → 130 → 190 → 220 and stopping at t=48 ms, with a 50 ms throttle:</p><p>The trailing emission landed at t=60 ms, <strong>12 ms after the pointer stopped</strong>. One timer, and the remote cursor lands where the person actually put it.</p><h3>Jitter reorders, so the receiver distrusts arrival order</h3><p>With a 50 ms throttle the peers send every 64 ms, and the jitter is 100 ms wide. That is enough for two messages to swap places in flight: <strong>103 packets in this replay were scheduled to land before one sent earlier.</strong></p><p>If you append in arrival order, one of those walks the cursor backwards and then forwards again — a visible stutter from a packet that was otherwise harmless. So every message carries the sender’s timestamp and the buffer refuses anything not strictly newer. <strong>14 of 202 delivered samples were rejected; 188 made it into a timeline.</strong></p><p>Dropped packets need no handling beyond that. A gap is just a longer segment to interpolate across, which is why a lossy cursor channel still looks fine — until it doesn’t:</p><h3>🔴 Presence is a timeout, never a leave event</h3><p>The obvious design: send join on open, leave on close, broadcast both.</p><p>Nobody sends leave when the lid shuts, the tunnel drops, or the tab is killed. The ghost cursor still sitting in the document an hour after someone left the meeting is always this bug.</p><p>So a peer exists while packets arrive, and is removed when none has for a while. One peer here goes silent at <strong>t=1200 ms</strong> with no goodbye of any kind, and is evicted at <strong>t=2800 ms</strong> — one 1500 ms timeout after its last packet. The other three never flicker. There is no leave message in the protocol at all; the store throws on any message that is not a cursor.</p><h3>Colour is identity, so it cannot come from a counter</h3><p>Palette plus join counter: first to connect is amber, second is rose. It survives until somebody’s connection blips — they drop, the timeout removes them, they reconnect two seconds later, and now they are a different colour. In this five-person room, one reconnect recolours <strong>four of the five</strong>.</p><p>Worse, eight swatches is not enough to be safe anyway. Five people drawing from eight slots collide <strong>four times out of five</strong>, in the one feature whose entire job is telling people apart.</p><p>So the hue comes off a hash of the stable id — FNV-1a with a murmur3 avalanche, because raw FNV-1a puts u-1 and u-2 in neighbouring buckets. 4000 sequential ids land across all twelve 30° zones of the wheel with no zone above 1.4× its share, and the five peers in the demo sit <strong>at least 49° apart</strong>.</p><h3>Name tags flip per axis</h3><p>The tag hangs down and to the right of the hotspot, which is wrong at every edge. Clipping is the worst option — a half-visible name is unreadable and still takes the space.</p><p>Compute the preferred box, test each axis against the viewport, flip that axis if it does not fit, clamp only when the tag cannot fit on either side. Checked against a search model that enumerates all four corner candidates, at <strong>71,736 anchors including positions outside the viewport: zero escapes, zero disagreements</strong>.</p><h3>What is checked</h3><p>The page’s engine is lifted out of the HTML and run in Node against a reference model written from the rules rather than the code — a brute-force interpolator that scans the whole buffer, a throttle expressed as a predicate over the tick times, a label placer that searches candidates instead of flipping, an independent hash.</p><p><strong>164 verifier asserts. 49 in-page checks. 0 failures.</strong></p><p>The replay is the point. Every number above moved while the settings were being chosen, and none of them moved by accident.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/the-cursor-jumps-28-pixels-or-glides-4-same-packets-one-delayed-clock-2g61"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2399bd39dd9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Nine Men’s Morris Capture Rule Almost Everyone Gets Wrong]]></title>
            <link>https://dev48v.medium.com/the-nine-mens-morris-capture-rule-almost-everyone-gets-wrong-16a2b629975f?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/16a2b629975f</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:53:59 GMT</pubDate>
            <atom:updated>2026-11-09T17:00:09.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BE1QNWWxlsbY4TMz.png" /></figure><p>A piece standing in a mill cannot be taken. Unless every enemy piece is standing in a mill, in which case any of them can.</p><p>That second sentence is the one people skip, and skipping it does not produce a subtle bug. On a position where White owes a removal and all six Black pieces sit inside mills, the take-list goes from <strong>6</strong> to <strong>0</strong>. Zero legal moves means the mover is blocked, and a blocked player loses. So the engine hands the win to the side that was being ground down.</p><p>👉 <strong>Playable, with a selectable-depth alpha-beta opponent:</strong> <a href="https://dev48.in/game/day83-nine-mens-morris.html">https://dev48.in/game/day83-nine-mens-morris.html</a></p><h3>The board is not a grid, and storing it like one costs you the rest of the build</h3><p>Twenty-four points on three nested squares. The corner of a square has <strong>2</strong> neighbours, the midpoint of the outer or inner square has <strong>3</strong>, and the midpoint of the middle square has <strong>4</strong>. Across the board that splits as <strong>12 / 8 / 4</strong> points, degrees summing to <strong>64</strong>, which is twice the <strong>32</strong> edges.</p><p>A 7×7 array can hold that picture, but 25 of its 49 cells are holes and every rule then needs a special case for them.</p><p>So the board is a graph, and the only thing typed by hand is the sixteen lines of three:</p><p>Adjacency is computed from them: each line contributes exactly two pairs, 16 × 2 = 32, and after de-duplication there are still <strong>32</strong>. None of the pairs collide, which is itself a check on the list.</p><p>Every point lies on exactly <strong>2</strong> lines (24 × 2 = 48 = 16 × 3), so a mill test after a move reads two lines instead of sixteen.</p><h3>A mill does not end your turn</h3><p>This is where a first implementation breaks. Closing a mill obliges you to remove an enemy piece, and only then does the opponent move. Model a turn as “one move, then swap sides” and the removal has nowhere to live, so it usually ends up as a prompt outside the engine — at which point the search cannot see captures at all.</p><p>The fix is a flag, and a move generator that answers it first:</p><p>The capture exception is then three lines, a filter with a fallback:</p><p>Measured on two positions that differ by one Black piece: with a loose piece on the board the list is <strong>2</strong> long and the milled pieces are protected. With every Black piece milled it is <strong>6</strong>.</p><h3>Flying is where the branching factor explodes</h3><p>Phase is never stored. It is a question asked at the top of the generator: pieces in hand means placing, exactly three pieces means flying, otherwise slide.</p><p>Three flying pieces times 18 empty points is 54. The search slows down exactly when the position gets sharp.</p><h3>Without draw rules a deterministic engine never stops</h3><p>Two sides that cannot get through each other shuffle forever. Driving a four-ply shuffle (White 0↔1, Black 16↔17) through the engine with history tracked, <strong>threefold repetition fires at ply 9</strong>. The same shuffle with history off runs to the fifty-move limit and is drawn at <strong>exactly ply 100</strong>.</p><p>Both are needed. Repetition catches the shuffle; the fifty-move counter catches a side that keeps finding new positions and no progress. The counter resets on anything irreversible, which here means a capture or a placement.</p><h3>The search has to ask whose turn it is</h3><p>Plain negamax negates each level, which bakes in the assumption that sides alternate. In this game a mill gives the same player another ply, so that assumption scores captures for the wrong side. Asking s.turn === me at every node costs nothing and makes pending removals just another node that happens to maximise again.</p><p>Alpha-beta on top of that, same position, measured both ways:</p><p>Same score and the same chosen move at every depth. Pruning changed the cost, never the answer.</p><p>On a position where White can slide 3→2, close 0–1–2 and take Black from three pieces to two, the depth-3 search finds that single move in <strong>25 nodes</strong> and scores it <strong>999,998</strong> — a win has to outrank every static evaluation, so it is scored as WIN - ply.</p><h3>Twenty-four opening moves are really four</h3><p>The board’s symmetries are four rotations, four reflections, and the swap of the inner and outer rings, which is a symmetry of the graph even though it is not a symmetry of the drawing. The page finds them by searching for every relabelling of the points that preserves adjacency, rather than assuming a list, and gets <strong>16</strong>. They split the points into <strong>4</strong> orbits:</p><p>So the opening tree is four times smaller than it looks.</p><h3>What was actually checked</h3><p>The page runs <strong>38</strong> assertions in the browser against the same engine the game is played with, and the badge reads 38 of 38.</p><p>A separate verifier builds the board a second time from geometry instead of from the list of lines: two points touch when they share a row or column with nothing between them and the segment does not run through the empty centre. That derivation independently produces <strong>32</strong> edges and <strong>16</strong> lines, and both match the page exactly.</p><p>It then re-implements the rules over a board of characters and drives both engines side by side through <strong>12</strong> seeded games, <strong>1,743</strong> plies, comparing the full legal-move set and the resulting position at every single ply. <strong>65</strong> asserts, 0 failures. Endings: 8 by reduction to two pieces, 3 by the fifty-move rule, 1 by repetition.</p><p>The engine playing itself at depth 1 finishes in <strong>45</strong> plies.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/the-nine-mens-morris-capture-rule-almost-everyone-gets-wrong-1f2g"><em>https://dev.to</em></a><em> on November 9, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16a2b629975f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 4-Characters-Per-Token Rule Under-Counts Real Code by 27%]]></title>
            <link>https://dev48v.medium.com/the-4-characters-per-token-rule-under-counts-real-code-by-27-f8d3f4d24923?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8d3f4d24923</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 08:26:13 GMT</pubDate>
            <atom:updated>2026-11-03T08:38:47.835Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zi14FHsycmdAlr4S.png" /></figure><p>Counting tokens is the easy part. Every library does it.</p><p>The hard part is what happens <strong>after</strong> you are over budget. You have to drop something — and most tools drop silently. They truncate the tail of the prompt, or they keep adding files until they hit the limit and stop. Both leave you with an agent that answered from a prompt you never saw.</p><p>So I built <strong>roomy</strong>: it packs under an explicit budget and returns, for every candidate, either the reason it is in or the reason it is out.</p><p>👉 <strong>Repo (MIT):</strong> <a href="https://github.com/dev48v/roomy">https://github.com/dev48v/roomy</a><br> 👉 <strong>The write-up, live:</strong> <a href="https://dev48.in/agentlab/vol5-02-roomy.html">https://dev48.in/agentlab/vol5-02-roomy.html</a></p><pre>$ python roomy.py ../mcpfromzero --budget 6000 --reserve 1000 budget 6000 reserve 1000 used 4820 headroom 180 ------------------------------------------------------------------------ IN README.md 2871 fits (priority 2) IN docs/NOTICE.md 412 fits (priority 1) IN python/mcpfromzero/__main__.py 27 fits (priority 0) ... out conformance/run.py 3694 no room left: 3694 needed, 180 free out typescript/src/tools.ts 4371 no room left: 4371 needed, 180 free out python/mcpfromzero/tools.py 4666 no room left: 4666 needed, 180 free ------------------------------------------------------------------------ 9 in, 14 out</pre><h3>The rule of thumb is wrong in the dangerous direction</h3><p>Four characters per token is an average over <strong>English prose</strong>. Agent prompts are made of code, where identifiers split, punctuation is its own token, and every newline costs.</p><p>Measured over one real repository:</p><p>An over-count wastes a little budget. An <strong>under-count overflows the window</strong>, and that failure arrives as a truncated reply rather than as an error. roomy is deliberately biased toward the first.</p><p>It ships <strong>no tokenizer</strong>, on purpose — vendoring one ties the tool to a single model family and is wrong for every other.</p><h3>The reserve is not optional</h3><p>The window is shared with the output. A prompt that “fits” in 6,000 tokens does not fit if the model then needs 1,000 to answer:</p><h3>A required item that does not fit raises</h3><p>It does <strong>not</strong> return a plan with the thing missing. A caller who ignores that exception has built a prompt without something they declared they could not work without — and that failure comes back as a confident, wrong answer rather than a crash.</p><h3>Smallest-first is a heuristic, and the gap is measured</h3><p>Packing a budget optimally is knapsack. roomy sorts by priority, then size, then name. Rather than claiming that is fine, the page measures it against an exhaustive 2^16 search:</p><p>It gives up real window. That is the trade: a packing you can <strong>explain line by line</strong> and reproduce exactly is worth more here than a few percent, because the output is read by a human deciding what to include — not by a bin.</p><p>The sort ends on the <strong>name</strong> so the result never depends on the order the caller happened to build the list in.</p><h3>Tested cross-language</h3><p>The write-up ships a JavaScript port of the packer. A port checked only against itself is not checked, so the verifier runs the <strong>Python</strong> package as a subprocess and demands the two agree, decision for decision, on the same inputs — 38 randomised cases plus deliberate edges (empty lists, duplicate names, a reserve that swallows the budget, a zero-token candidate).</p><p><strong>36 unit tests. 909 verifier asserts including the cross-language comparison. 0 failures.</strong></p><p>The four invariants worth guarding, and the only ones the tests really care about: the budget is never exceeded, every candidate gets a decision, the result does not depend on input order, and a required item that does not fit raises rather than vanishing.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/the-4-characters-per-token-rule-under-counts-real-code-by-27-no6"><em>https://dev.to</em></a><em> on November 3, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8d3f4d24923" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Synonym Expansion Cannot Lower Recall. That Is Exactly Why Recall Is the Wrong Thing to Tune It On.]]></title>
            <link>https://dev48v.medium.com/synonym-expansion-cannot-lower-recall-that-is-exactly-why-recall-is-the-wrong-thing-to-tune-it-on-f825cf3cb9e5?source=rss-1c98528dfca9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f825cf3cb9e5</guid>
            <dc:creator><![CDATA[Dev48V]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 08:26:09 GMT</pubDate>
            <atom:updated>2026-11-03T08:38:04.593Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5QbjN6dIc9YuIl7G.png" /></figure><p>Query rewriting is the first stage of most RAG pipelines and the one that gets tuned by vibes. So I built a real BM25 index over a real corpus, applied real rewrites, and scored them against hand-labelled relevance.</p><p>👉 <strong>Live, runs in your browser:</strong> <a href="https://dev48.in/ai/days/day82-query-rewriting.html">https://dev48.in/ai/days/day82-query-rewriting.html</a></p><h3>The claim I had to withdraw</h3><p>I wrote this assertion and it <strong>failed</strong>:</p><p>Expansion raised <strong>both</strong> — recall 0.688 → 0.938 <em>and</em> precision 0.375 → 0.542.</p><p>That is not a flaw in the measurement. It is what a genuine vocabulary mismatch looks like: the documents say <em>automobile</em> and <em>vehicle</em> where the queries say <em>car</em>, so the added terms are not noise, they are the <strong>missing words</strong>.</p><p>The precision/recall trade-off everyone quotes is a property of <strong>synonym quality</strong>, not of expansion. The control proves it — the same mechanism, same code path, <strong>identical query length</strong> (5.8 tokens either way), but with plausible-and-wrong synonyms:</p><blockquote><em>precision 0.375 → 0.375, </em><strong><em>MRR 0.938 → 0.813</em></strong></blockquote><p>Interesting detail: precision@3 does not move. The wrong synonyms are rare terms, so they pull in few documents at a cut-off of three. The damage shows up in <strong>where the first relevant hit lands</strong> — which is the metric a RAG pipeline actually lives on, because the generator only ever sees a truncated list.</p><h3>Why recall is a trap here</h3><p>Look at the definition. expand only <strong>adds</strong> terms, never removes them:</p><p>A superset of the query can only retrieve a superset of the documents. <strong>Recall cannot fall.</strong> So “our rewrite improved recall” is close to a tautology for any additive rewrite, and tuning on it will approve every expansion you ever write, including the bad ones.</p><h3>HyDE lost to doing nothing</h3><p>MRR <strong>0.938 → 0.323</strong>. Per-query, the pseudo-answer version is worse on five of eight.</p><p>The mechanism is mundane. A HyDE pseudo-answer is query terms plus answer-shaped filler — <em>this, document, explains, typically, generally, process, step, first, then, finally</em>. Those are <strong>real terms in the corpus</strong>, and two of my sixteen documents are majority filler:</p><blockquote><em>“The process you should generally follow to file a complaint”<br> “This document explains what you should typically do first”</em></blockquote><p>A pseudo-answer retrieves those because it <strong>looks like them</strong>.</p><p>The control is the important half: strip the filler and keep everything else, and HyDE’s MRR is <em>identical</em> to the raw query, to machine precision. It is the filler, not the method. A corpus of prose with no boilerplate documents would behave differently — which is the real lesson, since you cannot know that without measuring your own corpus.</p><h3>A rewrite reweights, it does not just add</h3><p>BM25 scores a term by how rare it is:</p><p>Adding one common word contributes almost nothing. Adding <strong>many</strong> common words — which is what a pseudo-answer is made of — pulls generic documents to the top.</p><h3>Verification</h3><p>The page scores from an inverted index, accumulating term by term. The verifier builds a <strong>dense</strong> term-document matrix and computes each document’s score from the BM25 formula directly — the transpose of the page’s loop, written from the formula rather than from its code. The relevance labels are retyped, so a label typo would surface as a disagreement instead of being copied along.</p><p><strong>263 asserts, 0 failures.</strong> 22 in-page checks.</p><p><em>Originally published at </em><a href="https://dev.to/dev48v/synonym-expansion-cannot-lower-recall-that-is-exactly-why-recall-is-the-wrong-thing-to-tune-it-on-5dba"><em>https://dev.to</em></a><em> on November 3, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f825cf3cb9e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>