Scene Generator
Generate a Seinfeld scene
MODEL
~1.9 GB download · better quality · 1-4 min generation
TOPIC / SITUATION
TOKENS PER TURN 50–500
MIN WORDS PER TURN 3–100
How it works

Two language models were fine-tuned on ~0 Seinfeld script excerpts to learn the show's dialogue style, character voices, and scene structure. Both models run entirely in your browser using WebAssembly — no server, no API keys, no data leaves your machine.

Llama 3.2 3B was trained with QLoRA (quantized low-rank adaptation) — only 0 of the model's parameters were updated, but that was enough to teach it Seinfeld's format and tone. The model is served as a 4-bit GGUF file (~0, sharded into 4 chunks for browser memory limits) and executed via WebAssembly with optional multi-threading.

GPT-2 Medium (0 params) was fine-tuned with a deeper LoRA configuration targeting both attention and MLP layers (r=64, 0 trainable params). It's served as an int8 ONNX model (~0) and runs through the ONNX Runtime WebAssembly backend.

Generation pipeline

When you click "generate", here's what happens under the hood:

T
Topic
your input text
P
Prompt
TOPIC + CHARS + [LOCATION]
θ
Model
LoRA weights via WASM
R
Raw tokens
multi-round generation
F
Filter
6-stage post-process
S
Scene
parsed dialogue

The Llama backend uses multi-round generation: it generates the first character's turn, then injects the next character's name into the prompt and generates again, repeating 4 times to ensure all main characters speak. Each round uses top-k sampling (k=8, temp=0.7) with a repetition penalty.

// Prompt format (Llama 3B)
TOPIC: losing a parking spot

CHARACTERS: JERRY, GEORGE, ELAINE, KRAMER

[JERRY'S APARTMENT]

// Round 1: model generates first character's turn freely
// Round 2-4: inject "GEORGE: ", "ELAINE: ", "KRAMER: "
//   → forces each character to speak
JS-side filtering

Raw model output is noisy — small models hallucinate character names, repeat phrases, and ramble past natural endpoints. A 6-stage post-processing pipeline cleans this up entirely in JavaScript before rendering:

LoRA fine-tuning

Both models were trained on the same dataset of 2,295 Seinfeld script excerpts, formatted as:

TOPIC: Jerry finds out his new girlfriend is a close talker

[JERRY'S APARTMENT]

JERRY: So I'm standing there, and she's like six inches from my face.
GEORGE: Six inches? That's nothing. I had a woman once...
...
[END]

LoRA (Low-Rank Adaptation) freezes the original model weights and inserts small trainable matrices into the attention layers. This means we only update ~1-7% of the parameters, which is enough to teach the model the Seinfeld format and character voices while keeping its general language ability intact.

The Llama model used QLoRA (4-bit quantized base + LoRA adapters) with r=32 and alpha=64, trained for 5 epochs on a single A100 GPU in ~25 minutes. GPT-2 used a deeper LoRA with r=64 targeting both attention and MLP layers, trained for 20 epochs in ~19 minutes.

We tried Qwen2.5-7B (both base and instruct) but the base model's code/math priors were too strong, and the instruct model's RLHF training fought our plain-text format. Smaller models with weaker priors turned out to be easier to steer.

Libraries
WebAssembly port of llama.cpp. Loads GGUF models, runs inference with optional multi-threading via SharedArrayBuffer. Powers the Llama 3.2 3B backend.
WASM GGUF
Hugging Face's JS port of the Transformers library. Runs ONNX models via ONNX Runtime Web (WASM backend). Powers the GPT-2 Medium backend.
ONNX WASM
Static site generator. Zero JS by default — only our inline module scripts ship to the browser. Built and deployed to Vercel.
SSG
Hugging Face's parameter-efficient fine-tuning library. Used with bitsandbytes for 4-bit QLoRA training on a single A100 GPU.
TRAINING