Datasets:
frame int32 0 6.57k | time stringlengths 7 7 | g int8 4 8 | blank bool 2
classes | loss float32 0.02 0.98 ⌀ | iou float32 0.58 1 ⌀ | target imagewidth (px) 256 256 | attention imagewidth (px) 256 256 | text stringlengths 7.47k 21.1k |
|---|---|---|---|---|---|---|---|---|
0 | 0:00.00 | 4 | true | null | null | Ind Ind man man poi poi Ind man TYPE trio Ind ki ki ki Ind Ind man ki ki man chí poi man man poi man man bu sod man sod sod ela sod sod ki sod ki ли district sod ki sod sod sod ki ki sod sod ki ki sod ki chí sod ki ki man man fragments man sod sod man sod sod phận ki ki sod ép sod ki ki chí ki ki ki sod sod man man ma... | ||
1 | 0:00.03 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man chí poi man man poi man man bu sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki chí sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki chí ki ki ki sod sod man man man chí man chí chí... | ||
2 | 0:00.07 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man chí chí m... | ||
3 | 0:00.10 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man chí chí m... | ||
4 | 0:00.13 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man chí chí m... | ||
5 | 0:00.17 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man man man m... | ||
6 | 0:00.20 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man man man m... | ||
7 | 0:00.23 | 4 | true | null | null | Ind Ind man man poi poi Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki sod ki sod ki ki ki ki ki ki sod sod man man man man man man man m... | ||
8 | 0:00.27 | 4 | true | null | null | Ind Ind man man man ki Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki sod sod man man man man man man man man ... | ||
9 | 0:00.30 | 4 | true | null | null | Ind Ind man man man ki Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki sod sod man man man man man man man man ... | ||
10 | 0:00.33 | 4 | true | null | null | Ind Ind man man man ki Ind man man man Ind ki ki ki Ind Ind man ki ki man ki poi man man poi man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki man man ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki sod sod man man man man man man man man ... | ||
11 | 0:00.37 | 4 | true | null | null | Ind man man man man ki man man man man ki ki ki ki Ind Ind man ki ki man ki man man man man man man man sod man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki ki man ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man ma... | ||
12 | 0:00.40 | 4 | true | null | null | Ind man man man man ki man man man man ki ki ki ki Ind Ind man ki ki man ki man man man man man man man man man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki ki ki ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man... | ||
13 | 0:00.43 | 4 | true | null | null | Ind man man man man ki man man man man ki ki ki ki Ind Ind man ki ki man ki man man man man man man man man man sod sod man sod sod ki sod ki ki ki sod ki sod sod sod ki ki sod sod ki ki sod ki ki sod ki ki ki ki ki man sod sod man sod sod ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man... | ||
14 | 0:00.47 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki sod ki ki ki sod ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man ma... | ||
15 | 0:00.50 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki ki ki ki ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man man ... | ||
16 | 0:00.53 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki ki ki ki ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man man ... | ||
17 | 0:00.57 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki ki ki ki ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man man ... | ||
18 | 0:00.60 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki ki ki ki ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man man ... | ||
19 | 0:00.63 | 4 | true | null | null | man man man man man ki man man man man ki ki ki ki ki ki man ki ki man ki man man man man man man man man man sod sod ki sod sod ki ki ki ki ki sod ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki ki man man man man man man man man man man man man man man man ... |
Bad Apple!! in Qwen3 attention: the text is the video
Every frame of Bad Apple!! is one line of plain text. Feed the line to an unmodified Qwen3, and the first layer's attention logits draw the frame. No weights are trained or changed, and there is no hidden channel: the picture comes only from which real words stand where.
https://www.youtube.com/watch?v=eFAwXZe_fZI
The same second (1:00–1:10), drawn by the three texts in this dataset. Left: the 1-bit target.
At a glance
bad_apple.txt |
mosaic16/ |
mosaic64/ |
|
|---|---|---|---|
| model | Qwen3-0.6B | Qwen3-0.6B | Qwen3-32B |
| heads that draw | 1 (head 0) | 16, one 256² tile each | 64, one 256² tile each |
| frame | 256² | 1024² (4×4 tiles) | 2048² (8×8 tiles) |
| covers | the whole video, 3:39 | 1:00–1:30 | the whole video, 3:39 |
| tokens per line | 1,280 or 2,304 | 20,480 | 81,920 |
| size | 83 MB | 136 MB | 5.2 GB |
| quality | corr 0.905, IoU 0.929 | display corr 0.891 | display corr 0.940 |
| preview |
mosaic64 with every token on screen: 8K video on YouTube. The
Space plays bad_apple.txt live in your browser (pause,
change a word, watch one row or column change), and the notebook does the same on Colab. Local use:
Quickstart.
Where the idea comes from
This dataset was inspired by brayevalerien's Bad Apple but it's GPT-2 XL Attention Maps, which turned a frozen GPT-2 XL's attention into a display by optimizing an input embedding for every frame. Here the input is text instead: every frame is a line of real words, so the whole video can be written down, shared as a file and played with the stock tokenizer.
Several ideas come from the post: drawing with head 0 of the first layer, working on the logits rather than the attention weights, giving each head its own input, and placing the picture in the bottom-left block of the attention matrix.
What the display is
This line, fed to Qwen3-0.6B, makes head 0 of the first layer draw frame 1800 in its attention logits:
operatives operatives operatives operatives … crane crane crane crane PIT ATP Pearson diamond diamond diamond … وأشار مدريد ONLINE Gow collaps Cinder createSelector ONLINE Cannes stringBuffer createSelector centrally …
A line is T = 256 key tokens followed by g·T query tokens (g = 4 or 8). The frame is the block of query-key
logits, each run of g query rows averaged into one: the keys draw the columns, the queries the rows.
The q/k path
play.py computes layer 0's q/k path directly from the safetensors, without the model's attention module, and
verify.py checks it against transformers:
x = RMSNorm(embed[ids]) # input_layernorm
q = RoPE(q_norm(x · Wq[head 0])) # [L, 128]
k = RoPE(k_norm(x · Wk[kv head 0])) # GQA: head h reads kv head h // 2
logits = q[T:] · k[:T]ᵀ / √128 # the queries' rows over the keys' columns, [g·T, T]
frame = mean over each g consecutive rows # [T, T] = [256, 256]
With RoPE, layer 0 sees only the distance between tokens, so a segment draws the same block anywhere in a line. The mosaics rely on this.
Method
Words, not embeddings
The vocabulary is the 50,903 Qwen3 tokens that decode to a space plus letters and encode back to themselves. Tokenized
with add_special_tokens=False, a line gives back exactly the chosen ids, one token per word. 5,052 lines use g = 4
(1,280 tokens) and 1,518 use g = 8 (2,304 tokens). The price is a discrete search space, 50,903²³⁰⁴ ≈ 10¹⁰⁸⁴⁴ lines
per frame, and a blockier picture (Limits).
No softmax, no triangle
The frame is the logit matrix itself: no softmax, no per-row normalization, no blur. The display standardizes the whole frame and clips it at ±2.5. Following the post's suggestion, the picture sits in the bottom-left block of the attention matrix: every key comes before every query, so the causal mask has nothing to hide there.
One head per segment
As in the post, each head needs its own input, so the mosaics give every head its own segment of 256 + 4·256
tokens. Segment (r, c) is drawn by head head_of[r][c] of the manifest as one 256² tile: 16 heads and
a 1024² frame in mosaic16, 64 heads and a 2048² frame in mosaic64. Tiles are shown with a fixed per-head
calibration, (x − mean_h) / scale_h over ±display; per-tile standardization would turn the frame into a
checkerboard.
Coordinate descent, no gradients
Changing the token at one position changes only one row and one column of the logits, and the loss depends on them
only through Σx, Σx² and Σx·t. So a sweep scores every (position, word) swap in closed form, applies the best swaps at
up to 128 positions, and halves that number while the exact loss does not improve. Each frame starts from the previous
frame's line, or afresh after a scene cut. The video was rendered at g = 4, then the hardest frames again at g = 8,
keeping the better line. The mosaics were solved against the calibrated level, so one calibration per head holds
across tiles and frames; mosaic64 used a low-rank proxy (a tracked rank-4 subspace, one Triton pass) to pick 32
candidates per position.
Results
Quality
bad_apple.txt, 6,353 non-blank frames: loss = MSE(standardized logits, standardized ±1 target) = 2(1 − corr), mean 0.1908 (p10 0.117, p50 0.185, p90 0.259, p99 0.447), corr 0.905. IoU (logits split at the target midpoint vs the silhouette): mean 0.9285, p1 0.783. The worst frames are the thin-dot scene, frames 5421–5483.mosaic16: display corr (Pearson, displayed 1024² frame vs target) 0.891, p10 0.850; 0.931 at 256², against 0.906 forbad_apple.txton the same frames. Frame-to-frame flicker 5.2 levels, against 5.1.mosaic64: display corr 0.940 at 2048² (every 10th frame); on 1:00–1:30, 0.951 at 2048² and 0.962 at 1024².
Madness in numbers
tokens in bad_apple.txt |
9,964,032 (69.9 M characters, not counting spaces) |
tokens in mosaic16 |
18,432,000 (30 seconds of video) |
tokens in mosaic64 |
538,214,400 (the whole video, 5.2 GB of text) |
| bytes per frame | 12.7 KB of text in bad_apple.txt |
| distinct words used | 46,958 of the 50,903 that qualify |
| possible lines of 2,304 words | 50,903²³⁰⁴ ≈ 10¹⁰⁸⁴⁴ |
| scripts used as pixels | Latin, Cyrillic, Arabic, Hangul, Hebrew, CJK, Katakana, Thai, Greek, Hiragana, … |
| most frequent words | itk (53,252), ebooks, 및, gerçekleştiril, defaultMessage, Podesta, grantResults, canActivate |
| longest words | dequeueReusableCellWithIdentifier, UnsupportedOperationException, ArgumentOutOfRangeException |
times the video says apple / Bad |
29 / 52 (by accident; nothing asked for them) |
| compute | ~17 h wall on one NVIDIA GB10 (DGX Spark): 4.5 h for the g=4 video, 5.4 h of g=8 re-renders, 7.0 h for the mosaic; ~32 h more for mosaic64 |
| gradients used | none; every word was chosen by exact coordinate descent |
Content note: the solver picks words for their vectors, not their meaning, so some of them are explicit.
The 8K video
The 8K video (7680×4320, 30 fps, with the song) shows mosaic64 as it
runs: every head's 1,280 tokens in its own block, laid out 8×8 like its tiles (keys blue, queries orange), next to the
original PV and the 2048² frame (the image at the top of this page). The tokens are 3–8 pixels tall, so the crop below
comes from the original file, not the stream.
Head 24's block at 2×: its 256 keys in blue, then its queries in orange. These tokens are the frame.
Break it
The words are the picture, through one matrix product. Shuffle them and the frame falls apart the way the math predicts: shuffled keys scramble the columns, shuffled queries the rows.
Try your own edits in the Space or the notebook.
Don't trust play.py
verify.py runs each line through Qwen3's own transformers modules (layer 0 only: embed_tokens,
input_layernorm, q_proj/k_proj, q_norm/k_norm, rotary_emb) and checks that AutoTokenizer gives the same
ids. The results are recorded in each manifest's verified:
| text | lines checked | max |play − stock| / std(stock) |
|---|---|---|
bad_apple.txt |
all 6,570 | 0.0 (bit-identical, fp32 CPU, transformers 5.17.0) |
mosaic16 |
all 900 × 16 segments | 2.2e-5 alone, 0.0016 inside the 20,480-token line (fp32 CUDA) |
mosaic64 |
not yet (verified: null) |
stock transformers would load all of Qwen3-32B (65 GB) |
Negative controls on line 1800: head 1 differs by 5.13, line 1801 by 4.29. Inside the long mosaic line, fp32 RoPE loses
a little precision at large positions, hence the looser bar (1e-2). verify.py checks any Qwen3 text with a manifest;
the generator is not included.
Limits
- The picture is blocky because of the vocabulary, not the search. After
k_norm, Qwen3's vocabulary keys are nearly one-dimensional, so each row of the frame is a RoPE Fourier series whose coefficients the query picks. Continuous embeddings reach a loss of 0.002–0.004 on the same frames, but they are not text. mosaic64has not been checked against stocktransformersyet.
Quickstart
hf download kecan/bad-apple-attention-text --repo-type dataset --local-dir bad-apple-attention-text \
--exclude "frames/*" --exclude "mosaic64/*" # the viewer table (329 MB) and mosaic64 (5.2 GB) are big
cd bad-apple-attention-text
uv run play.py 1800 --out frame.png # one frame (uv reads the dependencies from the script)
uv run play.py 0:6570 --video bad_apple.mp4 # the whole video (needs ffmpeg)
uv run play.py 0:6570 --score # loss / IoU per frame; ends with the mean
uv run play.py 1800:2700 --mosaic --video mosaic16.mp4
uv run play.py 1800 --mosaic 64 --out m64.png # mosaic64 (Qwen3-32B: downloads its first 4 GB shard only)
uv run verify.py # every line against stock transformers
Without uv: pip install -r requirements.txt, then python play.py …. play.py takes the model, revision, head and
layout from the manifest next to the text, refuses a text that does not match it, and loads only layer 0's embedding
and q/k weights. The whole video renders in about 20 s on a laptop CPU, and --score reproduces logs/replay.jsonl
to the last digit. --text FILE --targets NPZ plays a text of your own.
Browse it
The default frames config has one row per frame: frame, time, g, blank, loss, iou, the 1-bit target,
the attention it draws and the text of the line. Sort by loss to find the worst frames. It is derived from the
.txt by make_frames.py. The .txt files themselves are plain downloads (see Files).
Manifest
A text is a solution for one set of layer-0 weights, and all Qwen3 sizes share one tokenizer, so another Qwen3 would
read it and draw noise. NAME.manifest.json beside each text pins the model. bad_apple.manifest.json (abridged,
comments added):
{"format": 1, "kind": "text",
"model": "Qwen/Qwen3-0.6B", "revision": "c1899de…", // commit of the weights
"tokenizer_sha256": "aeb1…", // sha256 of that revision's tokenizer.json
"head": 0, "T": 256, "vocab": "words", // the head that draws, the canvas, the vocabulary rule
"start": 0, "lines": 6570, "groups": {"4": 5052, "8": 1518}, // frame of line 0, line count, lines per g
"verified": {"transformers": "5.17.0", "lines": "all", "max_rel_err": 0.0}}
// stock-transformers check (verify.py): "all" or the lines checked
A mosaic manifest (kind: mosaic) has the same identity fields plus the layout and calibration:
{"format": 1, "kind": "mosaic",
"start": 1800, "lines": 900, // frame of line 0, line count
"group": 4, "tiles": [4, 4], // queries per row of a segment, rows × cols of the mosaic
"head_of": [[2, 12, 4, 10], …], // the head that draws the segment at (r, c), row-major
"calib": {"2": {"mean": 4.62, "scale": 2.33}, …}, // per head: x̃ = (x − mean) / scale, dark = +1
"display": 1.25, // shown as (x̃ / display + 1) · 127.5
"source": {…}, "verified": {…}} // provenance (free-form); stock check, plus max_rel_err_in_line
Before drawing, a player checks the model, revision, tokenizer sha256, line count and line length (T·(1+g) tokens, or
tiles[0]·tiles[1]·T·(1+group) for a mosaic, with a head and a calib entry for every tile), and takes everything
else from the manifest.
Files
| path | what |
|---|---|
bad_apple.txt |
6,570 lines, one per frame (83 MB) |
bad_apple.manifest.json |
the model, revision, tokenizer, head and line layout the text was made for |
mosaic16/bad_apple-mosaic16.txt |
900 lines for frames 1800–2699, 16 segments each (136 MB) |
mosaic16/bad_apple-mosaic16.manifest.json |
the same, plus the mosaic's layout and calibration |
mosaic64/bad_apple-mosaic64.txt |
6,570 lines, 64 segments each, for Qwen3-32B (5.2 GB) |
mosaic64/bad_apple-mosaic64.manifest.json |
its manifest (tiles: [8, 8]) |
targets/targets-30fps.npz |
the 1-bit frames bad_apple.txt was made for: 6,570 × 256², 30 fps |
targets/targets-30fps-4x4.npz, targets-30fps-8x8.npz |
the same video as 4×4 or 8×8 tiles of 256², for the mosaics |
logs/replay.jsonl, logs/replay.json |
per-frame loss / corr / IoU of bad_apple.txt, and the totals |
logs/mosaic16-eval.jsonl, logs/mosaic16-eval.json |
per-frame display correlation and flicker of mosaic16, and the summary |
preview/*.mp4 |
the attention only, no audio (mosaic64 area-averaged to 768²) |
frames/*.parquet |
the viewer table (329 MB, derived) |
assets/ |
the images on this page |
play.py, verify.py, make_frames.py |
player and scorer, stock-transformers check, frames/ builder |
bad_apple.ipynb |
the Colab notebook: draw, break, verify, render |
Targets: np.load gives packed (bits along the last axis, True = dark), size (256), fps, n, and tiles for
the mosaic files. They were made from the 1080p (Waifu2x) upscale of the PV in the Internet Archive's
bad-apple-resources: 30 fps, grayscale, area-resized to 256² (the
4:3 frame stretched to a square), dark = below 128.
Related
- Bad Apple but it's GPT-2 XL Attention Maps (brayevalerien, February 2026): the post that inspired this dataset.
- nyuuzyou/BadApple-LLaMA-nano trains a 3.5M-parameter LLaMA to memorize the frames as ASCII art. Here the model is stock, and the video lives in the input text.
Citation
@misc{bad_apple_attention_text,
title = {Bad Apple!! in Qwen3 attention: the text is the video},
author = {kecan0406},
year = {2026},
howpublished = {\url{https://huggingface.co/datasets/kecan/bad-apple-attention-text}},
note = {Real-token inputs whose layer-0 attention logits draw every frame of Bad Apple!!}
}
License and credits
The text files, manifests, logs, the frames/ table, the scripts and the notebook are CC BY 4.0. Qwen3-0.6B and
Qwen3-32B (Apache 2.0) are not redistributed; play.py downloads them.
Bad Apple!! (Touhou Project, ZUN / Team Shanghai Alice), arranged by Alstroemeria Records (feat. nomico), shadow-art PV
by Anira. The 1-bit targets and the previews are derived from that video, and all rights to the original remain with
its owners. assets/wall-8k.webp shows one frame of the original PV, which is not covered by CC BY 4.0. No other file
contains original frames, and none contains audio. The tokens in the 8K video use bitmap fonts X.org misc-fixed (public
domain) and Tom Thumb (MIT).
- Downloads last month
- 255






