Choosing Models for In-Browser AI

Choosing Models for In-Browser AI

Task first, model second. How to shortlist browser-runnable models: task models versus small LLMs, the size-quality-latency-memory quadrangle, sourcing, and the license gate.

Client-side model selection is a task-first discipline: define the task's shape before browsing any model list, prefer a small task-specific model over a general LLM whenever the job allows it, and treat size, quantization, sourcing, and license as selection variables rather than integration surprises. The output is not a single anointed winner but a shortlist of two or three candidates with their trade-offs made explicit — which your task evaluation then proves.

Task first, model second

A costly mistake in client-side model selection happens before any download: browsing a model hub for something impressive instead of defining the job. The selection order that prevents that waste is rigid. First state the task's shape — classify, extract, embed, transcribe, describe an image, or generate short text. The shape largely decides the model family, and the family decides everything downstream about size, memory, and delivery.

Task-specific models are the browser's home turf. A small embedding model, a text classifier, or a compact speech model can be measured in tens to low hundreds of megabytes — all-MiniLM-L6-v2's ONNX files on the Hugging Face hub run from about 23 MB to 90 MB (as of November 2026) — although a large multilingual embedding model such as bge-m3 runs from roughly 570 MB to 2.3 GB. A model of this kind can run on modest hardware and can outperform a general language model at its one job. When the task is "does this comment need moderation review" or "which of these documents resemble each other," a small dedicated model is not merely the budget option — it can be the better tool.

A small instruct LLM earns its place only when the task genuinely needs open-ended text handling: drafting, rewriting, answering in prose. The reflex of reaching for a chat-shaped model by default is a selection error to watch for, and it imports every hard problem within this topic — gigabyte-scale delivery, growing memory, quality guardrails — into features that never needed generation at all.

One honesty note applies across the generation gradient, offered as a working hypothesis, not a documented rule: the smaller the model, the narrower the instructions it follows reliably. Selection is therefore about matching narrowness to the task, not maximizing capability on a benchmark. A model that follows one tightly-scoped instruction well is a better ship than one that half-follows ten.

The size, quality, latency, and memory quadrangle

Four axes move together in every candidate, and reading them as a set is what makes a shortlist honest. Parameter count and quantization set the download size. Download size sets the first-run cost every new user pays. Resident size sets memory pressure on the device for as long as the feature lives. And all three trade against output quality — not necessarily linearly or identically across tasks.

The practical bands, as of November 2026, look like this — treat every number as dated, not timeless:

Model classTypical delivered sizeWhere it runs comfortablyHonest quality note
Embedding and classification modelsTens to low hundreds of MB for small models; roughly 570 MB to 2.3 GB for a large multilingual embedding model such as bge-m3Nearly any WebGPU or WASM deviceCompetitive at their single task; the browser's default choice
Compact speech and vision modelsTens of MB to a few hundred MBMid-range hardware and upBatch work is comfortable; real-time depends on device tier
Small instruct LLMs (roughly 1-4B quantized)Hundreds of MB to ~2 GBRecent laptops and flagship phonesUsable for narrow, guarded short-form generation
Larger LLMs (single-digit billions, quantized)Multiple GBStrong desktops with generous memoryThe WebLLM paper's throughput table tops out at 8B (4-bit, measured on one Apple M3 Max); WebLLM's prebuilt list places its 70B builds below a code comment labeling those entries older versions or not as practical — not a mass-audience target

Sizes above are approximate bands drawn from model file sizes on the Hugging Face hub, checked in November 2026; the device and quality columns are editorial judgments, not documented figures. Re-verify against current catalogs when you build your shortlist.

Quantization belongs in this section because it is a selection-time variable, not just a runtime detail. The same weights at fp16 and at 4-bit are effectively two different candidates: roughly a factor-of-four difference in weight size (16 versus 4 bits per weight, before quantization metadata), and a smaller gap in resident memory — WebLLM's prebuilt list, for example, gives Llama-3.2-1B-Instruct a VRAM requirement of about 2,573 MB at fp16 versus about 879 MB at 4-bit (as of November 2026). As for quality, a working hypothesis, not a documented rule, is that the loss from quantization varies by task — measure it on your task rather than assuming a fixed loss. In practice a selection is often a small ladder of variants — a lighter and a heavier build of the same model — with the capability probe deciding which device receives which. That routing mechanics belongs to the detection article; what matters here is that the ladder is designed at selection time.

Where browser-runnable models come from

A model that exists is not a model that runs in a web page. The supply chain matters; as of November 2026, two paths serve as worked examples here, not endorsements. Transformers.js consumes ONNX-format models distributed on the Hugging Face hub, covering the task-model families above. WebLLM runs MLC-compiled models — chat-shaped LLMs, plus some embedding and vision-language models — from a prebuilt list maintained in its repository, and custom models in MLC format can also be added.

The conversion honesty is the part selection guides tend to skip. Between "the weights are open" and "there is a maintained browser build" sit format conversion and operator support, and both are real gates. A model whose architecture the runtime does not support, or whose browser conversion nobody maintains, is not a candidate no matter how well it benchmarks — "is there a maintained browser build" is a legitimate first-class selection criterion.

Community-quantized variants deserve one more sentence of care. They are a genuine supply chain and often the most convenient artifact available, but provenance and the exact quantization recipe change behavior — note where the artifact came from and which recipe produced it. Then pin it: the model is a dependency, and it gets dependency discipline. Reference an exact revision, never a floating "latest," so that the artifact you evaluated is the artifact you ship.

The license check as an engineering step

Shipping a model in a web page sends a copy of the weights to every visitor's device, and a model's license can treat that as distribution. Gemma's Terms of Use (last modified April 1, 2026; they cover the Gemma models listed in their appendix, while Gemma 4 has its own license), for example, define "Distribution" as "any transmission, publication, or other sharing of Gemma or Model Derivatives to a third party, including by providing or making Gemma or its functionality available as a hosted service via API, web access, or any other electronic or remote means"; other licenses word this differently. That makes the model's license a selection gate — checked when the shortlist forms, not discovered after integration.

Open-weight is not one thing. Model families ship under genuinely different terms: permissive licenses, restricted-commercial grants, research-only releases, and acceptable-use clauses that constrain the feature itself. The engineering diligence is unglamorous and specific — read the actual license file of the actual artifact you intend to pin, including the variant's license where a community quantization repackaged someone else's weights.

This article stays at the diligence level deliberately: what to check and when to check it. What a clause means for your organization is a legal-review question above the individual engineer's PR, and routing it there early is itself part of the craft.

From shortlist to proof

The output of good selection is a shortlist, not a verdict. Two or three candidates, each with expected download size, resident memory, quality posture, sourcing, and license status made explicit — plus the quantization ladder, if the feature needs one. Writing the trade-offs down is what keeps the decision reviewable when the model landscape shifts under it.

Everything in that shortlist is still a hypothesis. Whether a candidate is actually good enough for your task, on your content, at your quality bar, is a question for a task-specific evaluation set to answer — that discipline has its own treatment on this topic, and selection's job is simply to hand it candidates worth testing.

A concrete shape helps. For a comment-moderation pre-filter, an honest shortlist might hold a compact classification model at under 100 MB as the presumptive winner, and a small quantized instruct model as the challenger for the edge cases classification handles poorly — each entry carrying its delivered size, expected resident footprint, the hub revision pinned, and the license verdict. The evaluation set then earns its keep by telling you whether the challenger's edge-case gains survive contact with your real content, or whether the simpler model wins outright. Sometimes the smaller model does — which is exactly why the shortlist exists: to make that outcome a measured decision rather than a missed opportunity.

Re-selection, finally, is scheduled reality rather than failure. Small-model quality changes between releases, and a candidate that lost in an earlier round may win today at half the size. Keeping the losing shortlist around lets you re-run it occasionally against the incumbent — cheaply, on the same evaluation set, with the discipline that a switch must justify its migration cost.

Project Inquiry