AI Deep Systems · first vertical slice
Tiny Transformer Evidence Lab
Predict first, edit a bounded fixture, run real deterministic numeric math, replay semantic tensor steps, compare logits and sampling, defend a trade-off, then try a transfer input.
Evidence boundary before you run
This is a tiny deterministic numeric teaching model. It is not a reproduction of a production LLM, and this page makes no network or real-model call.
d_model=3 · one head · d_k=d_v=2Matrix/vector values produced by this browser engine.
A fixed tiny fixture plus named uint32 PRNG; no learned model is loaded.
Replay highlighting only; the highlight is not another model execution.
NOT USED on this page.
Displayed scalar slots × 4 bytes, assuming float32 payload only.
GPU memory, runtime memory, latency, and production-model behavior.
Determinism scope: identical validated config and seed replay the same trace in this engine. This is not a claim of bitwise reproducibility across model frameworks, releases, browsers, CPUs, or GPUs.
1 · predict before evidence
Lock a falsifiable receipt
Predict the output of ordered merges and the Q tensor shape. The receipt stays fixed while you edit parameters.
2 · bounded semantic edit
Prompt, tokenizer fixture, weights, and sampling
Only JSON data and scalar controls are parsed. No input is evaluated as JavaScript or executed on a server. Vocabulary size must remain compatible with the fixed embedding/output fixture.
1–32 Unicode characters; every final token must exist in the vocabulary fixture.
Tokenizer merge and vocabulary fixtures
This ordered character-merge fixture is inspectable BPE-inspired teaching machinery, not a GPT-2 tokenizer reproduction.
Q / K / V weights · each shape [3, 2]
Canonical for d_k=2: 1/√2 ≈ 0.7071
0 selects the separate greedy path.
Blank disables top-k.
(0, 1]; 1 disables top-p.
Unsigned 32-bit integer.
No request leaves the browser. Invalid shapes, ranges, tokens, or IDs fail closed before calculation.
Implementation counterexamples are locked.
Run the current prediction receipt and visit every semantic replay step before comparing the broken, correct, and over-engineered attention variants.
4 · defend, then transfer
Commit your trade-off before a new input
Why must a causal mask be applied before softmax? What changes when the score scale is removed or sampling filters become narrower? This field records an answer; it does not grade understanding.
Current-run gate: lock a prediction, run it, keep the draft unchanged, and visit every replay step (0/0).
Lock the defense first. Loading this input clears the prediction receipt, so you must predict again.
Primary sources and omitted architecture
This one-head forward pass intentionally omits multi-head concatenation, residual connections, layer normalization, MLP blocks, training/backprop, a production tokenizer, KV cache, batching, quantization, and hardware kernels. Those omissions prevent this page from standing in for a production Transformer.
- Transformer formula and architecture ↗
Vaswani et al. — scaled dot-product attention, masking, projections, embeddings, output softmax
- Byte-pair encoding ↗
Sennrich et al. — ordered subword merges; this lab uses a smaller character fixture
- Concrete tokenizer implementation ↗
OpenAI GPT-2 encoder.py — byte mapping, ranked merges, and vocabulary IDs
- Nucleus sampling ↗
Holtzman et al. — top-p truncation of the unreliable probability tail
- Attention is not automatically explanation ↗counterargument ↗
Jain & Wallace; read with the published counterargument by Wiegreffe & Pinter
- Reference API semantics ↗
PyTorch scaled_dot_product_attention — scale, mask-before-softmax, final-axis normalization, and @V