Your model,
running in the page.
No server to rent for inference. A Zyth program builds into a web page or an npm package, and its tensors and models run in the visitor's browser, on their GPU when there is one.
The whole program in a page
Everything Zyth does, in the browser: tensors, training, GPU drawing.
zyth build --target web app.zyth -o dist
A React component in npm
Props checked, TypeScript types generated, one shared runtime for every Zyth package in the app.
zyth build --target npm-jsx xor.zyth -o xor npm install ./xor @biodream-llc/zyth-runtime
Shared at its own address
Publish a web build and send the link. Anyone can open it, and remix its source.
zyth share app.zyth # https://<name>.zyth.io
import { XorTrainer } from "xor"; import { Cube } from "cube"; export function App() { return ( <main> <XorTrainer steps={50} /> <Cube /> </main> ); }
It is just React
A Zyth component is a function that returns elements, with the hooks you know: use_state, use_effect, use_reducer, use_context, use_memo, and Redux's use_selector and use_dispatch. Every HTML and SVG tag is there.
The difference is what it can hold: a neural network that trains when the visitor clicks, a language model that answers questions in the tab (talk to it), a 3D scene drawn on the GPU (see the solar system).
The runtime package is on npm today.
Or no framework at all
zyth.web.ui is Zyth's own way to build pages. A component builds its part of the page once, then changes only the nodes whose values changed: no virtual DOM, nothing drawn twice, no React in the bundle. State, derived values, keyed lists, events and routing are built in, and resource waits for the WebAssembly half when a page calls a model.
The JavaScript a page downloads is 2.7 KB gzipped. The same table in Svelte 5 is 13.8 KB, in React 19 68.4 KB.
use zyth.web.ui.{div, h1, button, state, View} @export fn Counter(label: str, start: i64 = 0) -> View { var count = state(start) return div(class: "counter") { h1 { "{label}: {count}" } button(on_click: || { count += 1 }) { "+1" } } }
As fast as Svelte, measured
The operations of js-framework-benchmark on a table of rows, milliseconds from the click to the frame that shows the result, median of 30 runs, production builds, headless Chromium. Svelte 5 written for speed, React 19 with memo.
| Operation | Zyth | Svelte 5 | React 19 |
|---|---|---|---|
| create 1,000 rows | 44.4 | 46.1 | 55.6 |
| replace 1,000 rows | 52.0 | 54.2 | 68.0 |
| update every 10th row | 14.6 | 14.7 | 18.1 |
| select a row | 2.1 | 2.7 | 3.7 |
| swap two rows | 5.3 | 5.3 | 44.7 |
| remove a row | 7.3 | 8.1 | 10.5 |
| create 10,000 rows | 428.8 | 430.2 | 819.6 |
| append 1,000 rows | 51.2 | 51.7 | 61.8 |
| clear 1,000 rows | 4.9 | 6.5 | 9.4 |
Level with Svelte on most operations, ahead on select, remove and clear, and ahead of React on all of them. Not measured yet: memory, start-up, Firefox and Safari.
A smaller runtime for pages
Pages that don't draw or decode images get Zyth's light WebAssembly runtime: 3.5 MB, 1.2 MB gzipped, with programs already checked at build time. It loads in 0.64 to 0.69 of the full runtime's time at the same speed: 75 ms against 115 from a local server, 1.24 s against 2.10 s at 10 Mbit/s.
What runs in the demos
- A tiny GPT trained on Shakespeare, writing text in the page.
- A network learning XOR inside a React + Redux app, with a 3D cube drawn by Zyth beside it.
- A shape error caught in a live editor, before anything runs.
- Language models on the visitor's GPU: a chat assistant running Qwen2.5-Instruct through WebGPU, about 120 tokens a second on an RTX 3090 with the 0.5B model. The build packs the weights to 4 bits and the page keeps them, so the second visit starts without a download.
- GPU drawing through WebGPU: the solar system, with 24,000 asteroids moved as GPU tensors every frame and a glow pass. A million asteroids run at 519 frames a second on an RTX 3090, against 19 for three.js moving them from JavaScript.