Transformers.js v4.3: Structured Output in the browser
by Hugging Face11:08 long4.5K views
Why watchAn 11-minute Hugging Face walkthrough of Transformers.js 4.3 for JavaScript developers who need models in the browser to return valid JSON every time.
What this video covers
This Hugging Face video walks through the Transformers.js 4.3 release, whose headline feature is structured output in the browser. A new package, @huggingface/transformers-structured-output, forces a model to follow an exact JSON Schema or regular expression.
The first minute and a half covers the rest of the release. After the announcement at 0:00, the chapter at 0:26 is about the new documentation pipeline, which the description calls a complete overhaul. Community-contributed fixes and features get a short mention at 1:00.
From 1:19 the video sets out the problem: language models return unreliable JSON, and developers end up stripping markdown fences and hoping the property names came out right. At 2:18 it explains how constrained decoding works. According to the description, the new package hooks into the logits processor in Transformers.js; adding that processor is the subject of the chapter at 3:25.
The longest stretch, from 3:37 to 6:03, covers the new packages folder in the repository and the plugin approach that structured output uses. At 6:03 the video turns to constraining output with a regex instead of a JSON Schema, and at 6:45 a recipe generator demo shows the feature in use.
The second half tells the story behind the feature. From 7:33 it covers llguidance, which the first version wrapped through WASM. At 9:02 the video explains rewriting it in pure JavaScript, which the description says runs with almost no overhead. A chapter at 9:22 looks at performance on Gemma 4, Granite and LFM 2.5; the sources do not give the figures. The last chapter, at 10:26, points viewers to try it.
The description links the 4.3.0 release notes on GitHub and the npm pages for both the main library and the structured output package.
Written by HuiaHub from the creator's title, description and chapters. All credit for the video goes to Hugging Face.
Key takeaways
- Transformers.js 4.3 can constrain model output to a JSON Schema or a regex in the browser.
- Structured output ships as a separate package, @huggingface/transformers-structured-output.
- The package works by hooking into the Transformers.js logits processor.
- Constrained decoding removes the need to parse markdown fences out of model replies.
- The feature started as a WASM wrapper around llguidance and was rewritten in pure JavaScript.
- Version 4.3 also overhauls the documentation pipeline.
Chapters
- 0:00Transformers.js 4.3 is out (opens YouTube at this moment)
- 0:26New documentation pipeline (opens YouTube at this moment)
- 1:00Community contributions (opens YouTube at this moment)
- 1:19The problem: unreliable JSON from LLMs (opens YouTube at this moment)
- 2:18How constrained decoding works (opens YouTube at this moment)
- 3:25Adding the structured output processor (opens YouTube at this moment)
- 3:37The new packages folder and plugin approach (opens YouTube at this moment)
- 6:03Using regex instead of JSON Schema (opens YouTube at this moment)
- 6:45Demo: recipe generator (opens YouTube at this moment)
- 7:33Behind the feature: llguidance (opens YouTube at this moment)
- 9:02Rewriting it in pure JavaScript (opens YouTube at this moment)
- 9:22Performance across Gemma 4, Granite and LFM 2.5 (opens YouTube at this moment)
- 10:26Try it out (opens YouTube at this moment)
More videos
22:46intermediateHow Inference Keeps Up with Our Insatiable Need for Tokens — Cerebras & Gimlet Labs
A 22-minute AI Engineer talk for inference engineers that covers runtime tricks like paged KV cache and chunked prefill, then system-level disaggregation and kernel-writing agents.
AI Engineer · 1.2K views ·
14:22intermediateSandboxes Aren't Optional: 4 Ways to Isolate Coding Agents — Robert Brennan, OpenHands
A 14-minute talk from the OpenHands CEO comparing four ways to sandbox coding agents, for developers who run agents with broad permissions.
AI Engineer · 3.9K views ·
19:17intermediateStop Renting Intelligence: The Train-to-Deploy Loop for Specialized AI — Fireworks AI
A 19-minute Fireworks AI talk on training open models on your own data and redeploying them in a continuous loop, for teams weighing closed-model costs.
AI Engineer · 6.1K views ·
14:07intermediateThree Questions Every Agent Engineer Should Be Able To Answer
A 14-minute LangChain talk on finding, reproducing and fixing agent failures using production traces, for engineers who run agents in production.
LangChain · 8.1K views ·