complex image models
  • Python 82.9%
  • JavaScript 13.3%
  • CSS 2.3%
  • HTML 1.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-03 00:37:17 +00:00
.forgejo/workflows release: rename PyPI distribution to wink-diffusion 2026-11-26 08:56:01 +01:00
benchmarks experiment: RAT head sweep and CIFAR-10 smoke 2026-11-19 12:45:40 +01:00
docs fix: remove redundant text type vector 2026-12-03 01:04:01 +01:00
examples chore(examples): trim to two MNIST entry points 2026-11-26 07:57:51 +01:00
src/wink fix: remove redundant text type vector 2026-12-03 01:04:01 +01:00
tests feat: frozen RAT-75k text guidance via HyperLinear adapter 2026-12-02 20:00:09 +01:00
web fix(web): keep legacy text type optional 2026-12-03 01:37:09 +01:00
.gitignore experiment: CIFAR RAT width 256 (3.75M) at FID 134.99 2026-11-29 02:08:27 +01:00
.python-version feat: first WINK vision model — RAT-16 MNIST diffusion 2026-11-18 17:12:54 +01:00
AGENTS.md experiment: Hyper 2D GyRoPE and RAT seed/level results 2026-12-01 01:53:29 +01:00
CHANGELOG.md fix: remove redundant text type vector 2026-12-03 01:04:01 +01:00
LICENSE feat: first WINK vision model — RAT-16 MNIST diffusion 2026-11-18 17:12:54 +01:00
pyproject.toml release: rename PyPI distribution to wink-diffusion 2026-11-26 08:56:01 +01:00
README.cs.md experiment: Hyper 2D GyRoPE and RAT seed/level results 2026-12-01 01:53:29 +01:00
README.de.md experiment: Hyper 2D GyRoPE and RAT seed/level results 2026-12-01 01:53:29 +01:00
README.md fix: remove redundant text type vector 2026-12-03 01:04:01 +01:00
README.ru.md experiment: Hyper 2D GyRoPE and RAT seed/level results 2026-12-01 01:53:29 +01:00
README.zh.md experiment: Hyper 2D GyRoPE and RAT seed/level results 2026-12-01 01:53:29 +01:00
uv.lock release: rename PyPI distribution to wink-diffusion 2026-11-26 08:56:01 +01:00

WINK
or: diffusion without the latent training wheels

🇬🇧 English | 🇩🇪 Deutsch | 🇨🇿 Čeština | 🇨🇳 中文 | 🇷🇺 Русский

Home repo — https://git.pvlb.dev/ml-lab/wink
GitHub mirror: https://github.com/pvlb-dev/wink



Welcome to WINK, a tiny lab for complex-valued image generation!

v0.1.1 is a promptable MNIST diffusion model that runs on a laptop CPU, paints white ink on a transparent background, and generates entirely in the browser. Pick a digit, set guidance, get a digit. 261k parameters, 4 layers, RAT-32 — no VAE, no latent decoder, no server.

image geneRATion — the RAT from TARDITS, retargeted from tokens to pixels.

WINK hero: complex-valued pixel diffusion, a neon camera-eye and a hamster mascot.

The RAT block and hypercomplex layers come from TARDITS (tardits>=0.3.0). It is the same RAT family, not the same model: WINK adds 2D patch tokens, a diffusion-step rotor, class conditioning and a pixel head. The 261k promptable checkpoint here is a WINK model, not the 100M TARDITS base.


🚀 Quickstart & Usage

Just want to play?

The 10k promptable weights are already in the repo. No Python training needed:

python -m http.server 5001 -d web
# open http://127.0.0.1:5001

Digit buttons + guidance slider, transparent RGBA output, Web Worker inference. See web/README.md.

Install

From PyPI — the import is still wink:

pip install wink-diffusion
# or
uv add wink-diffusion

From source for development:

git clone https://git.pvlb.dev/ml-lab/wink.git
cd wink
uv sync --locked --extra mlflow --extra eval
.venv/bin/pytest -q

Train the 0.1 model (CPU)

The 10k model behind the browser weights takes ~46 min on t14:

.venv/bin/wtrain -c examples/configs/mnist_rat_cond_cfg_h32_10k.yaml

For a simple unconditional first run, examples/configs/mnist_rat.yaml trains RAT-16 in ~19 min. The MNIST cache is included in examples/data/.

Generate prompted digits

.venv/bin/wsample \
  -c examples/configs/mnist_rat_cond_cfg_h32_10k.yaml \
  --checkpoint examples/saved/mnist_rat_cond_cfg_h32_10k/final.pt \
  -n 80 --classes 0,1,2,3,4,5,6,7,8,9 \
  --guidance 5 --alpha --nrow 8 -o prompted.png

Writes a transparent RGBA sheet and a checkerboard preview.

Unconditional alpha digits

MNIST is white ink on black, so the grayscale intensity is an alpha mask. The original RAT-16 checkpoint is already an alpha model:

.venv/bin/wsample -c examples/configs/mnist_rat.yaml \
  --checkpoint examples/saved/mnist_rat_h16/final.pt \
  -n 64 --alpha -o alpha.png

Export the real MNIST test split as RGBA PNGs (no GIMP):

.venv/bin/python docs/scripts/mnist_to_alpha.py --split test

Track runs

mlflow ui --backend-store-uri sqlite:///mlflow.db

🙃 Architecture

Click to expand 🔻

WINK architecture: noisy image plus one-hot digit, patch embed, factorized 2D position, time rotor, four RAT blocks, pixel head, unpatchify and alpha renderer.

The WINK denoiser. The digit plane is concatenated to the noisy image; the time rotor is applied after the 2D position; the renderer outside the model turns x0 into RGBA.

x0 [B,C,H,W] -> 4x4 patches -> complex patch embedding
             -> + factorised 2D position (+ class plane in v0.1)
             -> time rotor R_t (ported from dagoBERT)
             -> hyper (full complex softmax) | rat (bidirectional fast-weight)
             -> complex head -> x0_hat [B,C,H,W]
  • No VAE, no latent. Diffusion runs directly in pixel space at 28×28 (MNIST) and 32×32 (CIFAR); a bad sample is the denoiser's fault.
  • Patches: 4×4, so MNIST is 49 tokens and CIFAR is 64.
  • Time: a learned complex rotor rotates the latent by the diffusion step; no separate absolute time table.
  • RAT: the bidirectional fast-weight block from tardits, with a chunked scan for the 64-token CIFAR window. hyper is the full-softmax control.
  • Conditioning (v0.1): a 10-channel one-hot digit plane is concatenated to the noisy image at every DDIM step; 10% class dropout gives a null branch and classifier-free guidance (--guidance) makes the digit obey the prompt. This is digit-class conditioning, not free text: the UI maps “seven” to 7.
  • Levels: level is a config field (ℂ, ℍ, 𝕆, …). Level 1 is the CPU default; levels 2/3 work on CIFAR but cost more than they return at this scale.

The detailed design, invariants and port map: docs/model-internals.md.

🔥 Evidence & measurements

Click to expand 🔻

M1 — MNIST, 3k CPU steps

model val x0-MSE note
hyper softmax 0.0801 blob-like samples
RAT-16 0.0629 readable digits
RAT-32 0.0617 CPU pick, 217.5 ms/step

Quality saturates around 8–32 heads; speed keeps improving. Full tables: mnist-hyper-vs-rat.md, rat-head-sweep.md.

M2 — CIFAR-10, 10k steps, FID vs 10k real images

model val x0-MSE FID
hyper 10k 0.0347 160.36
RAT-32 10k 0.0351 156.12
RAT-32 20k cosine 0.0326 @17k 178.68
RAT-32 width 96, learned table, 10k 0.0330 149.60
hyper width 96, 2D GyRoPE, 10k 0.0328 134.74
hyper width 96, 2D GyRoPE, level 2, 10k 0.0333 134.62
RAT width 96, row GyRoPE, 10k (2 seeds) 0.0322–0.0328 144.48–148.52
RAT width 96, row GyRoPE, level 2, 10k 0.0315 138.15
RAT width 256, 4L, 10k 0.0312 134.99
RAT width 288, 4L, 10k 0.0313 138.02
RAT width 384, 6L, 20k, learned table 0.0306 96.92
RAT width 384, 6L, 20k, row GyRoPE 0.0302 83.30
Hyper width 384, 6L, 20k, 2D GyRoPE 0.0320 101.26
quaternion level 2, 10k 0.0342 170.04

The honest story: RAT wins at 49 tokens; CIFAR is texture-level, not object-level. Position control changed the CIFAR attention picture: at 4L×96/10k, Hyper with sequential 2D GyRoPE reaches 134.74 FID vs RAT row-GyRoPE 144.48–148.52, so Hyper is ahead at matched size; level 2 is a tie for Hyper (134.62) and an improvement for RAT (138.15). More steps can lower val while hurting FID; width helps through 256 (FID 149.60 to 134.99 at 7× params), the 288-only point was a local dip, depth + 20k at 12.54M moved FID to 96.92, and the vertical row GyRoPE at the same scale reached 83.30. Hyper's 2D rotor at 12.5M reached 101.26; RAT wins at scale, Hyper wins at matched 4L×96. Reports: 2026-11-19-cifar10-10k.md, 2026-11-20-cifar10-rat-chunked.md, 2026-11-20-cifar10-head-sweep.md, 2026-11-20-cifar10-20k-cosine.md, 2026-11-21-cifar10-levels.md, 2026-11-21-cifar10-param-matched-10k.md, 2026-11-29-cifar10-w256.md, 2026-11-29-cifar10-w288.md, 2026-11-30-cifar10-w384-6l-20k.md, 2026-12-01-hyper-position.md, 2026-12-01-rat-seed-level.md, 2026-12-01-cifar10-w384-6l-rowrope.md.

0.1 — promptable MNIST

model params budget val x0-MSE
unconditional RAT-32 250k 3k 0.0617
channel + class dropout + CFG 261k 10k 0.0435

Prompted 0–9 grid: prompted_digits_10k_preview.png. Details: 2026-11-21-mnist-promptable.md.

Conditioning comparison at 10k (classifier accuracy on 64 samples/class): channel + CFG 96.9% at guidance 5; additive 94.4%; class rotor 93.0% at its best guidance; joint text prefix 100%. A single learned text token prepended to the patch sequence reaches 100%; five character tokens without a text-position table reach 81.4% unguided and 99.1% at guidance 5; a frozen RAT-75k latent plus one HyperLinear adapter reaches 78.3% unguided, 99.8% at guidance 5 without a text-type vector. Reports: 2026-12-01-mnist-class-rotor.md, 2026-12-01-mnist-text-prefix.md, 2026-12-01-mnist-multi-token.md, 2026-12-02-mnist-rat75k-guidance.md.

What did not work (yet)

  • 1,000-step / epsilon prediction at 0.24M params: high-noise x0 was too inaccurate; sampler stayed noise.
  • v-prediction at 1,000 steps: plateaued.
  • Additive sinusoidal time conditioning: slower convergence.
  • Longer CIFAR training (20k) and quaternion level 2 at equal params: lower val, worse FID.
  • A 6-layer depth control was deferred at ~1.5 s/step under laptop load.

These are recorded as nulls, not hidden.

🗺️ Repo map & docs

Click to expand 🔻
src/wink/            models, diffusion, trainer, data, alpha, CLIs
examples/configs/    two entry points: simple MNIST + promptable 10k
examples/data/       MNIST cache (11 MB), committed
examples/saved/      empty; checkpoints written here
docs/                findings, experiments, model internals, repo map
web/                 pure-JS promptable toy + exported weights
tests/               38 tests (no network needed)
AGENTS.d/            private knowledge clone, not tracked here

🧭 Outlook

  • 0.1.x: CPU MNIST release shipped; 0.1.1 is on PyPI as wink-diffusion.
  • Fashion-MNIST: second tiny dataset, same alpha/promptable pipeline.
  • RGBA: true colour + alpha diffusion, not just grayscale-as-alpha.
  • CIFAR capacity: 6L × width 384 / 20k is the current best at FID 96.92 (12.54M). At matched 4L×96/10k, Hyper 2D GyRoPE now leads RAT (134.74 vs 144.48–148.52); next is scaling Hyper with the fixed 2D rotors and testing RAT level 2 at larger width.
  • Text conditioning and VAE/latent variants are out of scope for v0.

📜 License & attribution

Apache-2.0; see LICENSE. WINK is the image sibling of TARDITS; the RAT block and hypercomplex layers are shared, the image model is its own.