diffusion.css

A denoising diffusion model that runs entirely in CSS - no JavaScript, no WebAssembly, no images.

Working when we checked on .

Visit diffusion.css

What is diffusion.css?

diffusion.css is an experimental denoising diffusion model that runs entirely in a CSS stylesheet, generating 16×16 sprites with zero JavaScript, WebAssembly, or images. It is aimed at web developers and ML enthusiasts curious about browser-native machine learning demonstrations. Pressing a button freezes a seed derived from a CSS @property counter, converts it to Gaussian noise, and denoises it in 12 DDIM sampler steps using 202,863 integer weights embedded in calc() expressions. The page ships as 5.2 MB of CSS containing 11 small PyTorch-trained neural networks and 12,518 @property registers for intermediate values.

diffusion.css pricing

Pricing model: Free

diffusion.css pros

  • Runs a real diffusion model with no JavaScript, WebAssembly, or images
  • 202,863 weights and 12 sampler steps produce 16×16 sprites
  • 11 small neural networks trained in PyTorch on ten hand-drawn sprites
  • Different seeds yield different sprites and colors, nothing pre-rendered
  • Source, training code, and a Python reference sampler available on GitHub

diffusion.css cons

  • Requires a current browser with :has() support, such as Chrome, Edge, Firefox, or Safari
  • Output limited to 16×16 pixel sprites only
  • Stylesheet is 5.2 MB of CSS, which is heavy for a web page

Frequently asked questions about diffusion.css

What does diffusion.css do?

It runs a denoising diffusion model entirely in CSS. Pressing a button freezes a seed, turns it into noise, and denoises it into a 16×16 sprite in 12 steps, with no JavaScript, WebAssembly, or images.

How is the random seed generated?

An @property integer counts up inside a keyframe animation. Ticking a hidden checkbox pauses the counter, so the moment the user presses the button becomes the random seed.

How many weights and sampler steps does the model use?

The model uses 202,863 weights and 12 DDIM sampler steps. All weights are written out as integer literals inside calc() expressions.

How was the model trained?

It consists of 11 small neural networks, one per noise level, trained in PyTorch on ten hand-drawn sprites recoloured to random hues, then pruned and rounded to integers.

Does it require JavaScript to run?

No. The page contains no script tag at all, and the entire diffusion process is computed by CSS via @property registers and a keyframes rule.

What browsers are supported?

It needs a current browser supporting :has(), such as Chrome, Edge, Firefox, or Safari. Browsers lacking :has() cannot run the page.

Are results reproducible for a given seed?

Yes. A Python reference implementation using the same integer arithmetic produces identical pixels for the same seed.

Is the source code available?

Yes. The source, training code, and a reference sampler are available on GitHub at Metrix187/diffusion.css.

What is the size of the CSS file?

The stylesheet is 5.2 MB of CSS containing 202,863 weights, 12,518 @property integer registers for intermediate values, and zero lines of JavaScript.

Is diffusion.css free to use?

Yes, it is a free browser-based demo available on its GitHub Pages site, with source code published on GitHub.

Categories

Use cases

Alternatives to diffusion.css

Similar AI tools

Search AI tools on NeedAnAI · All AI tools A–Z