Update post: How a Transformer Really Works: Attention, the KV Cache, and Why Inference Eats Memory - #42
Merged
HumbleBee14 merged 1 commit intoJul 22, 2026
Conversation
… and Why Inference Eats Memory
HumbleBee14
deleted the
post/how-transformers-work-with-attention-and-kv-cache-tdrdjg
branch
July 22, 2026 07:21
HumbleBee14
added a commit
that referenced
this pull request
Aug 21, 2026
Ports personal-site's equivalent tool: npm run convert-post -- <path> runs a hand-written or agent-written index.mdx through the same convertMdx -> serializePost pipeline the editor uses, writes .write-source.json next to it, and rewrites index.mdx to the editor's canonical form if publishing from /write would have changed it. Refuses to write anything if the editor's own output isn't stable under a second conversion pass. Audited for the personal-site equivalent's destination-field gap (a field buildFrontmatter branches its entire frontmatter shape on, that convertMdx deliberately leaves for the caller to supply) — mlsystems has no such field; every PostMeta field, including date, is set directly by convertMdx on a normal parse, so no analogous fix needed here. Validated against the real how-transformers-work-with-attention-and-kv-cache PR (#42) round trip, including its mermaid diagram: the script's SVG output for that diagram matched the pre-publish state byte-for-byte, since serializeMermaid only ever passes through whatever SVG is already baked into the block rather than re-rendering it — a browser session touching the diagram live is the only thing that changes its baked pixel measurements, not this script. Documents the same in docs/authoring/mdx-format.md's new "Checking it before you publish" section.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How a Transformer Really Works: Attention, the KV Cache, and Why Inference Eats Memory
A from-scratch tour of what's actually inside an LLM: how a transformer turns tokens into predictions, what Query, Key, and Value really mean, and how generating text one token at a time builds the KV cache — the growing pool of memory that makes inference so expensive.
Important
To confirm your identity, please comment below with your name.
Tip
Preview — a link to your post appears below once the Cloudflare check passes.