sweedworks

Source

Every figure on this site is computed by one of these scripts rather than typed in by hand, and every interactive tool is checked against a second implementation before it ships. Here they all are.

Nothing here is compiled or obfuscated. If you want to know how a number on this site was produced, you can read the line that produced it. The JavaScript is served at its own paths — permalink.js, bpe.js, ngram.js, tokens/app.js.

FileWhat it doesLines
build.shThe whole build, every step76
chatcost.pyThe chat billing rule, checked against the encoder116
mlp.pyThe neural language model behind /learn/, by hand311
checkmlp.pyGradient checks, and browser vs Python agreement141
attn.pyOne attention head, and the induction-head result349
task.pyThe copy task a fixed window cannot do50
checkattn.pyGradient checks for the attention head123
checka11y.pyWCAG contrast ratios, computed from the stylesheet140
checkstructure.pyHeadings, labels and landmarks101
checklive.pyServed bytes vs generated, and every link reachable139
checkassets.pyEvery script and stylesheet, byte for byte115
checkcookies.pyWhat is actually in the browser's cookie store68
checkrequests.pyEvery host a browser really contacted117
checkdelivery.pyWhat a reader downloads, and whether it caches117
checkfigures.pyNo number in the prose that is not in the data110
bpe.pyByte pair encoding — the reference for /vocabulary/119
ngram.pyThe n-gram model and sampling knobs behind /predict/175
render.pyGenerates every page on the site, including this one2720
precompute.pyComputes the figures on /tokens/147
precompute_merges.pyComputes the figures on /vocabulary/66
precompute_predict.pyComputes the figures on /predict/80
corpora.pyThe training texts used throughout61
verify.pyChecks both shipped tokenizer bundles against the reference103
makebundle.pyBuilds the cl100k browser bundle upstream got wrong159
checkbpe.pyBrowser BPE trainer vs the Python reference99
checkngram.pyBrowser sampler vs the Python reference158
checkhtml.pyStrict HTML parse, dead links, feed and sitemap156
checkjs.pyCompiles the site's JavaScript with a real engine49
checkpermalink.pyRound-trips shareable links through a stubbed DOM272
checklive.pyCompares served bytes against what was generated139
cjsload.pyLoads the tokenizer's CommonJS build under QuickJS88
tokenlib.pyLoads the shipped browser bundle under QuickJS82
The build runs these in order; it fails and refuses to deploy if any check does not pass.