<?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: b1ackjack12</title>
    <description>The latest articles on DEV Community by b1ackjack12 (@b1ackjack12).</description>
    <link>https://dev.to/b1ackjack12</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%2F4178028%2F73382ce8-418c-4b2f-8812-be886daa9b88.png</url>
      <title>DEV Community: b1ackjack12</title>
      <link>https://dev.to/b1ackjack12</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/b1ackjack12"/>
    <language>en</language>
    <item>
      <title>I Predicted CutMix's Confidence Before Training It. The Accuracy Was the Surprise</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Tue, 24 Nov 2026 01:51:36 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/i-predicted-cutmixs-confidence-before-training-it-the-accuracy-was-the-surprise-61o</link>
      <guid>https://dev.to/b1ackjack12/i-predicted-cutmixs-confidence-before-training-it-the-accuracy-was-the-surprise-61o</guid>
      <description>&lt;p&gt;&lt;a href="https://b1ackjack12.github.io/posts/mixup-measured" rel="noopener noreferrer"&gt;Tuesday's mixup post&lt;/a&gt; ended on a mechanism I claimed wasn't empirical: a soft-target technique's confidence is decided by its targets, not discovered during training. Mixup's targets average 0.750 at α=1.0, and the trained model dutifully reported 72.9. If that's a real mechanism and not a coincidence, it should transfer to a technique with the same label arithmetic but &lt;em&gt;completely different pixels&lt;/em&gt; — and that technique exists. CutMix draws the same &lt;code&gt;lam ~ Beta(α, α)&lt;/code&gt;, but instead of alpha-blending two whole images into a ghostly double exposure, it cuts a rectangular patch from one image and pastes it into the other, with the label blended by patch area. Locally, every pixel is clean; only the label is soft. Same target math, different image statistics. If confidence is obedient, CutMix should land on its target average too. That's a prediction, made before training, falsifiable for the price of ten runs.&lt;/p&gt;

&lt;p&gt;One wrinkle makes it a sharper test: CutMix's &lt;em&gt;realized&lt;/em&gt; blend weight isn't quite Beta-distributed, because patches that straddle the image border get clipped smaller and the label weight is recomputed from the surviving area. So instead of trusting the closed-form 0.750, I logged the realized mean of &lt;code&gt;max(lam, 1−lam)&lt;/code&gt; across every training step — the actual average confidence the loss requested. Two arms on the &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget" rel="noopener noreferrer"&gt;usual recipe&lt;/a&gt; (CIFAR-10, adapted ResNet18, Adam lr 1e-3, cosine, 10 epochs), five seeds, paired against the same-seed baseline runs from Tuesday: CutMix applied to every batch, and CutMix applied with probability 0.5 — the duty cycle most real codebases (including timm) actually ship.&lt;/p&gt;

&lt;h2&gt;
  
  
  The scoreboard, theory column included
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;arm&lt;/th&gt;
&lt;th&gt;requested conf (logged)&lt;/th&gt;
&lt;th&gt;delivered conf&lt;/th&gt;
&lt;th&gt;accuracy&lt;/th&gt;
&lt;th&gt;Δ vs baseline (t)&lt;/th&gt;
&lt;th&gt;ECE&lt;/th&gt;
&lt;th&gt;NLL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;baseline&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;92.5&lt;/td&gt;
&lt;td&gt;89.74 ±0.20&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;2.85&lt;/td&gt;
&lt;td&gt;0.315&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mixup α=1.0 (Tue)&lt;/td&gt;
&lt;td&gt;75.0&lt;/td&gt;
&lt;td&gt;72.9&lt;/td&gt;
&lt;td&gt;87.98&lt;/td&gt;
&lt;td&gt;−1.76 (t = −12.2)&lt;/td&gt;
&lt;td&gt;15.10&lt;/td&gt;
&lt;td&gt;0.490&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cutmix p=1.0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;73.1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;76.2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;86.65 ±0.26&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−3.08 (t = −23.9), 0/5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10.49&lt;/td&gt;
&lt;td&gt;0.473&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;cutmix p=0.5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;86.4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;85.6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;88.81 ±0.22&lt;/td&gt;
&lt;td&gt;−0.92 (t = −7.5), 0/5&lt;/td&gt;
&lt;td&gt;3.31&lt;/td&gt;
&lt;td&gt;0.353&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The prediction held, twice. Always-on CutMix requested an average confidence of 73.1 (the border clipping shaved 1.9 points off the theoretical 75) and the model delivered 76.2 — three points of daylight. The p=0.5 arm is the cleaner hit: half the steps train on clean one-hot targets, half on patched ones, the logged request averages 86.4, and the model reports 85.6. &lt;strong&gt;Within 0.8 points, on a number computed from the augmentation's sampling distribution.&lt;/strong&gt; Across mixup and CutMix now, four arms at four different doses (requested 75.0 / 73.1 / 86.4 / 89.9, delivered 72.9 / 76.2 / 85.6 / 85.0), confidence tracks the request everywhere, never off by more than five points while the arms span a seventeen-point range. The confidence column of a soft-target technique is not a training outcome. It's a configuration you set, in expectation, when you pick α and p.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16rmd51ee3auutfo0kec.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F16rmd51ee3auutfo0kec.webp" alt="A tailor sewing a square patch onto a quilt, with finished quilts showing patches of every size" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A small asymmetry is worth recording for honesty: mixup delivered slightly &lt;em&gt;under&lt;/em&gt; its request (72.9 vs 75.0) while CutMix delivered slightly &lt;em&gt;over&lt;/em&gt; (76.2 vs 73.1). A plausible reading is the pixels: a mixup input is globally ambiguous — every pixel is a blend, so the model's own uncertainty discounts further — while a CutMix input is two regions of perfectly clean pixels, each locally unambiguous, letting the network stay a touch surer than the label asks. I'll flag that as interpretation; the three-point residual is near the edge of what these five-seed means resolve.&lt;/p&gt;

&lt;h2&gt;
  
  
  The accuracy column is where folklore lost
&lt;/h2&gt;

&lt;p&gt;I expected CutMix to roughly reprise mixup's accuracy story. It did worse — meaningfully. Always-on CutMix costs &lt;strong&gt;−3.08 points (t = −23.9, zero wins in five)&lt;/strong&gt;, nearly double mixup's −1.76 at the same α. Even at the shipping-default p=0.5, it's −0.92 with zero wins, where &lt;a href="https://b1ackjack12.github.io/posts/mixup-measured" rel="noopener noreferrer"&gt;mixup's conservative dose was a clean null&lt;/a&gt;. On long schedules the published ranking runs the other way — CutMix is the stronger performer of the pair on ImageNet-scale training. At a tenth of the native schedule, the ranking inverts, and the direction makes mechanical sense: CutMix is the more aggressive intervention. Mixup shows the model a dimmed version of &lt;em&gt;both&lt;/em&gt; images everywhere; CutMix fully occludes a region, deleting that part of the object outright and demanding the model classify from whatever survived the crop. That's a harder curriculum, which is to say a stronger regularizer, which is to say — &lt;a href="https://b1ackjack12.github.io/posts/mixup-measured" rel="noopener noreferrer"&gt;as with mixup&lt;/a&gt;, &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;as with EMA&lt;/a&gt; — a bigger loan against training time than a 10-epoch budget can service. The stronger the medicine, the worse it performs when the course of treatment is cut short.&lt;/p&gt;

&lt;p&gt;Calibration-wise, the same overshoot logic from &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-dose-response" rel="noopener noreferrer"&gt;the label smoothing series&lt;/a&gt; prices every row: my baseline is only +2.8 overconfident, so a requested confidence of 73 overshoots straight through honest into deeply underconfident (ECE 10.49), while the p=0.5 arm's gentler request of 86 lands close enough that ECE only drifts from 2.85 to 3.31. Note what the duty-cycle knob turned out to be: &lt;code&gt;p&lt;/code&gt; is a &lt;em&gt;linear dial on requested confidence&lt;/em&gt; — 0.5 × 100 + 0.5 × 73 ≈ 86.5, logged 86.4 — which makes it the same kind of dose control as label smoothing's ε, just implemented as a coin flip per batch instead of a constant per label.&lt;/p&gt;

&lt;p&gt;Scope lines: one dataset, one small model, one budget, and the long-schedule regime — where both techniques earned their reputations — deliberately unmeasured. What this adds to Tuesday's post is the part a single technique couldn't establish: the obedient-confidence arithmetic survived a change of pixel mechanics, a change of realized &lt;code&gt;lam&lt;/code&gt; distribution, and a duty-cycle knob it predicted linearly. If you ship mixup or CutMix, you can now write down your model's approximate mean confidence before you train — and if you were counting on that number to mean something about calibration, &lt;a href="https://b1ackjack12.github.io/posts/temperature-scaling-measured" rel="noopener noreferrer"&gt;one fitted scalar afterwards&lt;/a&gt; remains the cheaper, better tool.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/cutmix-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>computervision</category>
    </item>
    <item>
      <title>Mixup's Confidence Isn't Miscalibrated. It's Obedient</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Tue, 24 Nov 2026 01:51:25 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/mixups-confidence-isnt-miscalibrated-its-obedient-4pl7</link>
      <guid>https://dev.to/b1ackjack12/mixups-confidence-isnt-miscalibrated-its-obedient-4pl7</guid>
      <description>&lt;p&gt;Mixup is the most cited training trick I hadn't put on the bench yet: blend pairs of images with a random weight &lt;code&gt;lam ~ Beta(α, α)&lt;/code&gt;, blend their labels with the same weight, and train on the result. The original paper reports solid gains — on schedules of 90 to 200 epochs. The follow-up folklore adds a second claim: mixup-trained models are better &lt;em&gt;calibrated&lt;/em&gt;, with confidence that tracks accuracy instead of exceeding it. Both claims are measurable at my budget, and after &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-calibration-measured" rel="noopener noreferrer"&gt;the label smoothing series&lt;/a&gt; I had a suspicion about the second one — mixup is, after all, another technique that trains against soft targets.&lt;/p&gt;

&lt;p&gt;Same harness as always: CIFAR-10, the adapted ResNet18, the &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget" rel="noopener noreferrer"&gt;tuned Adam recipe&lt;/a&gt; (lr 1e-3, weight decay 5e-4, cosine, 10 epochs), five paired seeds per arm. Three arms: no mixup, the conservative α=0.2 most codebases default to, and the paper's α=1.0 where &lt;code&gt;lam&lt;/code&gt; is uniform on [0, 1]. The instrument panel is the one from the &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-calibration-measured" rel="noopener noreferrer"&gt;label smoothing post&lt;/a&gt;: test accuracy, mean confidence of the predicted class, 15-bin expected calibration error, and NLL.&lt;/p&gt;

&lt;h2&gt;
  
  
  The table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;arm&lt;/th&gt;
&lt;th&gt;accuracy&lt;/th&gt;
&lt;th&gt;Δ vs baseline (t)&lt;/th&gt;
&lt;th&gt;mean confidence&lt;/th&gt;
&lt;th&gt;conf − acc gap&lt;/th&gt;
&lt;th&gt;ECE&lt;/th&gt;
&lt;th&gt;NLL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;baseline&lt;/td&gt;
&lt;td&gt;89.74 ±0.20&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;92.5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+2.8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2.85&lt;/td&gt;
&lt;td&gt;0.315&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mixup α=0.2&lt;/td&gt;
&lt;td&gt;89.66 ±0.21&lt;/td&gt;
&lt;td&gt;−0.08 (t = −0.65), 2/5 wins&lt;/td&gt;
&lt;td&gt;85.0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−4.7&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4.70&lt;/td&gt;
&lt;td&gt;0.341&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mixup α=1.0&lt;/td&gt;
&lt;td&gt;87.98 ±0.47&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−1.76 (t = −12.18), 0/5 wins&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;72.9&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−15.1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;15.10&lt;/td&gt;
&lt;td&gt;0.490&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Accuracy first, because it's the simpler verdict. At this budget α=0.2 is a clean null — a −0.08 mean delta the pairing can't distinguish from seed noise. α=1.0 is not a null: −1.76 points, zero wins in five seeds, a t-statistic that leaves no room for argument. The folklore that mixup needs long schedules survives contact with the bench, and the mechanism is visible in what mixup &lt;em&gt;is&lt;/em&gt;: it replaces every clean training image with a blend, so the model never sees an unmodified example. That's a strong regularizer, and regularization is a loan against training time — at 200 epochs the model has capacity and schedule to spare, and taming it pays; at 10 epochs the model is still underfitting, and taming it harder just means arriving at test day having learned less. It's the same budget logic that made &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;EMA a near-null here&lt;/a&gt; and keeps showing up whenever I benchmark a technique at a tenth of its home schedule.&lt;/p&gt;

&lt;h2&gt;
  
  
  The confidence column was decided before training started
&lt;/h2&gt;

&lt;p&gt;The calibration story is where it gets interesting, because the numbers look dramatic until you realize they were predictable — not qualitatively, &lt;em&gt;numerically&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Mixup's training targets are soft: with blend weight &lt;code&gt;lam&lt;/code&gt;, the dominant class gets target probability &lt;code&gt;max(lam, 1−lam)&lt;/code&gt;. So before any gradient flows, you can ask what confidence the loss is actually asking for, on average. For α=1.0, &lt;code&gt;lam&lt;/code&gt; is uniform and the expected dominant-class target is exactly &lt;strong&gt;0.750&lt;/strong&gt;. For α=0.2, the Beta(0.2, 0.2) distribution is U-shaped — most blends are nearly pure — and the expectation is &lt;strong&gt;0.899&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now reread the confidence column: the α=1.0 model reports mean confidence &lt;strong&gt;72.9&lt;/strong&gt; against a predicted 75.0, and the α=0.2 model reports &lt;strong&gt;85.0&lt;/strong&gt; against a predicted 89.9 — each a few points below its target average, which is the same discount the &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-calibration-measured" rel="noopener noreferrer"&gt;label smoothing post&lt;/a&gt; found, where the model's own residual uncertainty deflates things slightly further. The models aren't confused about their probabilities. They are reporting almost exactly the confidence the training targets instructed them to report, and the Beta distribution wrote the instruction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo6lup65i9p0ezlqr2idy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo6lup65i9p0ezlqr2idy.webp" alt="Two paint cans pouring into a mixing tray, the painter inspecting the blended swatches" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Which is why "mixup improves calibration" inverted here, the same way "label smoothing improves calibration" did. My 10-epoch baseline is only mildly vain: 92.5 confidence on 89.7 accuracy, a +2.8 gap, ECE 2.85. The calibration literature's mixup results come from models with much bigger overconfidence to burn off, where a built-in confidence haircut lands near the truth. Mine didn't need a 7-point haircut (α=0.2), let alone a 17-point one (α=1.0) — so the correction overshot straight through zero into underconfidence, and ECE got worse at both doses: 2.85 → 4.70 → 15.10. That last number is the worst calibration error I've measured on this blog, from a technique with a calibration reputation. NLL agrees at every dose (0.315 → 0.341 → 0.490). The pattern now holds across three label-softening techniques measured on this exact setup: the folklore "X improves calibration" is really "X deflates confidence by a fixed, dose-determined amount" — a correction, not a calibration, and it only helps when your model's overconfidence happens to match the dose. &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-dose-response" rel="noopener noreferrer"&gt;Label smoothing's matched dose was 0.02&lt;/a&gt;. Mixup's matched dose at this budget would be some homeopathic α I didn't bother to find, because there's a better tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to actually do
&lt;/h2&gt;

&lt;p&gt;If you're at a short budget and want honest probabilities, the ranking from my own measurements is unambiguous. &lt;a href="https://b1ackjack12.github.io/posts/temperature-scaling-measured" rel="noopener noreferrer"&gt;Temperature scaling&lt;/a&gt; took the plain baseline to ECE ~1.0 with one scalar fitted on 500 images, accuracy untouched. Native label smoothing at the matched 0.02 dose got ECE 1.21. Mixup at either standard dose made both accuracy and calibration worse — and if you're using mixup anyway for its long-schedule accuracy benefits, know that its deflated confidence is a &lt;em&gt;systematic, dose-shaped&lt;/em&gt; distortion, which is exactly the kind temperature scaling can mostly re-sharpen (it correctly fitted T = 0.75 on my smoothing-deflated model and recovered most of the damage).&lt;/p&gt;

&lt;p&gt;Scope lines, as usual: one dataset, one small model, one optimizer recipe, and above all one budget — 10 epochs against the technique's native 90–200. I haven't measured the long-schedule regime, and nothing here contradicts mixup's accuracy gains there. What I'd defend anywhere is the mechanism, because it isn't empirical: mixup's targets have a computable average confidence, the trained model dutifully converges to it, and whether that lands as "improved calibration" or as the worst ECE on your bench depends entirely on how overconfident you were before the medicine arrived.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/mixup-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>computervision</category>
    </item>
    <item>
      <title>I Threw Away Half My Training Data and Lost Nothing. Then I Threw Away Half My People and Lost Three Points</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:42:01 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/i-threw-away-half-my-training-data-and-lost-nothing-then-i-threw-away-half-my-people-and-lost-40il</link>
      <guid>https://dev.to/b1ackjack12/i-threw-away-half-my-training-data-and-lost-nothing-then-i-threw-away-half-my-people-and-lost-40il</guid>
      <description>&lt;p&gt;The HAR lane of this blog keeps circling one fact from different directions: &lt;a href="https://b1ackjack12.github.io/posts/imu-har-subject-vs-random-split" rel="noopener noreferrer"&gt;subject identity is the hard axis&lt;/a&gt;. Split by subject and accuracy drops eight points; the worst subject in any split trails the average by fifteen; &lt;a href="https://b1ackjack12.github.io/posts/har-augmentation-fifty-splits" rel="noopener noreferrer"&gt;every augmentation win&lt;/a&gt; and &lt;a href="https://b1ackjack12.github.io/posts/har-gyro-failure-insurance" rel="noopener noreferrer"&gt;every robustness trick&lt;/a&gt; earns its keep disproportionately on the hardest person. All of which raises the question any real project has to answer &lt;em&gt;before&lt;/em&gt; any of that tuning: when you're planning data collection with a fixed budget, do you spend it recruiting more people or recording more hours per person?&lt;/p&gt;

&lt;p&gt;That's measurable with the &lt;a href="https://b1ackjack12.github.io/posts/har-augmentation-fifty-splits" rel="noopener noreferrer"&gt;usual harness&lt;/a&gt;. Fifty paired splits; in each one, 9 random test subjects held out and a pool of 21 to train from. The dose-response arms train on all windows from 21, 15, 10, or 5 randomly chosen pool subjects. And then the arm that actually decides the question: &lt;strong&gt;mix10&lt;/strong&gt;, which trains on windows drawn from &lt;em&gt;all 21&lt;/em&gt; pool subjects but subsampled to exactly match the 10-subject arm's window count, split by split. Same data volume, different human diversity — whatever separates mix10 from s10 is purely the number of distinct people in the recordings.&lt;/p&gt;

&lt;h2&gt;
  
  
  The dose-response, and the control that explains it
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;training set&lt;/th&gt;
&lt;th&gt;windows&lt;/th&gt;
&lt;th&gt;accuracy&lt;/th&gt;
&lt;th&gt;Δ vs full&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;th&gt;worst subject Δ&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;21 subjects, all windows&lt;/td&gt;
&lt;td&gt;~7,208&lt;/td&gt;
&lt;td&gt;92.66 ±2.76&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;15 subjects&lt;/td&gt;
&lt;td&gt;~5,143&lt;/td&gt;
&lt;td&gt;92.05&lt;/td&gt;
&lt;td&gt;−0.61&lt;/td&gt;
&lt;td&gt;−3.5&lt;/td&gt;
&lt;td&gt;−2.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10 subjects&lt;/td&gt;
&lt;td&gt;~3,419&lt;/td&gt;
&lt;td&gt;91.25&lt;/td&gt;
&lt;td&gt;−1.40&lt;/td&gt;
&lt;td&gt;−5.9&lt;/td&gt;
&lt;td&gt;−5.70&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 subjects&lt;/td&gt;
&lt;td&gt;~1,696&lt;/td&gt;
&lt;td&gt;89.41&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−3.24&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−7.0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−9.02&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;all 21 subjects, half the windows&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~3,419&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;92.44&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.22&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−1.5&lt;/td&gt;
&lt;td&gt;−0.49&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read the dose-response first. Dropping from 21 to 15 subjects costs a statistically solid but modest −0.61. Ten subjects costs −1.40. Five costs −3.24. And as always on this dataset, the mean is the gentle version of the story: the worst-subject column degrades three times faster (−2.30, −5.70, −9.02), because the fewer people the model has met, the worse its odds that &lt;em&gt;someone&lt;/em&gt; in the test set moves like nobody in the training set. The curve is superlinear in the direction that hurts — each halving of recruitment costs more than the last.&lt;/p&gt;

&lt;p&gt;Now the control arm, which is the whole post. mix10 trains on the &lt;em&gt;same ~3,419 windows&lt;/em&gt; as the 10-subject arm — literally matched per split — but draws them from all 21 people. The paired comparison between those two arms is &lt;strong&gt;+1.18 points (t = 5.3), forty wins in fifty&lt;/strong&gt;, and on the worst subject the gap widens to over five points (−0.49 vs −5.70 against baseline). Same storage, same GPU-minutes, same label volume; the only difference is how many distinct humans contributed. Diversity didn't just beat volume — volume barely registered: mix10, running on &lt;strong&gt;47% of the data&lt;/strong&gt;, lands within −0.22 of the full dataset, a difference the pairing can't distinguish from zero (t = −1.5). Every hour of recording past a surprisingly early point was, for this model and task, redundant with the hours already on disk. The people weren't.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbclyoyr0zao6f8likzc3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbclyoyr0zao6f8likzc3.webp" alt="Two audition judges: one bored, listening to the same singer five times over; the other delighted, hearing five genuinely different performers" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the hours run out of things to say
&lt;/h2&gt;

&lt;p&gt;The mechanism is the one the &lt;a href="https://b1ackjack12.github.io/posts/imu-sampling-rate-measured" rel="noopener noreferrer"&gt;sampling-rate post&lt;/a&gt; found on the time axis, now showing up on the dataset axis: human activity signal is highly redundant. Within one subject, the thousandth window of walking looks overwhelmingly like the hundredth — same gait frequency, same device placement, same personal quirks. Those windows mostly re-teach what the model already knows about &lt;em&gt;that person&lt;/em&gt;. A new subject, by contrast, delivers the thing the model can't get anywhere else: a new point in the space of bodies, speeds, and wearing styles — precisely the axis the test set will probe when &lt;a href="https://b1ackjack12.github.io/posts/har-loso-error-analysis" rel="noopener noreferrer"&gt;a stranger puts on the device&lt;/a&gt;. In statistical terms, the effective sample size of subject-correlated windows saturates fast; the effective sample size of &lt;em&gt;subjects&lt;/em&gt; is just the headcount.&lt;/p&gt;

&lt;p&gt;The budget translation is blunt. Recording sessions are the cheap part of a study (the subject is already there, instrumented, consented) and recruitment is the expensive part — so the temptation is always to stretch sessions and trim headcount. This table prices that temptation: trading 11 people for longer recordings from 10 costs more accuracy than &lt;em&gt;deleting half of all your data&lt;/em&gt;. If the choice is 10 people for two hours or 21 people for one, it isn't close — and if your collected dataset is bloated, the order to trim in is now measured: cut hours per person freely, defend every person. Scope lines as usual: one dataset (30 subjects, lab conditions, one device position), one small CNN, and a subject pool capped at 21 — I can't tell you where the subject curve itself saturates, because UCI HAR ran out of people before the model did. Which is, come to think of it, the finding restated.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/har-subjects-vs-hours/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>iot</category>
      <category>sensors</category>
    </item>
    <item>
      <title>One Good Question Repriced TTA: Ten Views Now Cost 8%</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Mon, 09 Nov 2026 04:42:00 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/one-good-question-repriced-tta-ten-views-now-cost-8-62e</link>
      <guid>https://dev.to/b1ackjack12/one-good-question-repriced-tta-ten-views-now-cost-8-62e</guid>
      <description>&lt;p&gt;The &lt;a href="https://b1ackjack12.github.io/posts/test-time-augmentation-measured" rel="noopener noreferrer"&gt;test-time augmentation post&lt;/a&gt; ended with a price list: +0.56 accuracy for 2.0x inference cost, +0.71 for 10.0x, measured cleanly and scaling exactly with view count. Then a sharp question about it came my way — one my benchmark had quietly dodged: those timings ran the flipped copies as a &lt;em&gt;second forward pass&lt;/em&gt; — what happens if you concatenate them into the same batch? Does the overhead stay linear, or does something nonlinear happen when the batch doubles?&lt;/p&gt;

&lt;p&gt;I measured two rows to answer the question, and the two rows demanded the full table, because they implied the original post's price list is only the &lt;em&gt;worst-case menu&lt;/em&gt;. Here's the sweep: five batch sizes, the usual CIFAR ResNet18, warmed-up CUDA-event timings, median of up to 100 reps. "Sequential" launches one forward pass per view (how my original benchmark did it, and how most TTA tutorial code does it); "concat" stacks all views into a single batch and launches once.&lt;/p&gt;

&lt;h2&gt;
  
  
  The price depends on how you ask
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;batch&lt;/th&gt;
&lt;th&gt;plain latency&lt;/th&gt;
&lt;th&gt;flip, sequential&lt;/th&gt;
&lt;th&gt;flip, concat&lt;/th&gt;
&lt;th&gt;10-view, sequential&lt;/th&gt;
&lt;th&gt;10-view, concat&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1.98 ms&lt;/td&gt;
&lt;td&gt;2.01x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.07x&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10.26x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.08x&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;1.95 ms&lt;/td&gt;
&lt;td&gt;2.01x&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.97x&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10.30x&lt;/td&gt;
&lt;td&gt;1.55x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;1.85 ms&lt;/td&gt;
&lt;td&gt;2.02x&lt;/td&gt;
&lt;td&gt;1.45x&lt;/td&gt;
&lt;td&gt;10.20x&lt;/td&gt;
&lt;td&gt;7.88x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;4.95 ms&lt;/td&gt;
&lt;td&gt;2.00x&lt;/td&gt;
&lt;td&gt;2.38x&lt;/td&gt;
&lt;td&gt;9.95x&lt;/td&gt;
&lt;td&gt;12.45x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;512&lt;/td&gt;
&lt;td&gt;24.7 ms&lt;/td&gt;
&lt;td&gt;2.00x&lt;/td&gt;
&lt;td&gt;1.99x&lt;/td&gt;
&lt;td&gt;9.99x&lt;/td&gt;
&lt;td&gt;10.03x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Start with the sequential columns, because their flatness is the clue to everything else: 2.0x and 10x &lt;em&gt;at every batch size&lt;/em&gt;, top to bottom. Each extra forward pass pays the full launch-and-sync toll no matter how empty the GPU is. Now look at the plain-latency column: from batch 1 to batch 32, latency barely moves — 1.98, 1.95, 1.85 ms. That's the fixed-overhead floor the &lt;a href="https://b1ackjack12.github.io/posts/cpu-vs-gpu-serving-crossover" rel="noopener noreferrer"&gt;serving-crossover post&lt;/a&gt; kept running into: at small batches the GPU isn't computing, it's commuting, and a 32-image batch finishes in the same time as a single image.&lt;/p&gt;

&lt;p&gt;Concat exploits exactly that slack. At batch 1, stacking ten views makes a batch of ten — still far below the floor's capacity — so the full view set rides along at &lt;strong&gt;1.08x&lt;/strong&gt;. The ensemble that won +0.71 in the accuracy post, the single largest reliable gain this blog has measured on any knob, costs eight percent of latency at the batch size most online services actually serve. The flip-only version is measured at 0.97x–1.07x down there, which is to say: free, with the sub-1.0 reading being ordinary timing noise on identical floor-bound launches. Even at batch 32, concat charges 1.45x for the flip against sequential's 2.02x.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmtwcufu9izljsm4r3roi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmtwcufu9izljsm4r3roi.webp" alt="Two elevators making the same trip: one carrying a single rider, the other comfortably carrying ten" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the discount dies, and a wrinkle I didn't expect
&lt;/h2&gt;

&lt;p&gt;The discount is a loan from the GPU's idle capacity, and it's repaid as the batch fills the machine. By batch 512 the two implementations converge to identical sticker price (1.99x vs 2.00x; 10.03x vs 9.99x) — a saturated GPU has no slack to hide views in, and &lt;em&gt;how&lt;/em&gt; you deliver the work stops mattering. That's the regime my original benchmark measured, which is why it saw clean multiples; it wasn't wrong, it was just quoting the peak-hour fare.&lt;/p&gt;

&lt;p&gt;The wrinkle is batch 128, where concat is &lt;em&gt;worse&lt;/em&gt; than sequential: 2.38x vs 2.00x for the flip, 12.45x vs 9.95x for ten views. This isn't a scheduling spike — it's the per-image efficiency curve being non-monotonic. On this GPU, batch 128 happens to be an unusually efficient shape (4.95 ms ≈ 38.7 µs/image, better than batch 512's 48.3 µs/image), so concatenating &lt;em&gt;out of&lt;/em&gt; that sweet spot into batch 256 or 1280 means paying the neighboring, worse per-image rate. Sequential, by contrast, gets to run the sweet-spot shape repeatedly. The lesson isn't "concat is dangerous"; it's that batch-shape performance has local terrain, and a one-line change that doubles your shape can land anywhere on it. If your serving batch sits mid-range, measure both — it's a five-minute benchmark.&lt;/p&gt;

&lt;p&gt;So the decision rule, compact enough for a sticky note: compute &lt;code&gt;batch × views&lt;/code&gt;. If that product stays inside your GPU's flat region (here, up to roughly 64–100 images), TTA via concat is nearly free and you should take the accuracy; if it lands beyond saturation, TTA costs its full multiplier no matter the implementation; in between, measure. And never ship the sequential loop from tutorial code without checking — at small batches it pays double for literally nothing.&lt;/p&gt;

&lt;p&gt;Housekeeping: this revises the &lt;a href="https://b1ackjack12.github.io/posts/test-time-augmentation-measured" rel="noopener noreferrer"&gt;TTA post's&lt;/a&gt; cost column from "2.0x/10.0x" to "up to 2.0x/10.0x, as low as ~1.0x/1.1x at small batches with concatenated views" — the accuracy numbers stand untouched. And a note to self worth keeping: this post exists because someone asked a sharper question about my benchmark than I had asked myself — the entire audit-the-defaults ethos pointed back at me, and exactly the kind of question I hope these posts keep attracting. Scope: one GPU (RTX 4080 SUPER), fp32, one small model whose images are tiny — bigger inputs fill the floor faster, shrinking the free region; the terrain is yours to map, the method travels.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;P.S. (2026-10-27).&lt;/strong&gt; Two more good questions came in after this went up: does anything change past batch 512, and does the picture hold for other layer configs? I had the harness lying around, so I ran both. Past 512, it turned out to be boring in the best way — per-image cost pins at ~49 µs from 512 all the way through 4096, with sequential and concat both sitting at exactly 2.0x; I half expected something weird at the big shapes and got a flat line. The layer configs were the interesting part. Stock ResNet-18 (7×7 stride-2 stem plus maxpool, which shrinks activations much earlier than my CIFAR stem) keeps its discount much longer: at batch 512 concat was still only 1.65x against sequential's 2.2x, and full price didn't arrive until around 1024. ResNet-50 went the other way — discount mostly gone by 512, though batch 32 still rode at 1.17x. So it was never really about the model: it's about where your card saturates, and the architecture just moves that line. Heavier activations pull it left, lighter ones push it right.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/tta-serving-price-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>performance</category>
      <category>computervision</category>
    </item>
    <item>
      <title>My Gradient Clipping Was Never Clipping. It Was Secretly Multiplying My Weight Decay</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Wed, 04 Nov 2026 23:45:38 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/my-gradient-clipping-was-never-clipping-it-was-secretly-multiplying-my-weight-decay-c9b</link>
      <guid>https://dev.to/b1ackjack12/my-gradient-clipping-was-never-clipping-it-was-secretly-multiplying-my-weight-decay-c9b</guid>
      <description>&lt;p&gt;&lt;a href="https://b1ackjack12.github.io/posts/lr-warmup-measured" rel="noopener noreferrer"&gt;Yesterday's experiment&lt;/a&gt; ended with a clean verdict: LR warmup is insurance — free at the tuned learning rate, a full payout at an overheated one. Gradient clipping has the exact same folklore job description. It's the other knob people ship "for stability," the one every training-loop template includes with &lt;code&gt;max_norm=1.0&lt;/code&gt; and no comment. If warmup and clipping are both insurance against early-training violence, they should produce the same 2x2 table. So: same harness, same seeds, Adam at lr 1e-3 and 3e-3, with and without &lt;code&gt;clip_grad_norm_(1.0)&lt;/code&gt;, plus an aggressive 0.3 arm, five paired seeds each.&lt;/p&gt;

&lt;h2&gt;
  
  
  The table that refused to rhyme
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;arm&lt;/th&gt;
&lt;th&gt;accuracy (5 seeds)&lt;/th&gt;
&lt;th&gt;paired Δ&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;th&gt;wins&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;lr 1e-3&lt;/td&gt;
&lt;td&gt;89.64 ±0.12&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 1e-3 + clip 1.0&lt;/td&gt;
&lt;td&gt;89.01 ±0.21&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.62&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−6.4&lt;/td&gt;
&lt;td&gt;0/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3&lt;/td&gt;
&lt;td&gt;86.98 ±0.34&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3 + clip 1.0&lt;/td&gt;
&lt;td&gt;83.55 ±1.05&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−3.43&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−10.6&lt;/td&gt;
&lt;td&gt;0/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3 + clip 0.3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;73.13 ±1.04&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−13.85&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−24.5&lt;/td&gt;
&lt;td&gt;0/5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Warmup's table, inverted on every row. At the tuned rate, where warmup was a harmless no-op, clipping charges a real tax: −0.62, zero wins in five, t of −6.4 — the clearest "this default is hurting you" number the audit series has produced. At the hot rate, where warmup recovered +2.86, clipping &lt;em&gt;deepens&lt;/em&gt; the hole by another −3.43. And tightening the threshold — which under the insurance theory should mean &lt;em&gt;more&lt;/em&gt; protection — detonates: −13.85, fifteen accuracy points below where this model lands with no stability aids at all. Whatever this knob is doing on my runs, it isn't the job in its job description.&lt;/p&gt;

&lt;h2&gt;
  
  
  There was never anything to clip
&lt;/h2&gt;

&lt;p&gt;So I instrumented it: a full unclipped run at each learning rate, logging the global gradient norm at every one of the 3,900 steps. The result dissolves the premise of the experiment. At lr 1e-3 the median norm is 2.01, the 10th percentile is 1.61, and the all-run maximum — the biggest "spike" ten epochs ever produced — is 6.74. The norms are boringly stable from epoch 0 (median 2.73) to epoch 9 (median 1.97). There are no explosions, no heavy tail, nothing resembling the RNN loss-cliff pathology this technique was invented for. Which means a threshold of 1.0 sits &lt;em&gt;below the signal&lt;/em&gt;, not above the noise: &lt;strong&gt;clip 1.0 engaged on 100.0% of steps. Clip 0.3, also 100%.&lt;/strong&gt; The fuse I installed wasn't a fuse — a fuse that's always blown is just a resistor. On this CNN, &lt;code&gt;clip_grad_norm_&lt;/code&gt; is a permanent gradient attenuator that rescales every single update, roughly halving them at threshold 1.0 and crushing them ~7x at 0.3.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvhch314gv8gypmv53dyv.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvhch314gv8gypmv53dyv.webp" alt="A storm rages outside the window while the fuse box absorbs the surge and the lamp burns steady over a sleeping cat" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That reframes the question but doesn't answer it, because Adam is famously &lt;em&gt;insensitive&lt;/em&gt; to uniformly rescaled gradients — the second-moment normalization divides the scale right back out. A constant 7x attenuation should cost little. Fifteen points is not little. Something in the update isn't being rescaled along with the gradient.&lt;/p&gt;

&lt;h2&gt;
  
  
  The decay term doesn't get clipped
&lt;/h2&gt;

&lt;p&gt;That something is weight decay. &lt;a href="https://b1ackjack12.github.io/posts/adam-weight-decay-dose-response" rel="noopener noreferrer"&gt;Last week's dose-response&lt;/a&gt; established exactly how Adam's &lt;em&gt;coupled&lt;/em&gt; decay works: &lt;code&gt;wd * w&lt;/code&gt; is added to the gradient inside the optimizer — &lt;em&gt;after&lt;/em&gt; my clipping call has already shrunk the loss gradient. Clip the gradient to a seventh of its natural size and the decay term keeps its full magnitude, so the &lt;em&gt;ratio&lt;/em&gt; of regularization to learning signal multiplies by ~7. My wd of 5e-4 effectively becomes ~3.5e-3 — and last week's table says 5e-3 is a cliff worth −2 points on its own, with the adaptive machinery amplifying from there. The clipping arms weren't measuring clipping. They were measuring an accidental weight-decay overdose, administered through a side door.&lt;/p&gt;

&lt;p&gt;That's a hypothesis with a cheap test: rerun the catastrophe arm (lr 3e-3, clip 0.3) with weight decay removed. Result: &lt;strong&gt;87.91&lt;/strong&gt; versus 73.13 — removing the regularizer &lt;em&gt;recovered 14.8 points&lt;/em&gt;, essentially the entire crater. The clipped-and-undecayed model even edges out the unclipped-but-decayed baseline (86.98), which is its own small curiosity (near-unit-norm gradients into Adam approach sign-SGD, apparently not a bad place at a hot rate) — but I'll leave that thread unpulled at two seeds. The verified claim is the one that matters: clipping's damage on this recipe routes overwhelmingly through its unclipped interaction with coupled weight decay, the third "two knobs sharing one trench coat" the audit series has caught after &lt;a href="https://b1ackjack12.github.io/posts/ema-decay-dose-response" rel="noopener noreferrer"&gt;EMA-decay-vs-schedule&lt;/a&gt; and &lt;a href="https://b1ackjack12.github.io/posts/adam-weight-decay-dose-response" rel="noopener noreferrer"&gt;Adam-vs-AdamW decay&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the config file: before you ship &lt;code&gt;clip_grad_norm_&lt;/code&gt;, spend one epoch logging &lt;code&gt;total_norm&lt;/code&gt; — it's returned by the clipping call itself, the diagnostic is literally free. If your threshold sits above a heavy tail that engages on 0.1% of steps, you have a fuse; keep it. If it sits below your median norm, you don't have a stability aid — you have a global gradient rescaler that quietly re-doses any coupled regularizer (AdamW's decoupled decay, note, is immune to this exact trap: it never rides the gradient). And if what you actually wanted was protection against a hot learning rate, yesterday's answer stands: warmup pays that claim in full and charges nothing. Scope: one CNN with BatchNorm, 10-epoch budget, Adam — on architectures whose gradients genuinely spike, clipping has earned its reputation honestly, and nothing here says otherwise. What's dishonest is the default: a threshold copied from a world with spikes into a model that never produces one.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/gradient-clipping-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>hyperparameters</category>
    </item>
    <item>
      <title>Warmup Did Nothing for My Learning Rate — Then It Fully Rescued the Wrong One</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Wed, 04 Nov 2026 23:45:22 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/warmup-did-nothing-for-my-learning-rate-then-it-fully-rescued-the-wrong-one-125n</link>
      <guid>https://dev.to/b1ackjack12/warmup-did-nothing-for-my-learning-rate-then-it-fully-rescued-the-wrong-one-125n</guid>
      <description>&lt;p&gt;Learning-rate warmup has the strangest status of any training-recipe fragment: universally shipped, rarely justified. It earned its reputation in transformer training, where skipping it genuinely detonates runs, and from there it diffused into every config file on the internet — including CNN recipes at small scale, where nobody seems to have asked whether it does anything. My own &lt;a href="https://b1ackjack12.github.io/posts/lr-schedule-face-off" rel="noopener noreferrer"&gt;schedule face-off&lt;/a&gt; never tested it; the &lt;a href="https://b1ackjack12.github.io/posts/adam-weight-decay-dose-response" rel="noopener noreferrer"&gt;dose-response series&lt;/a&gt; suggests the right question isn't "is warmup good?" but "under what condition does the knob engage?". So, a 2x2: Adam at the tuned lr 1e-3 and at an overheated 3e-3, each with and without one epoch of linear warmup, cosine after, five paired seeds each.&lt;/p&gt;

&lt;p&gt;The 3e-3 arm isn't arbitrary. Back in the &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget" rel="noopener noreferrer"&gt;optimizer face-off's screening&lt;/a&gt;, Adam at 3e-3 was one of the single-seed losers that got eliminated — a learning rate I &lt;em&gt;know&lt;/em&gt; is wrong for this recipe. That makes it the perfect test subject, because warmup's actual folklore claim isn't "adds accuracy"; it's "prevents early damage from a too-hot start." If that's true, warmup should do nothing where the rate is right and real work where it's wrong — a prediction with a measurable shape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nothing to insure, nothing gained. Something to insure, everything back
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;arm&lt;/th&gt;
&lt;th&gt;accuracy (5 seeds)&lt;/th&gt;
&lt;th&gt;paired comparison&lt;/th&gt;
&lt;th&gt;Δ&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;th&gt;wins&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;lr 1e-3&lt;/td&gt;
&lt;td&gt;89.71 ±0.15&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 1e-3 + warmup&lt;/td&gt;
&lt;td&gt;89.83 ±0.28&lt;/td&gt;
&lt;td&gt;vs lr 1e-3&lt;/td&gt;
&lt;td&gt;+0.12&lt;/td&gt;
&lt;td&gt;+0.8&lt;/td&gt;
&lt;td&gt;2/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3&lt;/td&gt;
&lt;td&gt;86.78 ±0.61&lt;/td&gt;
&lt;td&gt;vs lr 1e-3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−2.94&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−12.3&lt;/td&gt;
&lt;td&gt;0/5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3 + warmup&lt;/td&gt;
&lt;td&gt;89.64 ±0.30&lt;/td&gt;
&lt;td&gt;vs lr 3e-3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+2.86&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+12.0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5/5&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lr 3e-3 + warmup&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;vs lr 1e-3&lt;/td&gt;
&lt;td&gt;−0.08&lt;/td&gt;
&lt;td&gt;−0.5&lt;/td&gt;
&lt;td&gt;2/5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Row by row, the folklore's testable half comes out exactly true. At the tuned learning rate, warmup is statistical nothing: +0.12 with a t of 0.8 and two wins in five — the same verdict as every knob this blog has audited at a setting that was already right. At the overheated rate, warmup recovers +2.86 of the −2.94 the bad learning rate cost, five wins in five, t of twelve. And the final row is the one that defines what warmup &lt;em&gt;is&lt;/em&gt;: the rescued 3e-3 run lands within eight hundredths of the tuned baseline — statistically indistinguishable. Warmup didn't push past the ceiling; it returned the run &lt;em&gt;to&lt;/em&gt; the ceiling. An insurance payout makes you whole. It doesn't make you rich.&lt;/p&gt;

&lt;p&gt;The variance column tells the same story in a second voice. The hot rate didn't just lower the mean, it quadrupled the seed noise (±0.61 vs ±0.15) — the &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;lr-variance coupling&lt;/a&gt; this blog stumbled into back in September, reproducing right on schedule. Warmup pulled that back too (±0.30). Whatever early-training damage a hot Adam start inflicts, it's partly a lottery, and warmup cancels the lottery along with the mean loss.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg2xmp904if5fyql4ju69.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg2xmp904if5fyql4ju69.webp" alt="One runner stretching calmly by a bench at sunrise while another sprints straight out their front door mid-stumble, slipper flying" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What the mechanism has to look like
&lt;/h2&gt;

&lt;p&gt;One epoch of linear ramp means the model spends ~10% of its budget below full learning rate, and the cosine tail is one epoch shorter — yet the tuned arm paid nothing for it (+0.12, if anything). That asymmetry is the tell: whatever warmup protects against happens in the &lt;em&gt;first few hundred steps&lt;/em&gt;, when Adam's second-moment estimates are still garbage and a 3e-3 step through randomly-initialized BatchNorm statistics can push weights somewhere the remaining nine epochs can't fully undo. Start slow and those same steps are taken at harmless magnitudes while the optimizer's statistics settle. After that window closes, the two schedules are nearly identical — which is why the insurance costs nothing when it doesn't pay out.&lt;/p&gt;

&lt;p&gt;For the config file, the practical reading has two branches. If you tune your learning rate — and &lt;a href="https://b1ackjack12.github.io/posts/training-knob-effect-sizes" rel="noopener noreferrer"&gt;one knob's worth of tuning&lt;/a&gt; is the single highest-paying activity this blog has measured — warmup is a no-op you can keep or drop; it will neither help nor hurt beyond noise. If you &lt;em&gt;can't&lt;/em&gt; tune (new dataset, inherited recipe, budget for exactly one run), warmup is the cheapest robustness you can buy: it flattened a 3x learning-rate error into a rounding error, for zero cost at the correct setting. That's also, I suspect, the honest story of why transformers "need" it — their recipes run closer to the stability cliff by design, so the insurable event isn't a mistuned config, it's every run. Scope: one CNN, one dataset, 10-epoch budget, Adam only — and note the asymmetry of the claim: I measured warmup rescuing a &lt;em&gt;hot&lt;/em&gt; rate, not enabling rates above the tuned optimum. It caught a falling model; I have no evidence it lifts a healthy one.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/lr-warmup-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>hyperparameters</category>
    </item>
    <item>
      <title>I Slowed My IMU's Clock 4x and Accuracy Went Up</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Tue, 03 Nov 2026 01:25:53 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/i-slowed-my-imus-clock-4x-and-accuracy-went-up-4lpe</link>
      <guid>https://dev.to/b1ackjack12/i-slowed-my-imus-clock-4x-and-accuracy-went-up-4lpe</guid>
      <description>&lt;p&gt;&lt;a href="https://b1ackjack12.github.io/posts/har-window-length-measured" rel="noopener noreferrer"&gt;The window-length experiment&lt;/a&gt; ended with a clean dose-response: every halving of my HAR model's 2.56-second window cost accuracy, down to −0.87 points and a −1.98 collapse for the worst subject at 32 samples. But cutting the window short is only one of two ways to shrink an input. The other is to keep the full 2.56 seconds and sample them with a slower clock — the same stretch of walking, described by fewer, sparser measurements. For a wearable, that second knob is the interesting one: the sample rate drives the sensor's power draw, the radio bytes, and the model's FLOPs, and 50 Hz is simply what the dataset shipped with. Nobody chose it for the task.&lt;/p&gt;

&lt;p&gt;So: &lt;a href="https://b1ackjack12.github.io/posts/har-augmentation-fifty-splits" rel="noopener noreferrer"&gt;the usual harness&lt;/a&gt;, 50 paired subject splits, and the 50 Hz windows downsampled to 25, 12.5 and 6.25 Hz over the same time span. Each rate comes in two flavors, because downsampling has a right way and a lazy way — naive striding (&lt;code&gt;x[:, :, ::k]&lt;/code&gt;, just drop samples) versus proper decimation (low-pass filter first, then drop; &lt;code&gt;scipy.signal.decimate&lt;/code&gt;). The gap between those two flavors is itself a measurement, of how much aliasing actually hurts on real signals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Half the data is free. A quarter of it is a raise
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;rate&lt;/th&gt;
&lt;th&gt;samples&lt;/th&gt;
&lt;th&gt;flavor&lt;/th&gt;
&lt;th&gt;accuracy&lt;/th&gt;
&lt;th&gt;Δ vs 50 Hz&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;th&gt;worst subject Δ&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;50 Hz&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;92.66 ±2.75&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;25 Hz&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;naive&lt;/td&gt;
&lt;td&gt;92.75&lt;/td&gt;
&lt;td&gt;+0.09&lt;/td&gt;
&lt;td&gt;+1.6&lt;/td&gt;
&lt;td&gt;+0.32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;25 Hz&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;anti-aliased&lt;/td&gt;
&lt;td&gt;92.73&lt;/td&gt;
&lt;td&gt;+0.08&lt;/td&gt;
&lt;td&gt;+1.2&lt;/td&gt;
&lt;td&gt;+0.21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12.5 Hz&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;naive&lt;/td&gt;
&lt;td&gt;92.84&lt;/td&gt;
&lt;td&gt;+0.18&lt;/td&gt;
&lt;td&gt;+2.1&lt;/td&gt;
&lt;td&gt;+0.47&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;12.5 Hz&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;anti-aliased&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;93.12&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.47&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+4.3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+1.93&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6.25 Hz&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;naive&lt;/td&gt;
&lt;td&gt;92.37&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−0.29&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−2.8&lt;/td&gt;
&lt;td&gt;−0.69&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6.25 Hz&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;anti-aliased&lt;/td&gt;
&lt;td&gt;92.57&lt;/td&gt;
&lt;td&gt;−0.09&lt;/td&gt;
&lt;td&gt;−0.8&lt;/td&gt;
&lt;td&gt;−0.81&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three findings, in ascending order of surprise. First, 25 Hz is simply free: both flavors sit within noise of the baseline, so half the sample rate — half the bytes, half the conv-layer input — costs nothing. Second, at the bottom of the table, 6.25 Hz is where real information finally runs out, and &lt;em&gt;how&lt;/em&gt; you get there matters: naive striding loses a statistically solid −0.29 while the anti-aliased version turns that into a statistical nothing (−0.09, t = −0.8). That gap is textbook aliasing made visible — above-Nyquist energy folding back into the band as noise when you skip the low-pass filter.&lt;/p&gt;

&lt;p&gt;Third, and the reason this post exists: &lt;strong&gt;12.5 Hz with proper decimation beats the full-rate baseline.&lt;/strong&gt; Not "matches" — beats, +0.47 with a t of 4.3, 35 wins in 50 splits. And the gain concentrates exactly where this dataset hurts: the worst subject in each split improves by +1.93 on average, the same hardest-subjects margin that &lt;a href="https://b1ackjack12.github.io/posts/imu-rotation-angle-sweep" rel="noopener noreferrer"&gt;every augmentation experiment&lt;/a&gt; has been fighting for. A quarter of the data, same time span, better model — with the improvement delivered by the step everyone treats as a chore (the anti-aliasing filter), which at this rate doubles the naive flavor's gain (+0.47 vs +0.18).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiqn9c3ria1m3ykrzo1kt.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiqn9c3ria1m3ykrzo1kt.webp" alt="Three flipbooks of a runner: a thick one with smooth motion, a thinner one slightly choppy, and a sparse one where the pose jumps between pages" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The physics was on the label
&lt;/h2&gt;

&lt;p&gt;None of this is mysterious after the fact; it's Nyquist arithmetic. Human gait has its fundamental around 1–2 Hz with discriminative harmonics mostly below ~6 Hz — and the UCI pipeline even low-pass filtered everything at 20 Hz before windowing. Sampling at 12.5 Hz (Nyquist 6.25 Hz) still covers essentially the whole band that distinguishes walking from climbing stairs; 50 Hz was oversampling the activity by an order of magnitude. Push to 6.25 Hz (Nyquist ≈ 3 Hz) and you finally start clipping real harmonics, which is precisely where the table's first significant loss appears. The &lt;em&gt;improvement&lt;/em&gt; at 12.5 Hz plausibly stacks two effects I can't fully separate: the decimation filter throws away high-frequency sensor noise the activity never needed (a free denoiser), and the same fixed-size conv kernels now span 4x more of the gait cycle, seeing whole strides instead of fragments. Both point the same direction; I'll leave their shares unassigned.&lt;/p&gt;

&lt;p&gt;Put today's table next to the window post's and the contrast is the real lesson. Thirty-two samples as a &lt;em&gt;cropped&lt;/em&gt; window (0.64 s of context at 50 Hz): −0.87, worst subjects −1.98. The same thirty-two samples as a &lt;em&gt;decimated&lt;/em&gt; window (full 2.56 s at 12.5 Hz): +0.47, worst subjects +1.93. Identical input tensors, shape-wise — a four-point swing depending on whether those samples cover the whole gait cycle or a fragment of it. The model doesn't need a fast clock; it needs the full sentence, even if every word is shorter.&lt;/p&gt;

&lt;p&gt;For the config file: if you're shipping an IMU model, sweep the sample rate downward before you shrink anything else — my deployment numbers from the &lt;a href="https://b1ackjack12.github.io/posts/cpu-vs-gpu-serving-crossover" rel="noopener noreferrer"&gt;CPU serving post&lt;/a&gt; already showed this model class runs in 66 microseconds at batch 1, and a 4x shorter input only widens that margin while the &lt;em&gt;sensor&lt;/em&gt; (the actual battery cost on a wearable) does 4x less work. Just don't skip the low-pass filter: it's one &lt;code&gt;scipy.signal.decimate&lt;/code&gt; call at training time and a trivial IIR on-device, and it's the difference between a free lunch and a slow leak. Scope: one dataset whose signals were already cleanly filtered at capture, one small CNN, and subjects walking in a lab — a noisier consumer IMU may shift the cliff, which is an argument for running this same cheap sweep on your own data, not for trusting 50 Hz.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/imu-sampling-rate-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>iot</category>
      <category>sensors</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Weight Decay 0.05: Catastrophe in Adam, Optimum in AdamW</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Tue, 03 Nov 2026 01:25:37 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/weight-decay-005-catastrophe-in-adam-optimum-in-adamw-3lna</link>
      <guid>https://dev.to/b1ackjack12/weight-decay-005-catastrophe-in-adam-optimum-in-adamw-3lna</guid>
      <description>&lt;p&gt;Every recipe on this blog since &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget" rel="noopener noreferrer"&gt;the optimizer face-off&lt;/a&gt; has carried &lt;code&gt;weight_decay=5e-4&lt;/code&gt; — a number I originally picked for SGD because every CIFAR repo on the internet uses it, then ported to Adam when Adam won, with exactly zero measurement of whether it belongs there. That's the precise shape of inherited config this &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-dose-response" rel="noopener noreferrer"&gt;dose-response series&lt;/a&gt; exists to audit. So: Adam at four doses spanning 2.5 orders of magnitude plus a zero control, AdamW at the matching doses, five seeds each on the usual 10-epoch CIFAR ResNet18 — forty-five runs, with each optimizer's arms compared against its own wd=0 baseline on identical seeds.&lt;/p&gt;

&lt;p&gt;The reason to sweep &lt;em&gt;both&lt;/em&gt; optimizers is that "weight decay" is secretly two different mechanisms sharing a keyword argument. In Adam, the classic implementation adds &lt;code&gt;wd * w&lt;/code&gt; to the &lt;em&gt;gradient&lt;/em&gt;, which then flows through the adaptive machinery and gets divided by the running RMS of the gradients. In AdamW, the decay is decoupled — subtracted directly from the weights, scaled only by the learning rate, never touching the adaptive denominator. Same config key, different algorithms. The question a sweep can answer is whether that difference is pedantry or points.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two curves, two orders of magnitude apart
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;optimizer&lt;/th&gt;
&lt;th&gt;wd&lt;/th&gt;
&lt;th&gt;accuracy (5 seeds)&lt;/th&gt;
&lt;th&gt;Δ vs own wd=0&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Adam&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;89.32 ±0.29&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Adam&lt;/td&gt;
&lt;td&gt;1e-4&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;89.81 ±0.16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.49&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+3.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Adam&lt;/td&gt;
&lt;td&gt;5e-4&lt;/td&gt;
&lt;td&gt;89.77 ±0.33&lt;/td&gt;
&lt;td&gt;+0.46&lt;/td&gt;
&lt;td&gt;+3.4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Adam&lt;/td&gt;
&lt;td&gt;5e-3&lt;/td&gt;
&lt;td&gt;87.33 ±0.35&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−1.99&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−11.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Adam&lt;/td&gt;
&lt;td&gt;5e-2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64.97 ±5.39&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−24.34&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−10.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdamW&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;89.32 ±0.14&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdamW&lt;/td&gt;
&lt;td&gt;5e-4&lt;/td&gt;
&lt;td&gt;89.29 ±0.26&lt;/td&gt;
&lt;td&gt;−0.03&lt;/td&gt;
&lt;td&gt;−0.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdamW&lt;/td&gt;
&lt;td&gt;5e-3&lt;/td&gt;
&lt;td&gt;89.32 ±0.21&lt;/td&gt;
&lt;td&gt;+0.00&lt;/td&gt;
&lt;td&gt;+0.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdamW&lt;/td&gt;
&lt;td&gt;5e-2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;89.66 ±0.15&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.34&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;+3.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read Adam's column first: it's the &lt;a href="https://b1ackjack12.github.io/posts/ema-decay-dose-response" rel="noopener noreferrer"&gt;EMA-decay topology&lt;/a&gt; again — a shelf, a cliff, a crater. The benefit saturates at the smallest dose I tried (1e-4 already buys the full +0.49; 5e-4 adds nothing more), then 5e-3 falls off a cliff, and 5e-2 doesn't converge so much as thrash — 65% mean accuracy with a ±5.4 standard deviation, the largest variance any arm has posted on this blog. My inherited 5e-4, for once, sits safely mid-shelf; the audit acquits it.&lt;/p&gt;

&lt;p&gt;Now read AdamW's column, which is the same curve shifted right by roughly two orders of magnitude. At the doses where Adam does all its living and dying — 5e-4, 5e-3 — AdamW registers &lt;em&gt;nothing&lt;/em&gt;: deltas of −0.03 and +0.00, flat zeros. Its effect only begins at 5e-2, the exact dose that costs Adam twenty-four points. One number, two optimizers: catastrophe in one, optimum in the other. Copying a &lt;code&gt;weight_decay&lt;/code&gt; between Adam and AdamW isn't tuning, it's &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;copying a time constant between schedules&lt;/a&gt; — the same mistake this blog has now measured in its third costume.&lt;/p&gt;

&lt;p&gt;The ~100x shift even has a plausible size, not just a direction. Decoupled decay shrinks weights by &lt;code&gt;lr * wd&lt;/code&gt; per step — at lr 1e-3 and wd 5e-2, that's 5e-5 of each weight. Coupled decay rides the adaptive update, where the gradient (decay term included) gets divided by the running gradient RMS; if that RMS sits around 10⁻², the division inflates the decay's bite by roughly 100x, so Adam at wd 5e-4 lands at about the same effective shrinkage — 5e-5 — as AdamW at 5e-2. Two arms I measured as equally optimal, agreeing through arithmetic I didn't tune to make them agree. I'll flag it as consistency rather than proof (the RMS varies per weight and per epoch; that's the &lt;em&gt;point&lt;/em&gt; of the coupling being a bug), but the curves' alignment is hard to read any other way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fye6cp4vgqckt8vabztz3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fye6cp4vgqckt8vabztz3.webp" alt="Five identical plants watered with increasing doses: parched, healthy, thriving, drooping, and fully submerged" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The screening I owe a correction
&lt;/h2&gt;

&lt;p&gt;One row above is a confession. September's face-off chose AdamW's dose by single-seed screening, and that screening said 0.005 beat 0.05. Today's five-seed sweep says the opposite: 0.05 is better by +0.34 (t = 3.0), and 0.005 is indistinguishable from &lt;em&gt;no decay at all&lt;/em&gt;. The screening seed flipped a coin and I published the coin flip — exactly the failure mode the &lt;a href="https://b1ackjack12.github.io/posts/seed-noise-vs-real-improvements" rel="noopener noreferrer"&gt;seed-noise post&lt;/a&gt; warned about and &lt;a href="https://b1ackjack12.github.io/posts/pytorch-same-seed-different-model" rel="noopener noreferrer"&gt;the nondeterminism post&lt;/a&gt; explained, now caught in my own pipeline. For the record, the correction doesn't change the face-off's verdict: AdamW at its true best dose reaches 89.66, which still only ties Adam's 89.77–89.81 at this budget. Adam survives as the house optimizer; its challenger just deserved a fairer fight than one seed gave it.&lt;/p&gt;

&lt;p&gt;Config-file summary, in the series' usual shape. For Adam at lr 1e-3 on a run like mine: anything in 1e-4–5e-4 is on the shelf and the choice within it doesn't matter; 10x more is a cliff. For AdamW: the PyTorch default of 0.01 sits comfortably inside the active range (my 5e-2 arm is the shelf's measured edge in the good direction), and anything at Adam-ish magnitudes is a silent no-op — you think you're regularizing, and you're paying for nothing. And across optimizers: never port the number. Not because of superstition, but because the units differ — one is a gradient-space dose filtered through adaptive statistics, the other a direct fraction of the weights per step. The config key being spelled identically is the trap. Scope: one model, one dataset, one 10-epoch cosine budget, lr fixed at 1e-3 — wd and lr interact (decoupled decay scales &lt;em&gt;with&lt;/em&gt; lr), so these shelf locations travel only as far as the recipe does. The shape, I'd bet on; the x-axis, re-measure.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/adam-weight-decay-dose-response/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>hyperparameters</category>
    </item>
    <item>
      <title>EMA's Decay Isn't a Dial. It's a Plateau, a Cliff, and a 10%-Accuracy Crater</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Wed, 21 Oct 2026 23:43:08 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/emas-decay-isnt-a-dial-its-a-plateau-a-cliff-and-a-10-accuracy-crater-294</link>
      <guid>https://dev.to/b1ackjack12/emas-decay-isnt-a-dial-its-a-plateau-a-cliff-and-a-10-accuracy-crater-294</guid>
      <description>&lt;p&gt;&lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;September's EMA experiment&lt;/a&gt; measured exactly two decay values on the SGD recipe and left a dangling thread: 0.999 catastrophically bad, 0.99 cosmetically good, nothing in between and nothing beyond. Then the &lt;a href="https://b1ackjack12.github.io/posts/stacking-the-months-wins" rel="noopener noreferrer"&gt;stacking post&lt;/a&gt; carried decay 0.99 onto the Adam recipe without re-measuring it — an inherited number of precisely the kind this blog keeps catching in other people's configs. The fix is the same one that worked for &lt;a href="https://b1ackjack12.github.io/posts/label-smoothing-dose-response" rel="noopener noreferrer"&gt;label smoothing&lt;/a&gt;: stop defending a point and sweep the curve. Six decays — 0.9, 0.97, 0.99, 0.995, 0.999, 0.9999 — on the tuned Adam recipe, ten seeds.&lt;/p&gt;

&lt;p&gt;The instrument deserves a sentence, because it's the best part. EMA's audit trick from September scales: &lt;em&gt;all six&lt;/em&gt; shadows ride inside the same training run, updated from the same weight trajectory after every optimizer step. One run yields seven evaluations — raw plus six decays — so every comparison below is paired at the strongest possible level: same seed, same batches, same trajectory, different averaging window. The entire six-arm, ten-seed sweep cost ten training runs, about twenty-five minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  A shelf, then a cliff, then a crater
&lt;/h2&gt;

&lt;p&gt;Each decay's effective averaging window is roughly 1/(1−d) optimizer steps, against a total budget of 3,900 steps. That number turns out to be the only thing on the table that matters.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;decay&lt;/th&gt;
&lt;th&gt;window&lt;/th&gt;
&lt;th&gt;accuracy (10 seeds)&lt;/th&gt;
&lt;th&gt;paired delta vs raw&lt;/th&gt;
&lt;th&gt;t&lt;/th&gt;
&lt;th&gt;wins&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;raw weights&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;89.75 ±0.18&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.9&lt;/td&gt;
&lt;td&gt;~10 steps&lt;/td&gt;
&lt;td&gt;89.80&lt;/td&gt;
&lt;td&gt;+0.050&lt;/td&gt;
&lt;td&gt;+2.7&lt;/td&gt;
&lt;td&gt;8/10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.97&lt;/td&gt;
&lt;td&gt;~33&lt;/td&gt;
&lt;td&gt;89.86&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.109&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+3.6&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8/10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.99&lt;/td&gt;
&lt;td&gt;~100&lt;/td&gt;
&lt;td&gt;89.85&lt;/td&gt;
&lt;td&gt;+0.104&lt;/td&gt;
&lt;td&gt;+2.0&lt;/td&gt;
&lt;td&gt;8/10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.995&lt;/td&gt;
&lt;td&gt;~200&lt;/td&gt;
&lt;td&gt;89.83&lt;/td&gt;
&lt;td&gt;+0.080&lt;/td&gt;
&lt;td&gt;+1.4&lt;/td&gt;
&lt;td&gt;6/10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.999&lt;/td&gt;
&lt;td&gt;~1,000&lt;/td&gt;
&lt;td&gt;85.00&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;−4.75&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−18.4&lt;/td&gt;
&lt;td&gt;0/10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.9999&lt;/td&gt;
&lt;td&gt;~10,000&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;11.55&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;−78.2&lt;/td&gt;
&lt;td&gt;−159&lt;/td&gt;
&lt;td&gt;0/10&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read the top four rows first. Across a 20x range of window sizes — 10 steps to 200 — the paired deltas are +0.05 to +0.11, all within a whisker of each other. There is no optimum to find up here; it's a shelf. The agonizing-over-decimals question ("0.97 or 0.99 or 0.995?") that EMA discussions love is, on this recipe, worth at most six hundredths of a point, and the pairing is tight enough to say so with confidence: the best row (0.97, t = 3.6) is statistically real, but its advantage over its neighbors isn't. Any window that fits comfortably inside the cosine schedule's annealed tail buys the same small, genuine, cosmetic improvement — consistent with September's hypothesis that a schedule annealing to zero already delivers the endpoint pre-smoothed, leaving EMA little to do.&lt;/p&gt;

&lt;p&gt;Then the window crosses out of the tail and the curve stops being polite. At 1,000 steps — a quarter of the whole run — the shadow blends in weights from epochs where the learning rate was still high and the model measurably worse: −4.75, ten losses in ten. That's steeper than the −3.08 the same decay cost on &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget" rel="noopener noreferrer"&gt;the SGD recipe&lt;/a&gt;, so the cliff isn't an SGD quirk; if anything Adam's early trajectory is worse to remember. And at 10,000 steps the window is now 2.5x &lt;em&gt;longer than the entire training run&lt;/em&gt;, which means the shadow is approximately a uniform average over the whole trajectory — including the random initialization it started from. That model scores 11.55 ±1.55 percent on a 10-class problem. Not degraded: statistically indistinguishable from guessing. The same codebase, the same run, the same trick that earns +0.1 at decay 0.97 hands you a coin-flipper at 0.9999, four keystrokes away.&lt;/p&gt;

&lt;p&gt;One more diagnostic hiding in the deltas: their seed-to-seed standard deviation grows monotonically with the window — 0.06 at decay 0.9, 0.16 at 0.99, 0.18 at 0.995, 0.82 at 0.999. The longer the window, the more of the run's noisy history it drags into the final weights, so even &lt;em&gt;before&lt;/em&gt; the cliff you can see the averaging reaching back into territory that varies run by run. The shelf isn't just flat in the mean; it gets quietly riskier toward its edge.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpy8duhv8xl7i10jhu9s3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpy8duhv8xl7i10jhu9s3.webp" alt="A dog walker with six leashes of wildly different lengths: the short-leash dogs trot in step at the heel, while the dog on the longest leash is still far back down the path" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The knob is secretly binary
&lt;/h2&gt;

&lt;p&gt;The honest summary of this curve: EMA's decay is not a dial that trades off more-versus-less smoothing benefit. The benefit is a constant — about +0.1 on this recipe, take it or leave it — and the decay only decides whether you get that constant or walk off a cliff. A continuous hyperparameter with a binary outcome: &lt;em&gt;does the averaging window fit inside the schedule's converged tail, or doesn't it?&lt;/em&gt; Every value that fits pays the same; every value that doesn't is somewhere on the slope between −4.75 and −78.&lt;/p&gt;

&lt;p&gt;Which makes the config-file advice almost embarrassingly simple. Compute 1/(1−d), compare it to your total step count, and keep it in the low single-digit percents — for my 3,900-step runs anything from 0.9 to 0.995 is on the shelf, and I'll keep writing 0.99 since the &lt;a href="https://b1ackjack12.github.io/posts/stacking-the-months-wins" rel="noopener noreferrer"&gt;stacking recipe's&lt;/a&gt; choice turns out to have been safely mid-shelf all along. What you should &lt;em&gt;not&lt;/em&gt; do is copy a decay out of a repo that trains 100x longer, because the number doesn't carry — a lesson that is now measured twice, on two optimizers, with the second measurement steeper than the first. Scope as always: one model, one dataset, one 10-epoch budget, and the shelf's height (+0.1) is specific to short cosine schedules — on constant LR or longer runs EMA has real work to do and the curve's left half will look different. The cliff's location, though, is arithmetic, and arithmetic travels.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/ema-decay-dose-response/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>hyperparameters</category>
    </item>
    <item>
      <title>One Horizontal Flip at Test Time Beat Every Training Trick I've Measured</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Tue, 20 Oct 2026 02:26:43 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/one-horizontal-flip-at-test-time-beat-every-training-trick-ive-measured-44ba</link>
      <guid>https://dev.to/b1ackjack12/one-horizontal-flip-at-test-time-beat-every-training-trick-ive-measured-44ba</guid>
      <description>&lt;p&gt;Test-time augmentation has a reputation problem: it's the trick Kaggle winners confess to in the last paragraph, the thing production engineers wave off as leaderboard cosmetics. The idea is almost embarrassingly simple — run inference on several transformed copies of the input, average the probabilities — and because it multiplies serving cost, most advice online rounds it down to "not worth it in the real world" without a number attached. After a month of measuring training tricks whose true effects turned out to be &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;+0.08&lt;/a&gt;, &lt;a href="https://b1ackjack12.github.io/posts/seed-noise-vs-real-improvements" rel="noopener noreferrer"&gt;+0.14&lt;/a&gt;, or &lt;a href="https://b1ackjack12.github.io/posts/har-augmentation-fifty-splits" rel="noopener noreferrer"&gt;zero&lt;/a&gt;, I wanted TTA on the same scale. Ten seeds of the usual tuned CIFAR ResNet18 recipe, each model evaluated four ways — plain, mirror-flip averaging, five 2-pixel shifts, and shifts-plus-flips — with every comparison paired within run, plus clean warmed-up GPU timings for the actual price tag.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Update (2026-10-22):&lt;/strong&gt; the cost column below is the &lt;em&gt;worst case&lt;/em&gt; — these timings run each view as a separate forward pass at a saturating batch size. A good question about batching the views together prompted &lt;a href="https://b1ackjack12.github.io/posts/tta-serving-price-measured/" rel="noopener noreferrer"&gt;a full repricing&lt;/a&gt;: with views concatenated into one batch, flip TTA costs ~1.0–1.4x at small serving batches, and the full 10-view set drops to 1.08x at batch 1. The accuracy numbers here are unaffected.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The table that made me sit up
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;view set&lt;/th&gt;
&lt;th&gt;views&lt;/th&gt;
&lt;th&gt;paired delta vs plain&lt;/th&gt;
&lt;th&gt;wins&lt;/th&gt;
&lt;th&gt;inference cost (512 imgs)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;plain&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;24.8 ms (1.0x)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;+ horizontal flip&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.56 (t = 11.5)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10/10&lt;/td&gt;
&lt;td&gt;49.5 ms (2.0x)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 shifts&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;+0.27 (t = 7.3)&lt;/td&gt;
&lt;td&gt;10/10&lt;/td&gt;
&lt;td&gt;123.9 ms (5.0x)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 shifts × flips&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;+0.71 (t = 19.9)&lt;/td&gt;
&lt;td&gt;10/10&lt;/td&gt;
&lt;td&gt;247.6 ms (10.0x)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Baseline 89.00 ±0.15 across seeds. For calibration: this blog's whole training-side campaign — EMA sweeps, label smoothing, augmentation tournaments — has been fighting over effects between +0.08 and +0.36, most of them needing ten-plus seeds and paired statistics just to be visible at all. &lt;strong&gt;Averaging each prediction with its mirror image gained +0.56, won in ten runs out of ten, and required changing nothing about training whatsoever.&lt;/strong&gt; No schedule, no optimizer, no data pipeline — four lines in the eval loop. It is, by a factor of roughly seven over EMA, the largest reliable accuracy gain this hardware has produced, and the paired standard deviation of 0.15 means it isn't remotely close to the noise floor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The views are not equal, and the ordering is telling
&lt;/h2&gt;

&lt;p&gt;The naive model of TTA — more views, more better — dies in row three. Four extra translation views bought +0.27 in total; one extra flip view bought +0.56. &lt;strong&gt;A single flip is worth more than four shifts combined&lt;/strong&gt;, per-view a difference of nearly an order of magnitude. And the reason is visible from the training config: the model trained with &lt;code&gt;RandomHorizontalFlip&lt;/code&gt;, so left-right mirroring is a symmetry the data genuinely has and the model was explicitly taught to respect — averaging over it cancels the model's residual asymmetry almost for free. Two-pixel translations are a weaker, blurrier invariance; the views mostly agree with the original and contribute mostly redundancy. The combined ten-view set confirms the diminishing returns: going from 2 views to 10 quintuples the compute and adds just +0.15 on top of the flip. TTA is not a volume business. Pick the transformations that match your data's true symmetries — which in practice means the ones in your training augmentation — and stop.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F11is6atld9r47wuznu5q.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F11is6atld9r47wuznu5q.webp" alt="A hall of mirrors where one true mirror reveals a clear second view of a figure, while a row of slightly-shifted funhouse mirrors just show blurry near-duplicates" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  So why doesn't everyone ship it?
&lt;/h2&gt;

&lt;p&gt;Because of &lt;em&gt;where&lt;/em&gt; the bill arrives. A training trick costs once, on your GPU, before deployment; TTA costs at serving time, on every request, forever — the 2.0x in the table is exactly the throughput cut your serving fleet takes, with none of the muddiness of &lt;a href="https://b1ackjack12.github.io/posts/gpu-inference-batching-measured" rel="noopener noreferrer"&gt;the batching curves&lt;/a&gt; to hide behind (the timing scaled exactly with view count, 2.0x/5.0x/10.0x, no fixed overhead to amortize). Whether that trade is good depends entirely on which side of the meter you live on. If your model serves millions of requests a day at tight latency, +0.56 for double the fleet is probably a bad deal. If you run batch evaluation, offline scoring, medical or safety-critical inference where accuracy is the whole point — half-price throughput for the biggest single gain I've measured is a bargain, and you can have it this afternoon.&lt;/p&gt;

&lt;p&gt;The scope line, as always: one dataset, one small model, 32×32 images where a 2-pixel shift is proportionally large; flip-TTA only makes sense for data with genuine mirror symmetry (photos yes, digits and text no — a mirrored "3" is not a "3"). But the meta-lesson travels: the cheapest accuracy on the menu wasn't in the training loop, where I'd spent a month digging for scraps with paired t-tests. It was sitting in the eval loop, dismissed as a competition hack, waiting for someone to actually price it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/test-time-augmentation-measured/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>computervision</category>
    </item>
    <item>
      <title>The GPU Has a 0.8 ms Floor, and My Sensor Model Lives Under It</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Mon, 19 Oct 2026 05:14:23 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/the-gpu-has-a-08-ms-floor-and-my-sensor-model-lives-under-it-32p3</link>
      <guid>https://dev.to/b1ackjack12/the-gpu-has-a-08-ms-floor-and-my-sensor-model-lives-under-it-32p3</guid>
      <description>&lt;p&gt;I've measured &lt;a href="https://b1ackjack12.github.io/posts/cpu-inference-threading-measured" rel="noopener noreferrer"&gt;CPU serving&lt;/a&gt; and &lt;a href="https://b1ackjack12.github.io/posts/gpu-inference-batching-measured" rel="noopener noreferrer"&gt;GPU batching&lt;/a&gt; in separate posts, which quietly dodged the question that actually decides a deployment: &lt;em&gt;for this specific model, do I need a GPU at all?&lt;/em&gt; The folk answer is "GPU is faster, CPU is cheaper," which treats speed as a property of the hardware. It isn't — it's a property of the pairing. So, the head-to-head: four models spanning my whole zoo (the 0.1M-parameter HAR CNN, the 1.15M SmallResNet, ResNet18, ResNet50), each served both ways — CPU via ONNX Runtime at default settings, GPU via PyTorch fp16 &lt;em&gt;including&lt;/em&gt; the host-to-device copy from pinned memory, because your production inputs don't start life on the GPU — at batch sizes 1, 16 and 128.&lt;/p&gt;

&lt;h2&gt;
  
  
  The table with a diagonal line through it
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;model&lt;/th&gt;
&lt;th&gt;batch 1&lt;/th&gt;
&lt;th&gt;batch 16&lt;/th&gt;
&lt;th&gt;batch 128&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HAR CNN (0.1M)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;CPU wins 11.7x&lt;/strong&gt; (0.066 vs 0.77 ms)&lt;/td&gt;
&lt;td&gt;GPU 1.3x&lt;/td&gt;
&lt;td&gt;GPU 8.8x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SmallResNet (1.15M)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;CPU wins 1.6x&lt;/strong&gt; (0.57 vs 0.91 ms)&lt;/td&gt;
&lt;td&gt;GPU 8.9x&lt;/td&gt;
&lt;td&gt;GPU 61.8x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ResNet18 (11M)&lt;/td&gt;
&lt;td&gt;GPU 2.5x&lt;/td&gt;
&lt;td&gt;GPU 39.5x&lt;/td&gt;
&lt;td&gt;GPU 51.5x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ResNet50 (24M)&lt;/td&gt;
&lt;td&gt;GPU 2.4x&lt;/td&gt;
&lt;td&gt;GPU 39.3x&lt;/td&gt;
&lt;td&gt;GPU 38.8x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read the batch-1 GPU column of the two small models: 0.77 ms and 0.91 ms — nearly the same number for models that differ 10x in size. That's the tell. At this scale the GPU isn't computing; it's &lt;em&gt;administrating&lt;/em&gt; — kernel launches, the H2D copy, synchronization — and that overhead has a floor around &lt;strong&gt;0.8 ms on my machine&lt;/strong&gt; that exists regardless of how little work follows it. The HAR model's entire forward pass costs 0.066 ms on a CPU, so the GPU loses by an order of magnitude before its first kernel finishes queuing; &lt;a href="https://b1ackjack12.github.io/posts/ort-graph-optimization-levels" rel="noopener noreferrer"&gt;quantize the model to int8&lt;/a&gt; and CPU's margin stretches to nearly 30x. The rule this table teaches is pleasantly mechanical: &lt;strong&gt;measure your model's CPU batch-1 latency, and if it's under the GPU's overhead floor, the GPU cannot win that workload&lt;/strong&gt; — not with more money, not with a better card, because you'd be paying to accelerate the part that was never the bottleneck.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgblwbqaj1yvxmht8ldrw.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgblwbqaj1yvxmht8ldrw.webp" alt="A tiny package being loaded onto a massive cargo freighter whose loading crane takes longer than a bicycle courier who has already delivered it" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  One batch dimension changes the winner everywhere
&lt;/h2&gt;

&lt;p&gt;The same HAR model that humiliated the GPU at batch 1 loses at batch 16 and loses 8.8x at batch 128 — and notice &lt;em&gt;how&lt;/em&gt; the GPU wins: its latency barely moves (0.77 → 0.54 → 0.61 ms) while CPU time grows linearly with work. The GPU's overhead floor doesn't shrink; it &lt;em&gt;amortizes&lt;/em&gt;. Feed it 128 inputs and the fixed cost divides by 128 while the compute — the thing GPUs are actually good at — finally dominates. SmallResNet makes the same point louder: a 62x GPU win at batch 128, from a model that CPU served faster at batch 1. There is no such thing as "this model is faster on GPU"; there is only "this model &lt;em&gt;at this batch size&lt;/em&gt; is faster on GPU," and the flip can happen between batch 1 and batch 16.&lt;/p&gt;

&lt;p&gt;Which turns the deployment question into a question about your &lt;em&gt;traffic&lt;/em&gt;, not your model. Online serving of single sensor windows — the natural shape of an IMU product, one prediction per device per moment — is a batch-1 workload, and for my HAR model the correct hardware is the CPU it's already running on: faster, simpler, no CUDA driver in the container, no GPU instance on the bill. Offline scoring, backfills, or anything where requests can pool for even a few milliseconds is a batched workload, and there the GPU is worth 9–62x even for tiny models. The &lt;a href="https://b1ackjack12.github.io/posts/cpu-inference-threading-measured" rel="noopener noreferrer"&gt;threading post's&lt;/a&gt; concurrency results compose with this: a fleet of single-threaded CPU sessions is the batch-1 answer, dynamic batching onto a GPU is the throughput answer, and the worst configuration in the whole space is the default one — a big model on CPU (ResNet50 at batch 128: 1.7 &lt;em&gt;seconds&lt;/em&gt; per batch) or a tiny model on GPU, each paying for the other's hardware. Scope: one desktop CPU, one consumer GPU, PyTorch eager fp16 rather than TensorRT — a serving-optimized runtime would lower the GPU floor somewhat, but it can't repeal it, and under it my smallest model comfortably lives.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/cpu-vs-gpu-serving-crossover/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>mlops</category>
      <category>onnx</category>
      <category>performance</category>
    </item>
    <item>
      <title>The One Knob I Never Swept Was the Optimizer. Adam Beat My Tuned SGD by 0.7</title>
      <dc:creator>b1ackjack12</dc:creator>
      <pubDate>Fri, 16 Oct 2026 00:02:27 +0000</pubDate>
      <link>https://dev.to/b1ackjack12/the-one-knob-i-never-swept-was-the-optimizer-adam-beat-my-tuned-sgd-by-07-1gep</link>
      <guid>https://dev.to/b1ackjack12/the-one-knob-i-never-swept-was-the-optimizer-adam-beat-my-tuned-sgd-by-07-1gep</guid>
      <description>&lt;p&gt;When I ranked &lt;a href="https://b1ackjack12.github.io/posts/training-knob-effect-sizes" rel="noopener noreferrer"&gt;training knobs by effect size&lt;/a&gt;, I swept the learning rate, the weight decay, the batch size and the augmentation — and never once questioned the &lt;code&gt;torch.optim.SGD&lt;/code&gt; at the top of the file. That wasn't a decision; it was a reflex backed by the most durable folklore in deep learning: &lt;em&gt;SGD generalizes better than Adam for convnets&lt;/em&gt;. Every baseline this blog has produced — the &lt;a href="https://b1ackjack12.github.io/posts/seed-noise-vs-real-improvements" rel="noopener noreferrer"&gt;seed-noise study&lt;/a&gt;, the &lt;a href="https://b1ackjack12.github.io/posts/ema-weights-measured" rel="noopener noreferrer"&gt;EMA sweep&lt;/a&gt;, the &lt;a href="https://b1ackjack12.github.io/posts/early-stopping-checkpoint-selection-measured" rel="noopener noreferrer"&gt;early-stopping autopsy&lt;/a&gt; — sits on that reflex. So, a fair fight at my standard fixed budget (CIFAR-10 ResNet18, 10 epochs, cosine): each optimizer family gets a one-seed screening grid over its own learning rates and weight decays, the winner of each grid advances to a five-seed final. No optimizer gets my SGD-tuned hyperparameters imposed on it — that's how these comparisons usually get rigged, in either direction.&lt;/p&gt;

&lt;h2&gt;
  
  
  The final
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;optimizer (tuned)&lt;/th&gt;
&lt;th&gt;test accuracy (5 seeds)&lt;/th&gt;
&lt;th&gt;vs SGD&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SGD, lr 0.05, wd 5e-4&lt;/td&gt;
&lt;td&gt;88.95 ±0.31&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Adam, lr 1e-3, wd 5e-4 (coupled L2)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;89.66 ±0.14&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+0.71&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AdamW, lr 1e-3, wd 0.005&lt;/td&gt;
&lt;td&gt;89.18 ±0.16&lt;/td&gt;
&lt;td&gt;+0.23&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Adam wins by +0.71 — nearly five standard errors of the difference (t ≈ 4.7), larger than every training-side effect I've measured this month, and it comes with a bonus I didn't expect: &lt;strong&gt;less than half the seed variance&lt;/strong&gt; (±0.14 against SGD's ±0.31). The optimizer I never swept was worth nine EMAs. For a blog whose founding sin was &lt;a href="https://b1ackjack12.github.io/posts/batch-512-textbook-fixes-measured" rel="noopener noreferrer"&gt;publishing untested defaults&lt;/a&gt;, there's something fitting about discovering that the deepest default of all — the one below the hyperparameters, the thing the hyperparameters belong &lt;em&gt;to&lt;/em&gt; — was costing seven-tenths of a point the whole time.&lt;/p&gt;

&lt;p&gt;But the folklore isn't wrong so much as &lt;em&gt;scoped&lt;/em&gt;: "SGD generalizes better" comes from the 100-to-200-epoch regime where SGD's noisier trajectory has time to pay off. At 10 epochs, the race is mostly about how fast you can descend, and adaptive per-parameter step sizes are simply better at descending. My result doesn't overturn the long-schedule claim — it bounds it. Optimizer advice without a schedule attached is as incomplete as &lt;a href="https://b1ackjack12.github.io/posts/batch-512-textbook-fixes-measured" rel="noopener noreferrer"&gt;LR-scaling advice without one&lt;/a&gt;, and short fine-tuning-length budgets are where most practical training now happens.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0nq85e2l21gqc40c2ha3.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0nq85e2l21gqc40c2ha3.webp" alt="Two racers on a short track: a steady long-distance runner built for marathons losing to a sprinter perfectly geared for the distance actually being run" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Two footnotes that earn their keep
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Plain Adam beat AdamW.&lt;/strong&gt; The modern reflex says always AdamW — decoupled weight decay is &lt;em&gt;correct&lt;/em&gt;, coupled L2 in Adam is a known theoretical wart. My tuned AdamW finals at 89.18 against plain Adam's 89.66: the theoretically wrong optimizer won by half a point. I screened AdamW at wd 0.05 and 0.005 (89.50 and 89.70 on the screening seed) so it wasn't sabotaged by an untuned decay; the coupled variant just worked better on this short schedule and small dataset. Theoretical cleanliness and empirical performance are, once again, separate axes. Also worth knowing: Adam's learning-rate cliff is real and close — at lr 3e-3 it scored 87.67, worse than everything in the table, so its lead lives inside a narrower LR window than SGD's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The screening flattered the winner.&lt;/strong&gt; Adam's screening run scored 90.02; the identical config and seed in the finals scored 89.70. Same seed, same code, same GPU — a 0.32 gap, courtesy of &lt;a href="https://b1ackjack12.github.io/posts/pytorch-same-seed-different-model" rel="noopener noreferrer"&gt;the GPU non-determinism I measured in July&lt;/a&gt;. One-seed screening numbers are for &lt;em&gt;choosing&lt;/em&gt; configs, never for &lt;em&gt;reporting&lt;/em&gt; them; if I'd quoted the screen, a third of Adam's headline margin would have been atomics and floating-point reassociation. Scope line: one dataset, one small model, one short budget — flip any of those and the ranking may flip with it, which is precisely the point. The optimizer is a hyperparameter. Sweep it like one.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://b1ackjack12.github.io/posts/sgd-vs-adam-fixed-budget/" rel="noopener noreferrer"&gt;b1ackjack12.github.io&lt;/a&gt; — an AI tech blog where every claim comes with a measurement. More experiments like this one live there.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>pytorch</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
