<?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: Dazhi Wang</title>
    <description>The latest articles on DEV Community by Dazhi Wang (@kingcavan1988).</description>
    <link>https://dev.to/kingcavan1988</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%2F4111453%2Fdbad591a-c970-425f-8415-8d33ae6712d5.png</url>
      <title>DEV Community: Dazhi Wang</title>
      <link>https://dev.to/kingcavan1988</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kingcavan1988"/>
    <language>en</language>
    <item>
      <title>What breaks when you ship 21 AI tools that never touch a server</title>
      <dc:creator>Dazhi Wang</dc:creator>
      <pubDate>Sun, 06 Sep 2026 02:20:11 +0000</pubDate>
      <link>https://dev.to/kingcavan1988/what-breaks-when-you-ship-21-ai-tools-that-never-touch-a-server-3go4</link>
      <guid>https://dev.to/kingcavan1988/what-breaks-when-you-ship-21-ai-tools-that-never-touch-a-server-3go4</guid>
      <description>&lt;p&gt;We ship 21 AI-powered tools on &lt;a href="https://freetoolhub.org" rel="noopener noreferrer"&gt;FreeToolHub&lt;/a&gt; — email and report writers, resume rewriters, background removal, image upscaling, audio transcription, LaTeX OCR, translation, contract analysis. None of them have a backend. No API keys, no upload endpoint, no inference server. The model downloads to your browser and runs there; your text and files never leave the device.&lt;/p&gt;

&lt;p&gt;That was a product decision (privacy is the pitch) but it turned into a year of hitting every sharp edge WebML has. This is the honest version — including the tool we had to kill.&lt;/p&gt;

&lt;h2&gt;
  
  
  The stack, briefly
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://huggingface.co/docs/transformers.js" rel="noopener noreferrer"&gt;&lt;code&gt;@huggingface/transformers&lt;/code&gt;&lt;/a&gt; (transformers.js) 4.2.0 on top of &lt;code&gt;onnxruntime-web&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;WebGPU where available, WASM as the fallback — the same model can ship two quantizations for the two backends&lt;/li&gt;
&lt;li&gt;One TypeScript registry as the single source of truth for all 18 models: HF repo, dtype, backend, download size, min device memory, and which tools use it. If a model ID appears anywhere else, we treat it as a bug.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A taste of what that registry looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;smollm2-1.7b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;sources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;hfRepo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HuggingFaceTB/SmolLM2-1.7B-Instruct&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;q4f16&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;webgpu&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;downloadSizeMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;900&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;hfRepo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;HuggingFaceTB/SmolLM2-1.7B-Instruct&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;q4&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wasm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="na"&gt;downloadSizeMB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1400&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="nx"&gt;minMemory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2048&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;loadTimeoutMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;usedBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/ai-email-writer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/ai-resume-rewriter&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/fine-print-decoder&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="cm"&gt;/* +13 more */&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the part the README doesn't tell you.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. SharedArrayBuffer, or: how COEP almost ate our ad revenue
&lt;/h2&gt;

&lt;p&gt;Several models need threading, which needs &lt;code&gt;SharedArrayBuffer&lt;/code&gt;, which needs the page to be cross-origin isolated. The textbook fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;require-corp&lt;/code&gt; means every cross-origin subresource must opt in with CORP or CORS headers. Sounds reasonable until you remember what a real page loads: an ad network, a consent-management script, an analytics beacon, image CDNs. None of them send &lt;code&gt;Cross-Origin-Resource-Policy&lt;/code&gt; — so &lt;code&gt;require-corp&lt;/code&gt; silently breaks all of them. On a free-tool site, that's not a rounding error, that's the business model.&lt;/p&gt;

&lt;p&gt;The escape hatch nobody mentions enough:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cross-Origin-Embedder-Policy: credentialless
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;credentialless&lt;/code&gt; gives you cross-origin isolation (and therefore &lt;code&gt;SharedArrayBuffer&lt;/code&gt;) without requiring every third-party resource to opt in — the browser just strips credentials from cross-origin requests instead of blocking them. No-cors subresources still load. Ads still serve. Workers still thread.&lt;/p&gt;

&lt;p&gt;Cost to know about: &lt;code&gt;fetch()&lt;/code&gt; of cross-origin resources that &lt;em&gt;do&lt;/em&gt; need cookies won't send them. Our model downloads come from HuggingFace and a fallback CDN with no cookies involved, so we don't care. If your pipeline needs credentialed cross-origin fetches, this will bite you.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The download is the product
&lt;/h2&gt;

&lt;p&gt;The number one UX problem isn't inference speed, it's that a 1.7B LLM is 900 MB at q4f16 and 1.4 GB at q4. Things that actually moved the needle:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two quantizations per model&lt;/strong&gt;, chosen by backend: q4f16 for WebGPU (smaller &lt;em&gt;and&lt;/em&gt; faster), q4 for WASM where fp16 ops are the bottleneck. Picking one size for both backends is leaving a third of your users behind.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A genuinely small sibling.&lt;/strong&gt; SmolLM2-360M (200 MB) handles rewrites, captions and short generation fine. For users on a phone over LTE, "good enough in 30 seconds" beats "great in 4 minutes."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aggressive caching in IndexedDB&lt;/strong&gt; with versioned keys, so the download happens once per model version — and bumping a model version intentionally invalidates it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A 10-minute load timeout and honest progress UI.&lt;/strong&gt; A model download that silently stalls at 87% reads as "this site is broken." A progress bar with the MB count reads as "I'm waiting for a download."&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. onnxruntime-web version hell, concretely
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;transformers.js&lt;/code&gt; pins its own &lt;code&gt;onnxruntime-web&lt;/code&gt;. If your app also imports &lt;code&gt;onnxruntime-web&lt;/code&gt; directly (we do, for custom ONNX pipelines that don't go through transformers.js), npm will happily give you &lt;strong&gt;two different ORT versions in one bundle&lt;/strong&gt;, and they fight over the WASM glue.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;package.json&lt;/code&gt; ended up looking like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"onnxruntime-web"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.21.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"@huggingface/transformers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"^4.2.0"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nl"&gt;"overrides"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"@huggingface/transformers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"onnxruntime-web"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.25.1"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, that's two ORT versions on purpose. The general lesson: when a JS lib ships WASM artifacts, the &lt;em&gt;binary&lt;/em&gt; version and the &lt;em&gt;npm&lt;/em&gt; version are only loosely coupled, and every loader that fetches &lt;code&gt;.wasm&lt;/code&gt; at runtime is a chance to mix them.&lt;/p&gt;

&lt;p&gt;That bit us a second time with &lt;code&gt;@imgly/background-removal&lt;/code&gt;, which fetches its WASM and glue &lt;code&gt;.mjs&lt;/code&gt; from its own CDN at runtime. A CDN-side update changed the artifact version out from under us and inference just… hung. The fix was to stop trusting the runtime fetch: at build time we copy the exact &lt;code&gt;ort-wasm-simd-threaded*.wasm&lt;/code&gt; / &lt;code&gt;.mjs&lt;/code&gt; files from our installed &lt;code&gt;node_modules/onnxruntime-web&lt;/code&gt; into &lt;code&gt;public/&lt;/code&gt;, so the versions can never drift.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. What we killed: small models and structured output
&lt;/h2&gt;

&lt;p&gt;The most valuable engineering lesson cost us a whole tool. We built an AI presentation generator: describe your deck, get slide JSON, render it. SmolLM2-1.7B is genuinely good at prose. It is &lt;em&gt;not&lt;/em&gt; reliably good at emitting valid, well-formed JSON that matches a schema, every time, without a server-side retry loop.&lt;/p&gt;

&lt;p&gt;On a server you'd wrap the model with constrained decoding or a validation-repair loop and hide the failures. In the browser, every retry is another user-visible spin of a model that's already been loading for two minutes. Failure rates that would be invisible behind an API became the whole UX.&lt;/p&gt;

&lt;p&gt;We pulled it. The current rule: &lt;strong&gt;browser-only features must degrade to "the model said something imperfect", not "the product returned garbage."&lt;/strong&gt; Prose, rewrites, summarization, extraction — fine. Rigid structured output — wait until constrained decoding is realistic in-browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The 1.7B class is a &lt;em&gt;drafting&lt;/em&gt; assistant, not a GPT-class one. We say so on the tool pages.&lt;/li&gt;
&lt;li&gt;First-load cost is real. Repeat visits are near-instant (cached), but your landing page has to convince someone to download 200–900 MB of model, so the tools better be the point.&lt;/li&gt;
&lt;li&gt;WebGPU support is still uneven; the WASM fallback keeps every tool working, but it's noticeably slower and heavier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Would we do it again? Yes — zero marginal inference cost, no data leaving the device, and no per-user API bill that scales with success. But budget for the packaging work: headers, caching, quantization matrix, and version pinning are the actual product.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Try the tools without installing anything: &lt;a href="https://freetoolhub.org/ai-workspace/" rel="noopener noreferrer"&gt;freetoolhub.org/ai-workspace&lt;/a&gt; — everything runs on your device, and the DevTools network tab is the proof.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ai</category>
      <category>webgpu</category>
    </item>
  </channel>
</rss>
